Ejemplo n.º 1
0
        internal void Destroy()
        {
            IEnumerable <GameClient> onlineUsers = FirewindEnvironment.GetGame().GetClientManager().GetClientsById(friends.Keys);

            foreach (GameClient client in onlineUsers)
            {
                if (client.GetHabbo() == null || client.GetHabbo().GetMessenger() == null)
                {
                    continue;
                }

                client.GetHabbo().GetMessenger().UpdateFriend(this.UserId, null, true);
            }
        }
Ejemplo n.º 2
0
        internal void OnCycle_RoomDedicatedThread()
        {
            while (FirewindEnvironment.GetGame().gameLoopActive_EXT)
            {
                try
                {
                    if (FirewindEnvironment.GetGame().gameLoopEnabled_EXT == true)
                    {
                        FirewindEnvironment.GetGame().RoomManagerCycle_ended = false;
                        DateTime startTaskTime;
                        TimeSpan spentTime;
                        startTaskTime = DateTime.Now;
                        WorkRoomDataQueue();
                        WorkRoomsToAddQueue();
                        WorkRoomsToRemoveQueue();

                        RoomCycleTask();
                        RemoveTask();     // Queries
                        bool activeRoomsAdded   = WorkActiveRoomsAddQueue();
                        bool activeRoomsRemoved = WorkActiveRoomsRemoveQueue();
                        bool activeRoomsUpdated = WorkActiveRoomsUpdateQueue();

                        if (activeRoomsAdded || activeRoomsRemoved || activeRoomsUpdated)
                        {
                            SortActiveRooms();
                        }

                        bool votedRoomsAdded   = WorkVotedRoomsAddQueue();
                        bool votedRoomsRemoved = WorkVotedRoomsRemoveQueue();

                        if (votedRoomsAdded || votedRoomsRemoved)
                        {
                            SortVotedRooms();
                        }

                        eventManager.onCycle();
                        spentTime = DateTime.Now - startTaskTime;

                        if (spentTime.TotalSeconds > 3)
                        {
                            Logging.WriteLine("RoomManager.OnCycle spent: " + spentTime.TotalSeconds + " seconds in working.");
                        }

                        FirewindEnvironment.GetGame().RoomManagerCycle_ended = true;
                    }
                    Thread.Sleep(FirewindEnvironment.GetGame().gameLoopSleepTime_EXT);
                }
                catch (Exception e) { Logging.LogThreadException(e.ToString(), "RoomManager.OnCycle Exception."); }
            }
        }
Ejemplo n.º 3
0
        internal void ModGetRoomChatlog()
        {
            if (!Session.GetHabbo().HasFuse("fuse_chatlogs"))
            {
                return;
            }

            int  Junk   = Request.ReadInt32();
            uint RoomId = Request.ReadUInt32();

            if (FirewindEnvironment.GetGame().GetRoomManager().GetRoom(RoomId) != null)
            {
                Session.SendMessage(ModerationTool.SerializeRoomChatlog(RoomId));
            }
        }
Ejemplo n.º 4
0
        internal void OnStatusChanged(bool notification)
        {
            IEnumerable <GameClient> onlineUsers = FirewindEnvironment.GetGame().GetClientManager().GetClientsById(friends.Keys);

            foreach (GameClient client in onlineUsers)
            {
                if (client == null || client.GetHabbo() == null || client.GetHabbo().GetMessenger() == null)
                {
                    continue;
                }

                client.GetHabbo().GetMessenger().UpdateFriend(this.UserId, client, true);
                UpdateFriend(client.GetHabbo().Id, client, notification);
            }
        }
