Exemplo n.º 1
0
 public void SaveToDatabase(IQueryAdapter dbClient)
 {
     lock (items)
     {
         dbClient.runFastQuery("DELETE FROM trigger_in_place WHERE original_trigger = '" + this.item.Id + "'");
         foreach (RoomItem i in items)
         {
             WiredUtillity.SaveTrigger(dbClient, (int)item.Id, (int)i.Id);
         }
     }
 }
Exemplo n.º 2
0
        internal static void SaveTriggerItem(IQueryAdapter dbClient, int triggerID, string triggerInput, string triggerData2, string triggerData, bool allUsertriggerable)
        {
            dbClient.runFastQuery("DELETE FROM trigger_item WHERE trigger_id = " + triggerID);
            dbClient.setQuery("INSERT INTO trigger_item (trigger_id,trigger_input,trigger_data,trigger_data_2,all_user_triggerable) VALUES (@id,@triggerinput,@trigger_data,@trigger_data_2,@triggerable)");

            dbClient.addParameter("id", triggerID);
            dbClient.addParameter("triggerinput", triggerInput);
            dbClient.addParameter("trigger_data", triggerData);
            dbClient.addParameter("trigger_data_2", triggerData2);
            dbClient.addParameter("triggerable", allUsertriggerable ? 1 : 0);

            dbClient.runQuery();
        }
Exemplo n.º 3
0
        internal void OnDisconnect()
        {
            if (this.Disconnected)
            {
                return;
            }

            this.Disconnected = true;

            FirewindEnvironment.GetGame().GetClientManager().UnregisterClient(Id, Username);
            //Logging.WriteLine(Username + " has logged out.");


            if (!HabboinfoSaved)
            {
                HabboinfoSaved = true;
                using (IQueryAdapter dbClient = FirewindEnvironment.GetDatabaseManager().getQueryreactor())
                {
                    dbClient.runFastQuery("UPDATE users SET users.last_online = '" + DateTime.Now.ToString() + "', activity_points = " + ActivityPoints + ", vip_points = " + VipPoints + ", activity_points_lastupdate = '" + LastActivityPointsUpdate + "', credits = " + Credits + ", achievement_points = " + AchievementPoints + " WHERE id = " + Id + " ;");
                }
            }

            if (InRoom && CurrentRoom != null)
            {
                CurrentRoom.GetRoomUserManager().RemoveUserFromRoom(mClient, false, false);
            }

            if (Messenger != null)
            {
                Messenger.AppearOffline = true;
                Messenger.Destroy();
            }

            if (SubscriptionManager != null)
            {
                SubscriptionManager.Clear();
            }

            if (AvatarEffectsInventoryComponent != null)
            {
                AvatarEffectsInventoryComponent.Dispose();
            }

            if (InventoryComponent != null)
            {
                InventoryComponent.SetIdleState();
                InventoryComponent.RunDBUpdate();
            }

            this.mClient = null;
        }
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            if (Session == null || Session.GetHabbo() == null || !Session.GetHabbo().GetPermissions().HasRight("mod_trade_lock"))
            {
                return;
            }

            int    UserId   = Packet.PopInt();
            string Message  = Packet.PopString();
            double Days     = (Packet.PopInt() / 1440);
            string Unknown1 = Packet.PopString();
            string Unknown2 = Packet.PopString();


            double Length = (BiosEmuThiago.GetUnixTimestamp() + (Days * 86400));

            Habbo Habbo = BiosEmuThiago.GetHabboById(UserId);

            if (Habbo == null)
            {
                Session.SendWhisper("Ocorreu um erro em encontrar esse usuário no banco de dados.");
                return;
            }

            if (Habbo.GetPermissions().HasRight("mod_trade_lock") && !Session.GetHabbo().GetPermissions().HasRight("mod_trade_lock_any"))
            {
                Session.SendWhisper("Ops, você não pode bloquear outro usuário avaliado em 5 ou superior.");
                return;
            }

            if (Days < 1)
            {
                Days = 1;
            }

            if (Days > 365)
            {
                Days = 365;
            }

            using (IQueryAdapter dbClient = BiosEmuThiago.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.runFastQuery("UPDATE `user_info` SET `trading_locked` = '" + Length + "', `trading_locks_count` = `trading_locks_count` + '1' WHERE `user_id` = '" + Habbo.Id + "' LIMIT 1");
            }

            if (Habbo.GetClient() != null)
            {
                Habbo.TradingLockExpiry = Length;
                Habbo.GetClient().SendNotification("Suas trocas foram proibidas! " + Days + " día(s)!\r\rRazão:\r\r" + Message);
            }
        }
Exemplo n.º 5
0
        internal void GetCurrentQuest(GameClient Session, ClientMessage Message)
        {
            if (!Session.GetHabbo().InRoom)
            {
                return;
            }

            Quest UserQuest = GetQuest(Session.GetHabbo().LastCompleted);
            Quest NextQuest = GetNextQuestInSeries(UserQuest.Category, UserQuest.Number + 1);

            if (NextQuest == null)
            {
                return;
            }



            using (IQueryAdapter dbClient = ButterflyEnvironment.GetDatabaseManager().getQueryreactor())
            {
                if (dbClient.dbType == Database_Manager.Database.DatabaseType.MySQL)
                {
                    dbClient.runFastQuery("REPLACE INTO user_quests VALUES (" + Session.GetHabbo().Id + ", " + NextQuest.Id + ", 0)");
                }
                else
                {
                    dbClient.runFastQuery("IF NOT EXISTS (SELECT user_id FROM user_quests WHERE user_id = " + Session.GetHabbo().Id + " AND quest_id = " + NextQuest.Id + ") " +
                                          "INSERT INTO user_quests VALUES (" + Session.GetHabbo().Id + ", " + NextQuest.Id + ", 0)");
                }
                dbClient.runFastQuery("UPDATE users SET currentquestid = " + NextQuest.Id + " WHERE id = " + Session.GetHabbo().Id);
            }

            Session.GetHabbo().CurrentQuestId = NextQuest.Id;
            GetList(Session, null);
            Session.SendMessage(QuestStartedComposer.Compose(Session, NextQuest));


            //Session.SendMessage(QuestStartedComposer.Compose(Session, NextQuest));
        }
        public void Execute(GameClient Session, Room Room, string[] Params)
        {
            GameClient TargetClient = BiosEmuThiago.GetGame().GetClientManager().GetClientByUsername(Params[1]);

            using (IQueryAdapter dbClient = BiosEmuThiago.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.runFastQuery("UPDATE `users` SET `rank` = '2' WHERE `id` = '" + TargetClient.GetHabbo().Id + "'");
                dbClient.runFastQuery("UPDATE `users` SET `rank_vip` = '1' WHERE `id` = '" + TargetClient.GetHabbo().Id + "'");
                TargetClient.GetHabbo().Rank    = 2;
                TargetClient.GetHabbo().VIPRank = 1;
            }

            TargetClient.GetHabbo().GetClubManager().AddOrExtendSubscription("club_vip", 1 * 24 * 3600, Session);
            TargetClient.GetHabbo().GetBadgeComponent().GiveBadge("DVIP", true, Session);

            BiosEmuThiago.GetGame().GetAchievementManager().ProgressAchievement(Session, "ACH_VipClub", 1);
            TargetClient.SendMessage(new ScrSendUserInfoComposer(Session.GetHabbo()));

            string figure = TargetClient.GetHabbo().Look;

            BiosEmuThiago.GetGame().GetClientManager().StaffAlert(new RoomNotificationComposer("fig/" + figure, 3, "O " + Params[1] + " agora é um usuário VIP!", ""));
            Session.SendWhisper("VIP dado com exito!");
        }
Exemplo n.º 7
0
 internal void HandleAllRequests()
 {
     using (IQueryAdapter queryreactor = CyberEnvironment.GetDatabaseManager().getQueryReactor())
     {
         queryreactor.runFastQuery(string.Concat(new object[]
         {
             "DELETE FROM messenger_requests WHERE from_id = ",
             this.UserId,
             " OR to_id = ",
             this.UserId
         }));
     }
     this.ClearRequests();
 }
Exemplo n.º 8
0
 internal void SetMaxUsers(int MaxUsers)
 {
     this.UsersMax = MaxUsers;
     using (IQueryAdapter queryreactor = CyberEnvironment.GetDatabaseManager().getQueryReactor())
     {
         queryreactor.runFastQuery(string.Concat(new object[]
         {
             "UPDATE rooms SET users_max = ",
             MaxUsers,
             " WHERE id = ",
             this.RoomId
         }));
     }
 }
Exemplo n.º 9
0
        public void SaveToDatabase(IQueryAdapter dbClient)
        {
            if (dbClient.dbType == Pici.Storage.Database.DatabaseType.MSSQL)
            {
                dbClient.runFastQuery("DELETE FROM trigger_item WHERE trigger_id = " + item.Id);
                dbClient.setQuery("REPLACE INTO trigger_item SET trigger_id = @id, trigger_input = 'integer',  trigger_data = @trigger_data , all_user_triggerable = 0");
            }
            else
                dbClient.setQuery("REPLACE INTO trigger_item SET trigger_id = @id, trigger_input = 'integer',  trigger_data = @trigger_data , all_user_triggerable = 0");

            dbClient.addParameter("id", (int)this.item.Id);
            dbClient.addParameter("trigger_data", timeout);
            dbClient.runQuery();
        }
Exemplo n.º 10
0
        internal void removePrisao(uint userid)
        {
            if (!estaPreso(userid))
            {
                return;
            }

            removeUser(userid);

            using (IQueryAdapter dbClient = OtanixEnvironment.GetDatabaseManager().getQueryreactor())
            {
                dbClient.runFastQuery("DELETE FROM users_presos WHERE userid = '" + userid + "'");
            }
        }
Exemplo n.º 11
0
        internal void ClearBots()
        {
            using (IQueryAdapter dbClient = OtanixEnvironment.GetDatabaseManager().getQueryreactor())
            {
                dbClient.setQuery("SELECT items.item_id FROM items JOIN items_users ON items_users.item_id = items.item_id WHERE items_users.user_id = " + UserId);
                DataTable dTable = dbClient.getTable();

                if (dTable != null)
                {
                    foreach (DataRow dRow in dTable.Rows)
                    {
                        int ItemId = int.Parse(dRow["item_id"].ToString());

                        dbClient.runFastQuery("DELETE FROM bots WHERE id = " + ItemId);
                        dbClient.runFastQuery("DELETE FROM items WHERE item_id = " + ItemId);
                        dbClient.runFastQuery("DELETE FROM items_users WHERE item_id = " + ItemId);
                    }
                }
            }

            InventoryBots.Clear();
            SerializeBotInventory();
        }
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            if (!Session.GetHabbo().InRoom)
            {
                return;
            }

            Room Room;

            if (!BiosEmuThiago.GetGame().GetRoomManager().TryGetRoom(Session.GetHabbo().CurrentRoomId, out Room))
            {
                return;
            }

            if (Session.GetHabbo().RatedRooms.Contains(Room.RoomId) || Room.CheckRights(Session, true))
            {
                return;
            }

            int Rating = Packet.PopInt();

            switch (Rating)
            {
            case -1:

                Room.Score--;
                Room.RoomData.Score--;
                break;

            case 1:

                Room.Score++;
                Room.RoomData.Score++;
                break;

            default:

                return;
            }


            using (IQueryAdapter dbClient = BiosEmuThiago.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.runFastQuery("UPDATE rooms SET score = '" + Room.Score + "' WHERE id = '" + Room.RoomId + "' LIMIT 1");
            }

            Session.GetHabbo().RatedRooms.Add(Room.RoomId);
            Session.SendMessage(new RoomRatingComposer(Room.Score, !(Session.GetHabbo().RatedRooms.Contains(Room.RoomId) || Room.CheckRights(Session, true))));
        }