Ejemplo n.º 5
0
        internal void PurchaseFromCatalogAsGift()       // (k:int, k:int, k:String, k:String, k:String, k:int, k:int, k:int, k:Boolean)
        {
            int    PageId       = Request.ReadInt32();  // pageId
            uint   ItemId       = Request.ReadUInt32(); // offerId
            string ExtraData    = Request.ReadString(); // extraParameter
            string GiftUser     = FirewindEnvironment.FilterInjectionChars(Request.ReadString());
            string GiftMessage  = FirewindEnvironment.FilterInjectionChars(Request.ReadString());
            int    SpriteId     = Request.ReadInt32();
            int    Lazo         = Request.ReadInt32();
            int    Color        = Request.ReadInt32();
            bool   showIdentity = Request.ReadBoolean();

            //bool dnow = Request.PopWiredBoolean();
            //Logging.WriteLine("PageId: " + PageId + "; ItemId: " + ItemId + "; ExtraData: " + ExtraData + "; User: "******"; Message: " + GiftMessage + "; SpriteId: " + SpriteId + "; Color: " + Color + "; Lazo: " + Lazo);
            FirewindEnvironment.GetGame().GetCatalog().HandlePurchase(Session, PageId, ItemId, ExtraData, 1, true, GiftUser, GiftMessage, SpriteId, Lazo, Color, showIdentity);
        }
Ejemplo n.º 6
0
        internal void CanGift()
        {
            uint Id = Request.ReadUInt32();

            CatalogItem Item = FirewindEnvironment.GetGame().GetCatalog().FindItem(Id);

            if (Item == null)
            {
                return;
            }

            /*GetResponse().Init(622);
             * GetResponse().AppendUInt(Item.Id);
             * GetResponse().AppendBoolean(Item.GetBaseItem().AllowGift);
             * SendResponse();*/
        }
Ejemplo n.º 7
0
        internal void ModReleaseTicket()
        {
            if (!Session.GetHabbo().HasFuse("fuse_mod"))
            {
                return;
            }

            int amount = Request.ReadInt32();

            for (int i = 0; i < amount; i++)
            {
                uint TicketId = Request.ReadUInt32();

                FirewindEnvironment.GetGame().GetModerationTool().ReleaseTicket(Session, TicketId);
            }
        }
Ejemplo n.º 8
0
        private ServerMessage SerializeActiveRooms(int category)
        {
            //Logging.WriteLine("get pages for category: " + category);
            ServerMessage reply = new ServerMessage(Outgoing.NavigatorPacket);

            reply.AppendInt32(1);
            reply.AppendString(category.ToString());

            KeyValuePair <RoomData, int>[] rooms = FirewindEnvironment.GetGame().GetRoomManager().GetActiveRooms();
            SerializeNavigatorPopularRooms(ref reply, rooms, category);

            Array.Clear(rooms, 0, rooms.Length);
            rooms = null;

            return(reply);
        }
Ejemplo n.º 9
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);
            }
        }
Ejemplo n.º 10
0
        internal void UpdateUserCount(int count)
        {
            this.userCount         = count;
            room.RoomData.UsersNow = count;

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

            if (room.HasOngoingEvent)
            {
                FirewindEnvironment.GetGame().GetRoomManager().GetEventManager().QueueUpdateEvent(room.RoomData, room.Event.Category);
            }
            FirewindEnvironment.GetGame().GetRoomManager().QueueActiveRoomUpdate(room.RoomData);
        }
Ejemplo n.º 11
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);
            }
        }