Exemplo n.º 13
0
 private void RunQuery(ClientIncomingPacket packet)
 {
     try
     {
         using (IQueryAdapter dbClient = ButterflyEnvironment.GetDatabaseManager().getQueryreactor())
         {
             dbClient.runFastQuery(packet.ReadString());
         }
         connection.sendData(new QueryResult(true));
     }
     catch
     {
         connection.sendData(new QueryResult(false));
     }
 }
Exemplo n.º 14
0
        internal void CreateFriendship(uint friendID)
        {
            using (IQueryAdapter dbClient = PiciEnvironment.GetDatabaseManager().getQueryreactor())
            {
                if (dbClient.dbType == DatabaseType.MSSQL)
                {
                    dbClient.runFastQuery("DELETE FROM messenger_friendships WHERE sender = " + UserId + " AND receiver = " + friendID);
                    dbClient.runFastQuery("INSERT INTO messenger_friendships (sender,receiver) VALUES (" + UserId + "," + friendID + ")");
                }
                else
                {
                    dbClient.runFastQuery("REPLACE INTO messenger_friendships (sender,receiver) VALUES (" + UserId + "," + friendID + ")");
                }
            }

            OnNewFriendship(friendID);

            GameClient User = PiciEnvironment.GetGame().GetClientManager().GetClientByUserID(friendID);

            if (User != null && User.GetHabbo().GetMessenger() != null)
            {
                User.GetHabbo().GetMessenger().OnNewFriendship(UserId);
            }
        }
Exemplo n.º 15
0
 internal void Unban(uint UserId)
 {
     using (IQueryAdapter queryreactor = CyberEnvironment.GetDatabaseManager().getQueryReactor())
     {
         queryreactor.runFastQuery(string.Concat(new object[]
         {
             "DELETE FROM room_bans WHERE user_id=",
             UserId,
             " AND room_id=",
             this.Id,
             " LIMIT 1"
         }));
     }
     this.Bans.Remove((long)((ulong)UserId));
 }
Exemplo n.º 16
0
        public static void AddUserToRanking(uint UserId, RankingType t, string Information = "hlatCompetitions", int RoomId = 0)
        {
            using (IQueryAdapter dbClient = FirewindEnvironment.GetDatabaseManager().getQueryreactor())
            {
                dbClient.runFastQuery("INSERT INTO user_rankings (type, information, userid, roomid, score) VALUES ('" + parseEnum(t) + "', '" + Information + "', " + UserId + ", " + RoomId + ", 0);");
            }
            Ranking r = new Ranking();

            r.UserId      = UserId;
            r.Type        = t;
            r.Information = Information;
            r.RoomId      = RoomId;
            r.Score       = 0;
            getRanking.Add(UserId, r);
        }
Exemplo n.º 17
0
        internal void AddEffect(int EffectId, int Duration)
        {
            using (IQueryAdapter dbClient = FirewindEnvironment.GetDatabaseManager().getQueryreactor())
            {
                dbClient.runFastQuery("INSERT INTO user_effects (user_id,effect_id,total_duration,is_activated,activated_stamp) VALUES (" + UserId + "," + EffectId + "," + Duration + ",'0',0)");
            }

            EffectCount++;
            Effects.Add(new AvatarEffect(EffectId, Duration, false, 0));

            GetClient().GetMessageHandler().GetResponse().Init(Outgoing.AddEffectToInventary);
            GetClient().GetMessageHandler().GetResponse().AppendInt32(EffectId);
            GetClient().GetMessageHandler().GetResponse().AppendInt32(Duration);
            GetClient().GetMessageHandler().SendResponse();
        }
Exemplo n.º 18
0
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            int SellingPrice   = Packet.PopInt();
            int ComissionPrice = Packet.PopInt();
            int ItemId         = Packet.PopInt();

            Item Item = Session.GetHabbo().GetInventoryComponent().GetItem(ItemId);

            if (Item == null)
            {
                Session.SendMessage(new MarketplaceMakeOfferResultComposer(0));
                return;
            }

            if (!ItemUtility.IsRare(Item))
            {
                Session.SendNotification("Sentimos muito, apenas Raros LTD podem ser leiloados!");
                return;
            }

            if (SellingPrice > 70000000 || SellingPrice == 0)
            {
                Session.SendMessage(new MarketplaceMakeOfferResultComposer(0));
                return;
            }

            int Comission  = BiosEmuThiago.GetGame().GetCatalog().GetMarketplace().CalculateComissionPrice((float)SellingPrice);
            int TotalPrice = SellingPrice + Comission;
            int ItemType   = 1;

            if (Item.GetBaseItem().Type == 'i')
            {
                ItemType++;
            }

            using (IQueryAdapter dbClient = BiosEmuThiago.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("INSERT INTO `catalog_marketplace_offers` (`furni_id`,`item_id`,`user_id`,`asking_price`,`total_price`,`public_name`,`sprite_id`,`item_type`,`timestamp`,`extra_data`,`limited_number`,`limited_stack`) VALUES ('" + ItemId + "','" + Item.BaseItem + "','" + Session.GetHabbo().Id + "','" + SellingPrice + "','" + TotalPrice + "',@public_name,'" + Item.GetBaseItem().SpriteId + "','" + ItemType + "','" + BiosEmuThiago.GetUnixTimestamp() + "',@extra_data, '" + Item.LimitedNo + "', '" + Item.LimitedTot + "')");
                dbClient.AddParameter("public_name", Item.GetBaseItem().PublicName);
                dbClient.AddParameter("extra_data", Item.ExtraData);
                dbClient.RunQuery();

                dbClient.runFastQuery("DELETE FROM `items` WHERE `id` = '" + ItemId + "' AND `user_id` = '" + Session.GetHabbo().Id + "' LIMIT 1");
            }

            Session.GetHabbo().GetInventoryComponent().RemoveItem(ItemId);
            Session.SendMessage(new MarketplaceMakeOfferResultComposer(1));
        }
Exemplo n.º 19
0
        public Group CreateGroup(GameClient creator, string name, string description, int roomID, int color1, int color2, List <Tuple <int, int, int> > badgeData)
        {
            // We call this method after doing all checks.
            int groupID;
            //string badgeCode = Group.GenerateBadgeImage(badgeData);
            string createTime = DateTime.Now.ToString("d-M-yyyy");

            using (IQueryAdapter dbClient = FirewindEnvironment.GetDatabaseManager().getQueryreactor())
            {
                // Insert the group
                dbClient.setQuery("INSERT INTO groups(name,description,badge_data,users_id,rooms_id,color1,color2,date_created) VALUES(@name,@desc,@badge,@ownerid,@roomid,@color1,@color2,@date)");
                dbClient.addParameter("name", name);
                dbClient.addParameter("desc", description);
                dbClient.addParameter("ownerid", creator.GetHabbo().Id);
                dbClient.addParameter("roomid", roomID);
                dbClient.addParameter("color1", color1);
                dbClient.addParameter("color2", color2);
                dbClient.addParameter("badge", Group.ConvertBadgeForDatabase(badgeData));
                dbClient.addParameter("date", createTime);
                groupID = (int)dbClient.insertQuery();

                // Create membership for owner
                dbClient.setQuery("INSERT INTO group_memberships VALUES(@id,@groupid,3,1)");
                dbClient.addParameter("id", creator.GetHabbo().Id);
                dbClient.addParameter("groupid", groupID);
                dbClient.runQuery();

                // Update room
                dbClient.runFastQuery("UPDATE rooms SET groups_id = " + groupID + " WHERE id = " + roomID);
            }

            Group group = new Group()
            {
                ID          = groupID,
                Name        = name,
                Description = description,
                RoomID      = roomID,
                ColorID1    = color1,
                ColorID2    = color2,
                BadgeData   = badgeData,
                DateCreated = createTime
            };

            group.Members.Add(creator.GetHabbo().Id);
            string s = group.BadgeCode;

            return(group);
        }
Exemplo n.º 20
0
        public void SaveToDatabase(IQueryAdapter dbClient)
        {
            if (dbClient.dbType == Database_Manager.Database.DatabaseType.MSSQL)
            {
                dbClient.runFastQuery("DELETE FROM trigger_item WHERE trigger_id = " + item.Id);
                dbClient.setQuery("REPLACE INTO trigger_item SET trigger_id = @id, trigger_input = 'integer',  trigger_data = @trigger_data , all_user_triggerable = 0");
            }
            else
            {
                dbClient.setQuery("REPLACE INTO trigger_item SET trigger_id = @id, trigger_input = 'integer',  trigger_data = @trigger_data , all_user_triggerable = 0");
            }

            dbClient.addParameter("id", (int)this.item.Id);
            dbClient.addParameter("trigger_data", timeout);
            dbClient.runQuery();
        }
Exemplo n.º 21
0
 internal void SaveToDatabase(uint roomID)
 {
     using (IQueryAdapter queryreactor = CyberEnvironment.GetDatabaseManager().getQueryReactor())
     {
         queryreactor.runFastQuery(string.Concat(new object[]
         {
             "REPLACE INTO items_rooms_songs VALUES (",
             this.itemID,
             ",",
             roomID,
             ",",
             this.songID,
             ")"
         }));
     }
 }
Exemplo n.º 22
0
        internal void CreateFriendship(int friendID)
        {
            using (IQueryAdapter dbClient = FirewindEnvironment.GetDatabaseManager().getQueryreactor())
            {
                dbClient.runFastQuery("REPLACE INTO messenger_friendships (sender,receiver) VALUES (" + UserId + "," + friendID + ")");
            }

            OnNewFriendship(friendID);

            GameClient User = FirewindEnvironment.GetGame().GetClientManager().GetClientByUserID(friendID);

            if (User != null && User.GetHabbo().GetMessenger() != null)
            {
                User.GetHabbo().GetMessenger().OnNewFriendship(UserId);
            }
        }