Ejemplo n.º 12
0
        // ID: 1811
        public void ManageGroup()
        {
            int groupID = Request.ReadInt32();

            Group group = FirewindEnvironment.GetGame().GetGroupManager().GetGroup(groupID);

            if (group == null || group.GetMemberType(Session.GetHabbo().Id) < 3)
            {
                return;
            }

            List <RoomData> availableRooms = Session.GetHabbo().UsersRooms.FindAll(s => s.GroupID == 0);

            Response.Init(Outgoing.GuildEditInfo);

            Response.AppendInt32(availableRooms.Count);
            foreach (RoomData data in availableRooms)
            {
                Response.AppendInt32((int)data.Id);
                Response.AppendString(data.Name);
                Response.AppendBoolean(false);                              // WTF IS THIS SHIT WTF
            }
            Response.AppendBoolean(group.OwnerID == Session.GetHabbo().Id); // is owner?
            Response.AppendInt32(group.ID);
            Response.AppendString(group.Name);
            Response.AppendString(group.Description);
            Response.AppendInt32(group.RoomID); // roomId
            Response.AppendInt32(group.ColorID1);
            Response.AppendInt32(group.ColorID2);
            Response.AppendInt32(group.Type); // type
            Response.AppendInt32(Convert.ToInt32(group.AdminDecorate));
            Response.AppendBoolean(false);    // locked
            Response.AppendString("");        // url

            Response.AppendInt32(group.BadgeData.Count);
            foreach (var part in group.BadgeData)
            {
                Response.AppendInt32(part.Item1);
                Response.AppendInt32(part.Item2);
                Response.AppendInt32(part.Item3);
            }

            Response.AppendString(group.BadgeCode);    // badgeCode
            Response.AppendInt32(group.Members.Count); // totalMembers

            SendResponse();
        }
Ejemplo n.º 13
0
        internal void LoadProfile()
        {
            int  userID = Request.ReadInt32();
            bool unused = Request.ReadBoolean(); // Always true

            Habbo Data;

            Data = userID == Session.GetHabbo().Id ? Session.GetHabbo() : FirewindEnvironment.getHabboForId(userID);
            if (Data == null)
            {
                return;
            }

            // Get the info we need
            List <Group> groups   = FirewindEnvironment.GetGame().GetGroupManager().GetMemberships(userID);
            bool         isOnline = FirewindEnvironment.GetGame().GetClientManager().GetClientByUserID(userID) != null;

            Response.Init(Outgoing.ProfileInformation);

            Response.AppendInt32(Data.Id);
            Response.AppendString(Data.Username);
            Response.AppendString(Data.Look);
            Response.AppendString(Data.Motto);
            Response.AppendString("12/12/12");                                                                                     // created
            Response.AppendInt32(Data.AchievementPoints);                                                                          // Achievement Points
            Response.AppendInt32(Data.GetMessenger().myFriends);                                                                   //friends

            Response.AppendBoolean(userID != Session.GetHabbo().Id&& Data.GetMessenger().FriendshipExists(Session.GetHabbo().Id)); // is friend
            Response.AppendBoolean(Data.GetMessenger().requests.ContainsKey(Session.GetHabbo().Id));                               // firend request sent
            Response.AppendBoolean(isOnline);                                                                                      // is online

            Response.AppendInt32(groups.Count);                                                                                    // group count
            foreach (Group group in groups)
            {
                Response.AppendInt32(group.ID);
                Response.AppendString(group.Name);
                Response.AppendString(group.BadgeCode);
                Response.AppendString(group.Color1);
                Response.AppendString(group.Color2);
                Response.AppendBoolean(Data.FavouriteGroup == group.ID);
            }

            Response.AppendInt32(-1);     // last online
            Response.AppendBoolean(true); // show it

            SendResponse();
        }
Ejemplo n.º 14
0
        internal void PickUpPet()
        {
            Room Room = FirewindEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId);

            if (Session == null || Session.GetHabbo() == null || Session.GetHabbo().GetInventoryComponent() == null)
            {
                return;
            }

            if (Room == null || (!Room.AllowPets && !Room.CheckRights(Session, true)))
            {
                return;
            }

            uint     PetId   = Request.ReadUInt32();
            RoomUser PetUser = Room.GetRoomUserManager().GetPet(PetId);

            if (PetUser == null)
            {
                return;
            }

            if (PetUser.isMounted == true)
            {
                RoomUser usuarioVinculado = Room.GetRoomUserManager().GetRoomUserByVirtualId(Convert.ToInt32(PetUser.mountID));
                if (usuarioVinculado != null)
                {
                    usuarioVinculado.isMounted = false;
                    usuarioVinculado.ApplyEffect(-1);
                    usuarioVinculado.MoveTo(new Point(usuarioVinculado.X + 1, usuarioVinculado.Y + 1));
                }
            }

            if (PetUser.PetData.DBState != DatabaseUpdateState.NeedsInsert)
            {
                PetUser.PetData.DBState = DatabaseUpdateState.NeedsUpdate;
            }
            PetUser.PetData.RoomId = 0;

            Session.GetHabbo().GetInventoryComponent().AddPet(PetUser.PetData);

            using (IQueryAdapter dbClient = FirewindEnvironment.GetDatabaseManager().getQueryreactor())
                Room.GetRoomUserManager().SavePets(dbClient);

            Room.GetRoomUserManager().RemoveBot(PetUser.VirtualId, false);
            Session.SendMessage(Session.GetHabbo().GetInventoryComponent().SerializePetInventory());
        }