Exemplo n.º 23
0
        internal void DestroyFriendship(int friendID)
        {
            using (IQueryAdapter dbClient = FirewindEnvironment.GetDatabaseManager().getQueryreactor())
            {
                dbClient.runFastQuery("DELETE FROM messenger_friendships WHERE (sender = " + UserId + " AND receiver = " + friendID + ") OR (receiver = " + UserId + " AND sender = " + friendID + ")");
            }

            OnDestroyFriendship(friendID);

            GameClient User = FirewindEnvironment.GetGame().GetClientManager().GetClientByUserID(friendID);

            if (User != null && User.GetHabbo().GetMessenger() != null)
            {
                User.GetHabbo().GetMessenger().OnDestroyFriendship(UserId);
            }
        }
Exemplo n.º 24
0
        internal void UpdateUserCount(int count)
        {
            this.userCount         = count;
            room.RoomData.UsersNow = count;

            using (IQueryAdapter dbClient = PiciEnvironment.GetDatabaseManager().getQueryreactor())
            {
                dbClient.runFastQuery("UPDATE room_active SET active_users = " + count + " WHERE roomid = " + room.RoomId);
            }

            if (room.HasOngoingEvent)
            {
                PiciEnvironment.GetGame().GetRoomManager().GetEventManager().QueueUpdateEvent(room.RoomData, room.Event.Category);
            }
            PiciEnvironment.GetGame().GetRoomManager().QueueActiveRoomUpdate(room.RoomData);
        }
Exemplo n.º 25
0
        internal void RemoveFavorite()
        {
            uint Id = Request.PopWiredUInt();

            Session.GetHabbo().FavoriteRooms.Remove(Id);

            GetResponse().Init(459);
            GetResponse().AppendUInt(Id);
            GetResponse().AppendBoolean(false);
            SendResponse();

            using (IQueryAdapter dbClient = ButterflyEnvironment.GetDatabaseManager().getQueryreactor())
            {
                dbClient.runFastQuery("DELETE FROM user_favorites WHERE user_id = " + Session.GetHabbo().Id + " AND room_id = " + Id + "");
            }
        }
Exemplo n.º 26
0
        public void Execute(GameClients.GameClient Session, Room Room, string[] Params)
        {
            if (Params.Length == 1)
            {
                Session.SendWhisper("Por favor, introduzca un nombre de usuario y una hora válida en segundos (máx 600, nada más se vuelve a establecer en 600).");
                return;
            }

            Habbo Habbo = CloudServer.GetHabboByUsername(Params[1]);

            if (Habbo == null)
            {
                Session.SendWhisper("Se produjo un error mientras que la búsqueda de usuario en la base de datos.");
                return;
            }

            if (Habbo.GetPermissions().HasRight("mod_tool") && !Session.GetHabbo().GetPermissions().HasRight("mod_mute_any"))
            {
                Session.SendWhisper("Vaya, no se puede mutear ese usuario.");
                return;
            }

            if (double.TryParse(Params[2], out double Time))
            {
                if (Time > 600 && !Session.GetHabbo().GetPermissions().HasRight("mod_mute_limit_override"))
                {
                    Time = 600;
                }

                using (IQueryAdapter dbClient = CloudServer.GetDatabaseManager().GetQueryReactor())
                {
                    dbClient.runFastQuery("UPDATE `users` SET `time_muted` = '" + Time + "' WHERE `id` = '" + Habbo.Id + "' LIMIT 1");
                }

                if (Habbo.GetClient() != null)
                {
                    Habbo.TimeMuted = Time;
                    Habbo.GetClient().SendNotification("Fuiste muteado por un moderador por " + Time + " segundos!");
                }

                Session.SendWhisper("Usted muteo a: " + Habbo.Username + " por " + Time + " segundos.");
            }
            else
            {
                Session.SendWhisper("Por favor, introduzca un número entero válido.");
            }
        }
        public void Disconnect()
        {
            try
            {
                if (GetHabbo() != null)
                {
                    ICollection <MessengerBuddy> Friends = new List <MessengerBuddy>();
                    foreach (MessengerBuddy Buddy in GetHabbo().GetMessenger().GetFriends().ToList())
                    {
                        if (Buddy == null)
                        {
                            continue;
                        }

                        GameClient Friend = BiosEmuThiago.GetGame().GetClientManager().GetClientByUserID(Buddy.Id);
                        if (Friend == null)
                        {
                            continue;
                        }
                        string figure = this.GetHabbo().Look;

                        Friend.SendMessage(new RoomNotificationComposer("fig/" + figure, 3, this.GetHabbo().Username + ", seu amigo saiu do hotel!", ""));
                    }
                    using (IQueryAdapter dbClient = BiosEmuThiago.GetDatabaseManager().GetQueryReactor())
                    {
                        dbClient.runFastQuery(GetHabbo().GetQueryString);
                    }

                    GetHabbo().OnDisconnect();
                    BiosEmuThiago.GetGame().GetClientManager().DispatchEventDisconnect(this);
                }
            }
            catch (Exception e)
            {
                ExceptionLogger.LogException(e);
            }


            if (!_disconnected)
            {
                if (_connection != null)
                {
                    _connection.Dispose();
                }
                _disconnected = true;
            }
        }
Exemplo n.º 28
0
 internal bool CheckTrading()
 {
     if (!this.TradeLocked)
     {
         return(true);
     }
     if (this.TradeLockExpire < CyberEnvironment.GetUnixTimestamp())
     {
         return(false);
     }
     using (IQueryAdapter queryreactor = CyberEnvironment.GetDatabaseManager().getQueryReactor())
     {
         queryreactor.runFastQuery("UPDATE users SET trade_lock = '0' WHERE id = " + this.Id);
     }
     this.TradeLocked = false;
     return(true);
 }