Ejemplo n.º 15
0
        internal void Searialize(ServerMessage reply)
        {
            reply.AppendInt32(userID);
            reply.AppendString(username);
            reply.AppendString(motto);

            bool Online = (FirewindEnvironment.GetGame().GetClientManager().GetClientByUserID(userID) != null);

            reply.AppendBoolean(Online);

            reply.AppendBoolean(false);

            reply.AppendString(string.Empty);
            reply.AppendInt32(0);
            reply.AppendString(look);
            reply.AppendString(last_online);
        }
Ejemplo n.º 16
0
 internal void GoToHotelView()
 {
     Firewind.HabboHotel.Users.Habbo targetHabbo = Session.GetHabbo();
     if (targetHabbo == null)
     {
         return;
     }
     if (Session.GetHabbo().InRoom)
     {
         Room currentRoom = FirewindEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId);
         if (currentRoom != null)
         {
             currentRoom.GetRoomUserManager().RemoveUserFromRoom(Session, true, false);
         }
         Session.CurrentRoomUserID = -1;
     }
 }
Ejemplo n.º 17
0
        public Gamemap(Room room)
        {
            this.room            = room;
            this.DiagonalEnabled = true;
            this.mStaticModel    = FirewindEnvironment.GetGame().GetRoomManager().GetModel(room.ModelName, room.RoomId);
            if (mStaticModel == null)
            {
                throw new Exception("No modeldata found for roomID " + room.RoomId);
            }
            this.mDynamicModel = new DynamicRoomModel(this.mStaticModel);

            this.mCoordinatedItems = new Hashtable();

            this.mGameMap       = new byte[Model.MapSizeX, Model.MapSizeY];
            this.mItemHeightMap = new double[Model.MapSizeX, Model.MapSizeY];
            userMap             = new Hashtable();
        }
Ejemplo n.º 18
0
        internal bool HasFuse(string Fuse)
        {
            if (FirewindEnvironment.GetGame().GetRoleManager().RankHasRight(Rank, Fuse))
            {
                return(true);
            }

            foreach (string SubscriptionId in GetSubscriptionManager().SubList)
            {
                if (FirewindEnvironment.GetGame().GetRoleManager().SubHasRight(SubscriptionId, Fuse))
                {
                    return(true);
                }
            }

            return(false);
        }
Ejemplo n.º 19
0
        internal void PickUpPet()
        {
            Room Room = FirewindEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId);

            if (Session == null || Session.GetHabbo() == null || Session.GetHabbo().GetInventoryComponent() == null)
            {
                return;
            }

            if (Room == null || (!Room.AllowPets && !Room.CheckRights(Session, true)))
            {
                return;
            }

            uint   PetId = Request.ReadUInt32();
            PetBot pet   = Room.GetRoomUserManager().GetPet(PetId);

            if (pet == null)
            {
                return;
            }

            //if (pet.isMounted == true)
            //{
            //    RoomUser usuarioVinculado = Room.GetRoomUserManager().GetRoomUserByVirtualId(Convert.ToInt32(pet.mountID));
            //    if (usuarioVinculado != null)
            //    {
            //        usuarioVinculado.isMounted = false;
            //        usuarioVinculado.ApplyEffect(-1);
            //        usuarioVinculado.MoveTo(new Point(usuarioVinculado.X + 1, usuarioVinculado.Y + 1));
            //    }
            //}

            if (pet.PetData.DBState != DatabaseUpdateState.NeedsInsert)
            {
                pet.PetData.DBState = DatabaseUpdateState.NeedsUpdate;
            }
            pet.PetData.RoomId = 0;

            Session.GetHabbo().GetInventoryComponent().AddPet(pet.PetData);
            Session.GetHabbo().GetInventoryComponent().RunDBUpdate();

            Room.GetRoomUserManager().RemoveRoomUnit(pet);
            Session.SendMessage(Session.GetHabbo().GetInventoryComponent().SerializePetInventory());
        }