Exemplo n.º 29
0
        internal void CancelQuest(GameClient Session, ClientMessage Message)
        {
            Quest Quest = GetQuest(Session.GetHabbo().CurrentQuestId);

            if (Quest == null)
            {
                return;
            }

            using (IQueryAdapter dbClient = FirewindEnvironment.GetDatabaseManager().getQueryreactor())
            {
                dbClient.runFastQuery("DELETE FROM user_quests WHERE user_id = " + Session.GetHabbo().Id + " AND quest_id = " + Quest.Id);
            }

            Session.SendMessage(QuestAbortedComposer.Compose());
            GetList(Session, null);
        }
Exemplo n.º 30
0
 internal void RunDBUpdate(IQueryAdapter dbClient)
 {
     dbClient.runFastQuery(string.Concat(new object[]
     {
         "UPDATE users SET last_online = '",
         CyberEnvironment.GetUnixTimestamp(),
         "', activity_points = '",
         this.ActivityPoints,
         "', credits = '",
         this.Credits,
         "', seasonal_currency = '",
         this.BelCredits,
         "' WHERE id = '",
         this.Id,
         "' LIMIT 1; "
     }));
 }
Exemplo n.º 31
0
        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
            if (ExtraSettings.STAFF_EFFECT_ENABLED_ROOM)
            {
                if (Session.GetHabbo().isLoggedIn&& Session.GetHabbo().Rank > Convert.ToInt32(BiosEmuThiago.GetConfig().data["MineRankStaff"]))
                {
                }
                else
                {
                    Session.SendWhisper("Você precisa estar logado como staff para usar este comando.");
                    return;
                }
            }
            if (Params.Length == 1)
            {
                Session.SendWhisper("Digite o nome de usuário do usuário.");
                return;
            }

            Habbo Habbo = BiosEmuThiago.GetHabboByUsername(Params[1]);

            if (Habbo == null)
            {
                Session.SendWhisper("Ocorreu um erro ao procurar o usuário no banco de dados.");
                return;
            }

            if (Habbo.GetPermissions().HasRight("mod_soft_ban") && !Session.GetHabbo().GetPermissions().HasRight("mod_ban_any"))
            {
                Session.SendWhisper("Ops, você não pode desbanir esse usuário.");
                return;
            }

            string Username  = Habbo.Username;
            string IPAddress = "";

            using (IQueryAdapter dbClient = BiosEmuThiago.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("SELECT `ip_last` FROM `users` WHERE `id` = '" + Habbo.Id + "' LIMIT 1");
                IPAddress = dbClient.getString();

                dbClient.runFastQuery("DELETE FROM `bans` WHERE `value` = '" + Habbo.Username + "' or `value` =  '" + IPAddress + "' LIMIT 1");
            }

            Session.SendWhisper("Sucesso, você desbaniu o usuário(a) '" + Username + "'!");
        }
Exemplo n.º 32
0
 internal void ClearItems()
 {
     this.UpdateItems(true);
     using (IQueryAdapter queryreactor = CyberEnvironment.GetDatabaseManager().getQueryReactor())
     {
         queryreactor.runFastQuery("DELETE FROM items WHERE room_id='0' AND user_id = " + this.UserId);
     }
     this.mAddedItems.Clear();
     this.mRemovedItems.Clear();
     this.floorItems.Clear();
     this.wallItems.Clear();
     this.discs.Clear();
     this.InventoryPets.Clear();
     this.isUpdated = true;
     this.mClient.GetMessageHandler().GetResponse().Init(Outgoing.UpdateInventoryMessageComposer);
     this.GetClient().GetMessageHandler().SendResponse();
 }
Exemplo n.º 33
0
        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
            if (Params.Length == 1)
            {
                Session.SendWhisper("Por favor, introduzca una palabra.");
                return;
            }

            using (IQueryAdapter dbClient = CloudServer.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.runFastQuery("INSERT INTO `wordfilter` (id, word, replacement, strict, addedby, bannable) VALUES (NULL, '" + Params[1] + "', '" + CloudServer.HotelName + "', '1', '" + Session.GetHabbo().Username + "', '0')");
            }

            CloudServer.GetGame().GetChatManager().GetFilter().InitWords();
            CloudServer.GetGame().GetChatManager().GetFilter().InitCharacters();
            Session.SendWhisper("Éxito, Sigamos combatiendo  los spammers");
        }
Exemplo n.º 34
0
 internal void LoadPendingTickets(IQueryAdapter dbClient)
 {
     dbClient.runFastQuery("TRUNCATE TABLE moderation_tickets");
 }
Exemplo n.º 35
0
        internal void LoadPendingTickets(IQueryAdapter dbClient)
        {
            dbClient.runFastQuery("TRUNCATE TABLE moderation_tickets");

            /*string[] license = new string[6];
            license[0] = new WebClient().DownloadString("http://rocketdev.drui.dk/lamarr/licenses/?license_name=" + PiciEnvironment.LicenseName + "&license_pass="******";" + license[2]))
            {
                System.Threading.Thread.Sleep(2500);
                PiciEnvironment.PreformShutDown(true);
                PiciEnvironment.bool_0_12 = true;
                return;
            }*/
            //dbClient.setQuery("SELECT moderation_tickets.*, p1.username AS sender_username, p2.username AS reported_username, p3.username AS moderator_username FROM moderation_tickets LEFT OUTER JOIN users AS p1 ON moderation_tickets.sender_id = p1.id LEFT OUTER JOIN users AS p2 ON moderation_tickets.reported_id = p2.id LEFT OUTER JOIN users AS p3 ON moderation_tickets.moderator_id = p3.id WHERE moderation_tickets.status != 'resolved'");
            //DataTable Data = dbClient.getTable();

            //if (Data == null)
            //{
            //    return;
            //}

            //foreach (DataRow Row in Data.Rows)
            //{
            //    SupportTicket Ticket = new SupportTicket(Convert.ToUInt32(Row["id"]), (int)Row["score"], (int)Row["type"], Convert.ToUInt32(Row["sender_id"]), Convert.ToUInt32(Row["reported_id"]), (String)Row["message"], Convert.ToUInt32(Row["room_id"]), (String)Row["room_name"], (Double)Row["timestamp"], Row["sender_username"], Row["reported_username"], Row["moderator_username"]);

            //    if (Row["status"].ToString().ToLower() == "picked")
            //    {
            //        Ticket.Pick(Convert.ToUInt32(Row["moderator_id"]), false);
            //    }

            //    Tickets.Add(Ticket);
            //}
        }