Ejemplo n.º 20
0
        internal void SendGroupList()
        {
            List <Group>  groups  = FirewindEnvironment.GetGame().GetGroupManager().GetGroups(this.Groups);
            ServerMessage message = new ServerMessage(Outgoing.OwnGuilds);

            message.AppendInt32(groups.Count); // count
            foreach (Group group in groups)
            {
                message.AppendInt32(group.ID);         // groupId
                message.AppendString(group.Name);      // groupName
                message.AppendString(group.BadgeCode); // badge
                message.AppendString(group.Color1);    // color 1
                message.AppendString(group.Color2);    // color 2
                message.AppendBoolean(true);           // favourite
            }

            GetClient().SendMessage(message);
        }
Ejemplo n.º 21
0
        internal SupportTicket(UInt32 Id, int Score, int Type, UInt32 SenderId, UInt32 ReportedId, String Message, UInt32 RoomId, String RoomName, Double Timestamp)
        {
            this.Id          = Id;
            this.Score       = Score;
            this.Type        = Type;
            this.Status      = TicketStatus.OPEN;
            this.SenderId    = SenderId;
            this.ReportedId  = ReportedId;
            this.ModeratorId = 0;
            this.Message     = Message;
            this.RoomId      = RoomId;
            this.RoomName    = RoomName;
            this.Timestamp   = Timestamp;

            this.SenderName   = FirewindEnvironment.GetGame().GetClientManager().GetNameById(SenderId);
            this.ReportedName = FirewindEnvironment.GetGame().GetClientManager().GetNameById(ReportedId);
            this.ModName      = FirewindEnvironment.GetGame().GetClientManager().GetNameById(ModeratorId);
        }
Ejemplo n.º 22
0
        internal void GetPubs()
        {
            Session.SendMessage(FirewindEnvironment.GetGame().GetNavigator().SerializePublicRooms());

            uint HR = Session.GetHabbo().HomeRoom;

            /*if (HR > 0)
             * {
             *  Room Room = FirewindEnvironment.GetGame().GetRoomManager().GetRoom(HR);
             *
             *  if (Room != null)
             *  {
             *      this.PrepareRoomForUser(Room.RoomId, Room.Password);
             *      this.GetRoomData2();
             *      this.GetRoomData3();
             *  }
             * }*/
        }
Ejemplo n.º 23
0
        internal void GetCreditsInfo()
        {
            if (FirewindEnvironment.GetGame().GetClientManager().pixelsOnLogin > 0)
            {
                PixelManager.GivePixels(Session, FirewindEnvironment.GetGame().GetClientManager().pixelsOnLogin);
            }
            else
            {
                Session.GetHabbo().UpdateActivityPointsBalance(false);
            }

            if (FirewindEnvironment.GetGame().GetClientManager().creditsOnLogin > 0)
            {
                Session.GetHabbo().Credits += FirewindEnvironment.GetGame().GetClientManager().creditsOnLogin;
            }

            Session.GetHabbo().UpdateCreditsBalance();
        }