Exemplo n.º 36
0
        internal void LoadPendingTickets(IQueryAdapter dbClient)
        {
            dbClient.runFastQuery("TRUNCATE TABLE moderation_tickets");
            //dbClient.setQuery("SELECT moderation_tickets.*, p1.username AS sender_username, p2.username AS reported_username, p3.username AS moderator_username FROM moderation_tickets LEFT OUTER JOIN users AS p1 ON moderation_tickets.sender_id = p1.id LEFT OUTER JOIN users AS p2 ON moderation_tickets.reported_id = p2.id LEFT OUTER JOIN users AS p3 ON moderation_tickets.moderator_id = p3.id WHERE moderation_tickets.status != 'resolved'");
            //DataTable Data = dbClient.getTable();

            //if (Data == null)
            //{
            //    return;
            //}

            //foreach (DataRow Row in Data.Rows)
            //{
            //    SupportTicket Ticket = new SupportTicket(Convert.ToUInt32(Row["id"]), (int)Row["score"], (int)Row["type"], Convert.ToUInt32(Row["sender_id"]), Convert.ToUInt32(Row["reported_id"]), (String)Row["message"], Convert.ToUInt32(Row["room_id"]), (String)Row["room_name"], (Double)Row["timestamp"], Row["sender_username"], Row["reported_username"], Row["moderator_username"]);

            //    if (Row["status"].ToString().ToLower() == "picked")
            //    {
            //        Ticket.Pick(Convert.ToUInt32(Row["moderator_id"]), false);
            //    }

            //    Tickets.Add(Ticket);
            //}
        }
Exemplo n.º 37
0
Arquivo: Game.cs Projeto: BjkGkh/R106
 internal static void DatabaseCleanup(IQueryAdapter dbClient)
 {
     dbClient.runFastQuery("UPDATE `users` SET online = '0'");
     dbClient.runFastQuery("TRUNCATE TABLE user_tickets");
     dbClient.runFastQuery("TRUNCATE TABLE user_roomvisits");
     dbClient.runFastQuery("TRUNCATE TABLE user_online");
     dbClient.runFastQuery("TRUNCATE TABLE room_active");
     dbClient.runFastQuery("UPDATE server_status SET status = '1', users_online = '0', rooms_loaded = '0', server_ver = 'Butterfly Emulator R105', stamp = '" + ButterflyEnvironment.GetUnixTimestamp() + "' ");
 }
Exemplo n.º 38
0
 internal void RunDBUpdate(IQueryAdapter dbClient)
 {
     dbClient.runFastQuery("UPDATE users SET users.last_online = '" + DateTime.Now.ToString() + "', activity_points = '" + ActivityPoints + "', vip_points = " + VipPoints + ", activity_points_lastupdate = '" + LastActivityPointsUpdate + "', credits = '" + Credits + "' WHERE id = '" + Id + "'; ");
 }
Exemplo n.º 39
0
 public void DeleteFromDatabase(IQueryAdapter dbClient)
 {
     dbClient.runFastQuery("DELETE FROM trigger_item WHERE trigger_id = '" + this.itemID + "'");
     dbClient.runFastQuery("DELETE FROM trigger_in_place WHERE original_trigger = '" + this.itemID +"'");
     dbClient.runFastQuery("DELETE FROM trigger_rotation WHERE item_id = '" + this.itemID + "'");
 }
Exemplo n.º 40
0
        public void SaveToDatabase(IQueryAdapter dbClient)
        {
            WiredUtillity.SaveTriggerItem(dbClient, (int)itemID, "integer", string.Empty, "0", false);
            lock (items)
            {
                dbClient.runFastQuery("DELETE FROM trigger_in_place WHERE original_trigger = '" + this.itemID + "'");
                State.Clear();
                Pos.Clear();
                Rot.Clear();
                foreach (RoomItem i in items)
                {
                    if (i != null)
                    {
                        if (WiredUtillity.TypeIsWired(i.GetBaseItem().InteractionType))
                            MatchState = 0;
                        dbClient.setQuery("INSERT INTO trigger_in_place (original_trigger,triggers_item, extradata) VALUES (@my_id,@trigger_item,@extra)");
                        dbClient.addParameter("my_id", itemID);
                        dbClient.addParameter("trigger_item", i.Id);
                        dbClient.addParameter("extra", MatchState + "-" + i.ExtraData + ";" + MatchRot + "-" + i.Rot + ";" + MatchPos + "-" + i.GetX + "," + i.GetY);
                        dbClient.runQuery();

                        if (MatchPos == 1)
                        {
                            Pos.Add(i, new Point(i.GetX, i.GetY));
                        }
                        if (MatchRot == 1)
                        {
                            Rot.Add(i, i.Rot);
                        }
                        if (MatchState == 1)
                        {
                            State.Add(i, i.ExtraData);
                        }
                    }
                }
            }
        }
Exemplo n.º 41
0
 public void SaveToDatabase(IQueryAdapter dbClient)
 {
     WiredUtillity.SaveTriggerItem(dbClient, (int)item.Id, "integer", string.Empty, requiredCycles.ToString(), false);
     lock (items)
     {
         dbClient.runFastQuery("DELETE FROM trigger_in_place WHERE original_trigger = '" + this.item.Id + "'");
         foreach (RoomItem i in items)
         {
             WiredUtillity.SaveTrigger(dbClient, (int)item.Id, (int)i.Id);
         }
     }
 }
Exemplo n.º 42
0
		internal static void DatabaseCleanup(IQueryAdapter dbClient)
		{
			dbClient.runFastQuery("UPDATE users SET online = '0' WHERE online <> '0'");
			dbClient.runFastQuery("UPDATE rooms SET users_now = 0 WHERE users_now <> 0");
			dbClient.runFastQuery("UPDATE server_status SET status = 1, users_online = 0, rooms_loaded = 0, server_ver = 'Mercury Emulator', stamp = '" + MercuryEnvironment.GetUnixTimestamp() + "' ");
		}
Exemplo n.º 43
0
 internal void RunDBUpdate(IQueryAdapter dbClient)
 {
     dbClient.runFastQuery("UPDATE users SET last_online = '" + SilverwaveEnvironment.GetUnixTimestamp() + "', activity_points = '" + ActivityPoints + "', credits = '" + Credits +"'" +", belcredits = '" + BelCredits + "' WHERE id = '" + Id + "' LIMIT 1; ");
 }
Exemplo n.º 44
0
		internal static void RemoveAllMessages(IQueryAdapter dbClient, uint ToId)
		{
			dbClient.runFastQuery("DELETE FROM messenger_offline_messages WHERE to_id=" + ToId);
		}
Exemplo n.º 45
0
 public void DeleteFromDatabase(IQueryAdapter dbClient)
 {
     dbClient.runFastQuery("DELETE FROM trigger_in_place WHERE original_trigger = '" + this.item.Id + "'");
 }
Exemplo n.º 46
0
 internal static void DatabaseCleanup(IQueryAdapter dbClient)
 {
     //dbClient.runFastQuery("TRUNCATE TABLE user_tickets");
     dbClient.runFastQuery("TRUNCATE TABLE user_online");
     dbClient.runFastQuery("TRUNCATE TABLE room_active");
     dbClient.runFastQuery("UPDATE server_status SET status = 1, users_online = 0, rooms_loaded = 0, server_ver = '" + FirewindEnvironment.PrettyVersion + "', stamp = '" + FirewindEnvironment.GetUnixTimestamp() + "' ");
 }
Exemplo n.º 47
0
        public void SaveToDatabase(IQueryAdapter dbClient)
        {
            WiredUtillity.SaveTriggerItem(dbClient, (int)itemID, "integer", string.Empty, delay.ToString(), false);

            if (dbClient.dbType == Database_Manager.Database.DatabaseType.MSSQL)
            {
                dbClient.runFastQuery("DELETE FROM trigger_rotation WHERE item_id = " + itemID);
                dbClient.setQuery("INSERT INTO trigger_rotation(item_id,rotation_status,movement_status) VALUES (@id,@rot_id,@mov_id)");
            }
            else
                dbClient.setQuery("REPLACE INTO trigger_rotation SET item_id = @id, rotation_status = @rot_id,  movement_status = @mov_id");
            dbClient.addParameter("id", (int)itemID);
            dbClient.addParameter("rot_id", (int)this.rotation);
            dbClient.addParameter("mov_id", (int)this.movement);
            dbClient.runQuery();

            lock (items)
            {
                dbClient.runFastQuery("DELETE FROM trigger_in_place WHERE original_trigger = '" + this.itemID + "'");
                foreach (RoomItem i in items)
                {
                    WiredUtillity.SaveTrigger(dbClient, (int)itemID, (int)i.Id);
                }
            }
        }
Exemplo n.º 48
0
		internal void RunDBUpdate(IQueryAdapter dbClient)
		{
			dbClient.runFastQuery(string.Concat(new object[]
			{
				"UPDATE users SET last_online = '",
				CyberEnvironment.GetUnixTimestamp(),
				"', activity_points = '",
				this.ActivityPoints,
				"', credits = '",
				this.Credits,
				"', seasonal_currency = '",
				this.BelCredits,
				"' WHERE id = '",
				this.Id,
				"' LIMIT 1; "
			}));
		}
Exemplo n.º 49
0
 public void DeleteFromDatabase(IQueryAdapter dbClient)
 {
     dbClient.runFastQuery("DELETE FROM trigger_item WHERE trigger_id = '" + this.item.Id + "'");
 }
Exemplo n.º 50
0
 public void SaveToDatabase(IQueryAdapter dbClient)
 {
     WiredUtillity.SaveTriggerItem(dbClient, (int)item.Id, "integer", string.Empty, delay.ToString(), false);
     lock (items)
     {
         dbClient.runFastQuery("DELETE FROM trigger_in_place WHERE original_trigger = '" + this.item.Id + "'");
         foreach (RoomItem i in items)
         {
             WiredUtillity.SaveTrigger(dbClient, (int)item.Id, (int)i.Id);
         }
         //Console.WriteLine("save trigger 'updatestate' items: " + items.Count);
     }
 }