Ejemplo n.º 24
0
 internal void CloseConnection(int p)
 {
     try
     {
         Object info = liveConnections[p];
         if (info != null)
         {
             ConnectionInformation con = (ConnectionInformation)info;
             con.Dispose();
             FirewindEnvironment.GetGame().GetClientManager().DisposeConnection((uint)p);
         }
     }
     catch (Exception e)
     {
         Logging.LogException(e.ToString());
         //Logging.WriteLine(e.ToString());
     }
 }
Ejemplo n.º 25
0
        private void Handle()
        {
            for (uint i = 99264; i < roomsToLoad; i++)
            {
                try
                {
                    FirewindEnvironment.GetGame().GetRoomManager().LoadRoom(i);
                }
                catch (Exception e)
                {
                    Logging.WriteLine(e.ToString());
                }
            }
            Logging.WriteLine(roomsToLoad + " rooms loaded");

            Thread.Sleep(13000);
            Handle();
        }
Ejemplo n.º 26
0
        internal ServerMessage SerializeEventListing(int Category)
        {
            ServerMessage Message = new ServerMessage(451);

            Message.AppendInt32(Category);
            Message.AppendInt32(12);
            Message.AppendString("");

            KeyValuePair <RoomData, int>[] eventRooms = FirewindEnvironment.GetGame().GetRoomManager().GetEventRoomsForCategory(Category);
            Message.AppendInt32(eventRooms.Length);

            foreach (KeyValuePair <RoomData, int> pair in eventRooms)
            {
                pair.Key.Serialize(Message, true);
            }

            return(Message);
        }
Ejemplo n.º 27
0
        internal void SendGroupList()
        {
            List <Group>  groups  = FirewindEnvironment.GetGame().GetGroupManager().GetMemberships(Id);
            ServerMessage message = new ServerMessage(Outgoing.HabboGroupsWhereMember);

            message.AppendInt32(groups.Count); // count
            foreach (Group group in groups)
            {
                message.AppendInt32(group.ID);                     // groupId
                message.AppendString(group.Name);                  // groupName
                message.AppendString(group.BadgeCode);             // badge
                message.AppendString(group.Color1);                // color 1
                message.AppendString(group.Color2);                // color 2
                message.AppendBoolean(group.ID == FavouriteGroup); // favourite
            }

            GetClient().SendMessage(message);
        }
Ejemplo n.º 28
0
        internal void ModGetUserInfo()
        {
            if (!Session.GetHabbo().HasFuse("fuse_mod"))
            {
                return;
            }

            int UserId = Request.ReadInt32();

            if (FirewindEnvironment.GetGame().GetClientManager().GetNameById(UserId) != "Unknown User")
            {
                Session.SendMessage(ModerationTool.SerializeUserInfo(UserId));
            }
            else
            {
                Session.SendNotif(LanguageLocale.GetValue("user.loadusererror"));
            }
        }
Ejemplo n.º 29
0
        internal void KickBot()
        {
            Room Room = FirewindEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId);

            if (Room == null || !Room.CheckRights(Session, true))
            {
                return;
            }

            RoomUser Bot = Room.GetRoomUserManager().GetRoomUserByVirtualId(Request.ReadInt32());

            if (Bot == null || !Bot.IsBot)
            {
                return;
            }

            Room.GetRoomUserManager().RemoveBot(Bot.VirtualId, true);
        }
Ejemplo n.º 30
0
        internal static void BanUser(GameClient ModSession, uint UserId, int Length, String Message)
        {
            GameClient Client = FirewindEnvironment.GetGame().GetClientManager().GetClientByUserID(UserId);

            if (Client == null || Client.GetHabbo().Id == ModSession.GetHabbo().Id)
            {
                return;
            }

            if (Client.GetHabbo().Rank >= ModSession.GetHabbo().Rank)
            {
                ModSession.SendNotif(LanguageLocale.GetValue("moderation.ban.missingrank"));
                return;
            }

            Double dLength = Length;

            FirewindEnvironment.GetGame().GetBanManager().BanUser(Client, ModSession.GetHabbo().Username, dLength, Message, false);
        }