Ejemplo n.º 1
0
        public virtual void Handle(GameClient session, ClientMessage message)
        {
            if (session?.GetHabbo()?.GetMessenger() != null)
            {
                string filteredMessage = TextUtilies.CheckBlacklistedWords(TextUtilies.FilterString(this.Message));

                List <string> receiverUsernames  = new List <string>();
                List <int>    receiverSessionIds = new List <int>();
                foreach (uint userId in this.SendTo)
                {
                    if (userId > 0) //real user
                    {
                        if (session.GetHabbo().GetMessenger().IsFriendWith(userId))
                        {
                            Skylight.GetGame().GetGameClientManager().GetGameClientById(userId)?.SendMessage(new MessengerReceivedRoomInviteComposerHandler(session.GetHabbo().ID, filteredMessage));
                        }
                        else
                        {
                            receiverUsernames.Add(Skylight.GetGame().GetGameClientManager().GetUsernameByID(userId));
                            receiverSessionIds.Add(-1);
                        }
                    }
                }

                Skylight.GetGame().GetChatlogManager().LogRoomInvite(session, this.SendTo.Where(u => u > 0).ToList(), receiverUsernames, receiverSessionIds, this.Message);
            }
        }
Ejemplo n.º 2
0
        public void Handle(GameClient session, ClientMessage message)
        {
            if (session != null && session.GetHabbo() != null && session.GetHabbo().GetRoomSession() != null)
            {
                Room room = Skylight.GetGame().GetRoomManager().TryGetRoom(session.GetHabbo().GetRoomSession().CurrentRoomID);
                if (room != null && room.GaveRoomRights(session))
                {
                    string     username   = message.PopFixedString();
                    GameClient gameClient = Skylight.GetGame().GetGameClientManager().GetGameClientByUsername(username);
                    if (gameClient != null && gameClient.GetHabbo() != null && gameClient.GetHabbo().GetRoomSession() != null && gameClient.GetHabbo().GetRoomSession().WaitingForDoorbellAnswer&& gameClient.GetHabbo().GetRoomSession().RequestedRoomID == room.ID)
                    {
                        bool letIn = message.PopBase64Boolean();
                        if (letIn)
                        {
                            gameClient.GetHabbo().GetRoomSession().LoadingRoom = true;

                            ServerMessage doorBellAnswer = BasicUtilies.GetRevisionServerMessage(Revision.RELEASE63_35255_34886_201108111108);
                            doorBellAnswer.Init(r63aOutgoing.DoorBellAnswer);
                            gameClient.SendMessage(doorBellAnswer);
                        }
                        else
                        {
                            ServerMessage doorBellNoAnswer = BasicUtilies.GetRevisionServerMessage(Revision.RELEASE63_35255_34886_201108111108);
                            doorBellNoAnswer.Init(r63aOutgoing.DoorBellNoAnswer);
                            gameClient.SendMessage(doorBellNoAnswer);
                        }
                    }
                }
            }
        }
 public virtual void Handle(GameClient session, ClientMessage message)
 {
     if (session?.GetHabbo() != null)
     {
         Skylight.GetGame().GetGuideManager().Recommend(session, this.Recommend);
     }
 }
Ejemplo n.º 4
0
        public override bool OnUse(GameClient session, string[] args)
        {
            if (args.Length >= 2)
            {
                if (session.GetHabbo().HasPermission("cmd_unmute"))
                {
                    GameClient target = Skylight.GetGame().GetGameClientManager().GetGameClientByUsername(args[1]);
                    if (target != null)
                    {
                        target.GetHabbo().MuteExpires = 0;
                        using (DatabaseClient dbClient = Skylight.GetDatabaseManager().GetClient())
                        {
                            dbClient.AddParamWithValue("muteExpires", 0);
                            dbClient.AddParamWithValue("targetId", target.GetHabbo().ID);
                            dbClient.ExecuteQuery("UPDATE users SET mute_expires = @muteExpires WHERE id = @targetId LIMIT 1");
                        }

                        target.SendMessage(OutgoingPacketsEnum.Flood);
                        target.SendNotif("You have been unmuted! Reload room to remove your flood time");
                    }

                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }
        public void Handle(GameClient session, ClientMessage message)
        {
            Room room = session.GetHabbo().GetRoomSession().GetRoom();

            if (room != null && room.HaveOwnerRights(session))
            {
                uint          itemId = message.PopWiredUInt();
                InventoryItem item   = session.GetHabbo().GetInventoryManager().TryGetWallItem(itemId);
                if (item != null)
                {
                    if (item.GetItem().InteractionType.ToLower() == "roomeffect") //try avoid some cheaty things :D
                    {
                        string type = "";
                        if (item.GetItem().ItemName.Contains("floor"))
                        {
                            type = "floor";
                            room.RoomData.Floor = item.ExtraData;

                            session.GetHabbo().GetUserStats().FloorDesigner++;
                            session.GetHabbo().GetUserAchievements().CheckAchievement("FloorDesigner");
                        }
                        else if (item.GetItem().ItemName.Contains("wallpaper"))
                        {
                            type = "wallpaper";
                            room.RoomData.Wallpaper = item.ExtraData;

                            session.GetHabbo().GetUserStats().WallDesigner++;
                            session.GetHabbo().GetUserAchievements().CheckAchievement("WallDesigner");
                        }
                        else if (item.GetItem().ItemName.Contains("landscape"))
                        {
                            type = "landscape";
                            room.RoomData.Landscape = item.ExtraData;

                            session.GetHabbo().GetUserStats().LandscapeDesigner++;
                            session.GetHabbo().GetUserAchievements().CheckAchievement("LandscapeDesigner");
                        }

                        if (!string.IsNullOrEmpty(type))
                        {
                            session.GetHabbo().GetInventoryManager().RemoveItemFromHand(item.ID, true);

                            using (DatabaseClient dbClient = Skylight.GetDatabaseManager().GetClient())
                            {
                                dbClient.AddParamWithValue("id", room.ID);
                                dbClient.AddParamWithValue("extraData", item.ExtraData);
                                dbClient.ExecuteQuery("UPDATE rooms SET " + type + " = @extraData WHERE id = @id LIMIT 1");
                            }

                            ServerMessage message_ = BasicUtilies.GetRevisionServerMessage(Revision.RELEASE63_35255_34886_201108111108);
                            message_.Init(r63aOutgoing.ApplyRoomEffect);
                            message_.AppendString(type);
                            message_.AppendString(item.ExtraData);
                            room.SendToAll(message_);
                        }
                    }
                }
            }
        }
Ejemplo n.º 6
0
 public override bool OnUse(GameClient session, string[] args)
 {
     using (DatabaseClient dbClient = Skylight.GetDatabaseManager().GetClient())
     {
         ServerConfiguration.LoadConfigsFromDB(dbClient);
     }
     return(true);
 }
 public void Handle(GameClient session, ClientMessage message)
 {
     if (session.GetHabbo().HasPermission("acc_chatlogs"))
     {
         uint userId = message.PopWiredUInt();
         session.SendMessage(Skylight.GetGame().GetModerationToolManager().GetUserChatlog(userId));
     }
 }
 public void Handle(GameClient session, ClientMessage message)
 {
     if (session.GetHabbo().HasPermission("acc_supporttool"))
     {
         uint userId = message.PopWiredUInt();
         session.SendMessage(Skylight.GetGame().GetModerationToolManager().GetRoomVisits(userId));
     }
 }
Ejemplo n.º 9
0
        public void Handle(GameClient session, ClientMessage message)
        {
            if (session.GetHabbo().HasPermission("acc_staffpick"))
            {
                uint roomId = message.PopWiredUInt();
                bool pick   = message.PopWiredBoolean();

                Room room = Skylight.GetGame().GetRoomManager().TryGetAndLoadRoom(roomId);
                if (room != null)
                {
                    PublicItem item = Skylight.GetGame().GetNavigatorManager().GetPublicItem(roomId, ServerConfiguration.StaffPicksCategoryId);
                    if (item == null)
                    {
                        GameClient roomOwner = Skylight.GetGame().GetGameClientManager().GetGameClientById(room.RoomData.OwnerID);
                        using (DatabaseClient dbClient = Skylight.GetDatabaseManager().GetClient())
                        {
                            dbClient.AddParamWithValue("roomId", room.ID);
                            dbClient.AddParamWithValue("caption", room.RoomData.Name);
                            dbClient.AddParamWithValue("categoryId", ServerConfiguration.StaffPicksCategoryId);
                            dbClient.ExecuteQuery("INSERT INTO navigator_publics(ordernum, bannertype, caption, image, type, room_id, category_parent_id, image_type) VALUES(0, '1', @caption, '', 'FLAT', @roomId, @categoryId, 'internal')");

                            Skylight.GetGame().GetNavigatorManager().LoadPublicRooms(dbClient);

                            if (roomOwner == null)
                            {
                                dbClient.AddParamWithValue("roomOwner", room.RoomData.OwnerID);
                                dbClient.ExecuteQuery("UPDATE user_stats SET staff_picks = staff_picks + 1 WHERE user_id = @roomOwner LIMIT 1");
                            }
                        }

                        if (roomOwner != null)
                        {
                            roomOwner.GetHabbo().GetUserStats().StaffPicks++;
                            roomOwner.GetHabbo().GetUserAchievements().CheckAchievement("StaffPick");
                        }
                    }
                    else
                    {
                        using (DatabaseClient dbClient = Skylight.GetDatabaseManager().GetClient())
                        {
                            dbClient.AddParamWithValue("roomId", room.ID);
                            dbClient.AddParamWithValue("categoryId", ServerConfiguration.StaffPicksCategoryId);
                            dbClient.ExecuteQuery("DELETE FROM navigator_publics WHERE room_id = @roomId AND category_parent_id = @categoryId LIMIT 1");

                            Skylight.GetGame().GetNavigatorManager().LoadPublicRooms(dbClient);
                        }
                    }

                    ServerMessage roomData = BasicUtilies.GetRevisionServerMessage(Revision.RELEASE63_35255_34886_201108111108);
                    roomData.Init(r63aOutgoing.RoomData);
                    roomData.AppendBoolean(false);                     //entered room
                    room.RoomData.Serialize(roomData, false);
                    roomData.AppendBoolean(false);                     //forward
                    roomData.AppendBoolean(room.RoomData.IsStaffPick); //is staff pick
                    room.SendToAll(roomData);
                }
            }
        }
Ejemplo n.º 10
0
 public void Handle(GameClient session, ClientMessage message)
 {
     if (session.FlagmeCommandUsed)
     {
         if (session.GetHabbo().HasPermission("cmd_flagme"))
         {
             string username = TextUtilies.FilterString(message.PopFixedString());
             if (username.Length < 3) //to short
             {
                 ServerMessage message_ = BasicUtilies.GetRevisionServerMessage(Revision.RELEASE63_35255_34886_201108111108);
                 message_.Init(r63aOutgoing.ValidUsername);
                 message_.AppendInt32(2); //result
                 message_.AppendString(username);
                 message_.AppendInt32(0); //suggested names
                 session.SendMessage(message_);
             }
             else if (username.Length > 15) // too long
             {
                 ServerMessage message_ = BasicUtilies.GetRevisionServerMessage(Revision.RELEASE63_35255_34886_201108111108);
                 message_.Init(r63aOutgoing.ValidUsername);
                 message_.AppendInt32(3); //result
                 message_.AppendString(username);
                 message_.AppendInt32(0); //suggested names
                 session.SendMessage(message_);
             }
             else if (username.Contains(" ") || !Regex.IsMatch(username, "^[-a-zA-Z0-9._:,]+$") || TextUtilies.HaveBlacklistedWords(username)) //invalid name
             {
                 ServerMessage message_ = BasicUtilies.GetRevisionServerMessage(Revision.RELEASE63_35255_34886_201108111108);
                 message_.Init(r63aOutgoing.ValidUsername);
                 message_.AppendInt32(4); //result
                 message_.AppendString(username);
                 message_.AppendInt32(0); //suggested names
                 session.SendMessage(message_);
             }
             else if (Skylight.GetGame().GetGameClientManager().UsernameExits(username)) //name already exits
             {
                 ServerMessage message_ = BasicUtilies.GetRevisionServerMessage(Revision.RELEASE63_35255_34886_201108111108);
                 message_.Init(r63aOutgoing.ValidUsername);
                 message_.AppendInt32(5); //result
                 message_.AppendString(username);
                 message_.AppendInt32(0); //suggested names
                 session.SendMessage(message_);
             }
             else
             {
                 ServerMessage message_ = BasicUtilies.GetRevisionServerMessage(Revision.RELEASE63_35255_34886_201108111108);
                 message_.Init(r63aOutgoing.ValidUsername);
                 message_.AppendInt32(0); //result
                 message_.AppendString(username);
                 message_.AppendInt32(0); //suggested names
                 session.SendMessage(message_);
             }
         }
     }
     else
     {
     }
 }
Ejemplo n.º 11
0
        public override bool OnUse(GameClient session, string[] args)
        {
            if (session.GetHabbo().GetRoomSession().GetRoom().RoomData.ExtraData.RoleplayEnabled)
            {
                if (args.Length >= 2)
                {
                    GameClient target = Skylight.GetGame().GetGameClientManager().GetGameClientByUsername(args[1]);
                    if (target != null)
                    {
                        RoomUnitUser me    = session.GetHabbo().GetRoomSession().GetRoomUser();
                        RoomUnitUser other = target.GetHabbo().GetRoomSession().GetRoomUser();
                        if (target.GetHabbo().GetRoomSession().IsInRoom&& target.GetHabbo().GetRoomSession().CurrentRoomID == session.GetHabbo().GetRoomSession().CurrentRoomID)
                        {
                            bool doit = true;
                            if ((me.X + 1 != other.X || me.Y != other.Y) && (me.X - 1 != other.X || me.Y != other.Y) && (me.Y + 1 != other.Y || me.X != other.X))
                            {
                                bool skip = false;
                                if (me.X - 1 == other.X)
                                {
                                    if (me.Y == other.Y)
                                    {
                                        skip = true;
                                    }
                                }

                                if (!skip)
                                {
                                    doit = me.X == other.X || me.Y == other.Y;
                                }
                            }

                            if (doit)
                            {
                                int damage = RandomUtilies.GetRandom(5, 12);
                                other.Health -= damage;
                                if (other.Health - damage < 0)
                                {
                                    me.Speak("*Hits " + target.GetHabbo().Username + ", and kills them!*", false);
                                    other.Speak("*dies*", false);
                                    session.GetHabbo().GetRoomSession().GetRoom().RoomUserManager.KickUser(target, true);
                                }
                                else
                                {
                                    me.Speak("*Hits " + target.GetHabbo().Username + ", causing " + damage + " damage *", false);
                                    other.Speak("*Suffers " + damage + " damage from " + me.Session.GetHabbo().Username + ", leaving me with " + other.Health + " health*", false);
                                }
                            }
                        }
                    }
                }
            }
            else
            {
                session.SendNotif("RP is disabled on this room!");
            }

            return(true);
        }
Ejemplo n.º 12
0
        public void UpdateBans()
        {
            using (DatabaseClient dbClient = Skylight.GetDatabaseManager().GetClient())
            {
                Skylight.GetGame().GetBanManager().LoadBans(dbClient);
            }

            Skylight.GetGame().GetBanManager().DisconnecBannedUsers();
        }
Ejemplo n.º 13
0
        public void Disconnect()
        {
            this.UpdateOnlineTime();

            using (DatabaseClient dbClient = Skylight.GetDatabaseManager().GetClient())
            {
                dbClient.AddParamWithValue("userId", this.HabboID);
                dbClient.AddParamWithValue("dailyRespectPoints", this.DailyRespectPoints);
                dbClient.AddParamWithValue("dailyPetRespectPoints", this.DailyPetRespectPoints);
                dbClient.AddParamWithValue("onlineTime", this.OnlineTime);
                dbClient.AddParamWithValue("respectReceived", this.RespectReceived);
                dbClient.AddParamWithValue("regularVisitor", this.RegularVisitor);
                dbClient.AddParamWithValue("achievementPoints", this.AchievementPoints);
                dbClient.AddParamWithValue("respectGiven", this.RespectGiven);
                dbClient.AddParamWithValue("giftsGiven", this.GiftsGived);
                dbClient.AddParamWithValue("giftsReceived", this.GiftsReceived);
                dbClient.AddParamWithValue("notesLeft", this.NotesLeft);
                dbClient.AddParamWithValue("notesReceived", this.NotesReceived);
                dbClient.AddParamWithValue("fireworksCharger", this.FireworksCharger);
                dbClient.AddParamWithValue("equestrianTrackHost", this.EquestrianTrackHost);
                dbClient.AddParamWithValue("horseJumper", this.HorseJumper);
                dbClient.AddParamWithValue("stableOwner", this.StableOwner);
                dbClient.AddParamWithValue("petRespectGiven", this.PetRespectGiven);
                dbClient.AddParamWithValue("battleBanzaiTilesLocked", this.BattleBanzaiTilesLocked);
                dbClient.AddParamWithValue("footballGoalScorer", this.FootballGoalScorer);
                dbClient.AddParamWithValue("footballGoalHost", this.FootballGoalHost);
                dbClient.AddParamWithValue("freezeFigter", this.FreezeFigter);
                dbClient.AddParamWithValue("freezePowerUpCollector", this.FreezePowerUpCollector);
                dbClient.AddParamWithValue("skateboardJumper", this.SkateboardJumper);
                dbClient.AddParamWithValue("skateboardSlider", this.SkateboardSlider);
                dbClient.AddParamWithValue("roomHost", this.RoomHost);
                dbClient.AddParamWithValue("roomRaider", this.RoomRaider);
                dbClient.AddParamWithValue("iceIceBaby", this.IceIceBaby);
                dbClient.AddParamWithValue("caughtOnIceTag", this.CaughtOnIceTag);
                dbClient.AddParamWithValue("rollerDerby", this.RollerDerby);
                dbClient.AddParamWithValue("floorDesigner", this.FloorDesigner);
                dbClient.AddParamWithValue("landscapeDesigner", this.LandscapeDesigner);
                dbClient.AddParamWithValue("wallDesigner", this.WallDesigner);
                dbClient.AddParamWithValue("staffPicks", this.StaffPicks);
                dbClient.AddParamWithValue("guideRequester", this.GuideRequester);
                dbClient.AddParamWithValue("guideFeedbackGiver", this.GuideFeedbackGiver);
                dbClient.AddParamWithValue("guideOnDutyPresence", this.GuideOnDutyPresence);
                dbClient.AddParamWithValue("guideRecommendations", this.GuideRecommendations);
                dbClient.AddParamWithValue("guideRequestsHandled", this.GuideRequestsHandled);
                dbClient.AddParamWithValue("guideChatsReviewed", this.GuideChatsReviewed);

                dbClient.ExecuteQuery("UPDATE user_stats SET daily_respect_points = @dailyRespectPoints, daily_pet_respect_points = @dailyPetRespectPoints, achievement_points = @achievementPoints, " +
                                      "online_time = @onlineTime, respect_received = @respectReceived, regular_visitor = @regularVisitor, respect_given = @respectGiven, gifts_given = @giftsGiven, gifts_received = @giftsReceived, " +
                                      "notes_left = @notesLeft, notes_received = @notesReceived, fireworks_charger = @fireworksCharger, equestrian_track_host = @equestrianTrackHost, horse_jumper = @horseJumper, " +
                                      "stable_owner = @stableOwner, pet_respect_given = @petRespectGiven, battle_banzai_tiles_locked = @battleBanzaiTilesLocked, football_goal_scorer = @footballGoalScorer, " +
                                      "football_goal_host = @footballGoalHost, freeze_figter = @freezeFigter, freeze_power_up_collector = @freezePowerUpCollector, skateboard_jumper = @skateboardJumper, " +
                                      "skateboard_slider = @skateboardSlider, room_host = @roomHost, room_raider = @roomRaider, ice_ice_baby = @iceIceBaby, caught_on_ice_tag = @caughtOnIceTag, roller_derby = @rollerDerby, " +
                                      "floor_designer = @floorDesigner, landscape_designer = @landscapeDesigner, wall_designer = @wallDesigner, staff_picks = @staffPicks, guide_requester = @guideRequester, " +
                                      "guide_feedback_giver = @guideFeedbackGiver, guide_on_duty_presence = @guideOnDutyPresence, guide_recommendations = @guideRecommendations, guide_requests_handled = @guideRequestsHandled, " + "" +
                                      "guide_chats_reviewed = @guideChatsReviewed WHERE user_id = @userId");
            }
        }
Ejemplo n.º 14
0
        public void Handle(GameClient session, ClientMessage message)
        {
            int    pageId    = message.PopWiredInt32();
            uint   itemId    = message.PopWiredUInt();
            string extraData = message.PopFixedString();

            Skylight.GetGame().GetCatalogManager().BuyItem(session, pageId, itemId, extraData, session.GetHabbo().GetCommandCache().BuyCommandValue, false);
            session.GetHabbo().GetCommandCache().BuyCommandValue = 1;
        }
Ejemplo n.º 15
0
        public void RemoveFromDuty(GameClient session)
        {
            session.GetHabbo().GetUserStats().UpdateGuideOnDutyPresence();
            session.GetHabbo().GetUserStats().GuideOnDutyPresenceCheckStart = 0;

            this.Guides.TryRemove(session.GetHabbo().ID, out GuideRequestType type);

            session.SendMessage(new GuideToolComposerHandler(false, Skylight.GetGame().GetGuideManager().TourersCount, Skylight.GetGame().GetGuideManager().HelpersCount, Skylight.GetGame().GetGuideManager().GuardiansCount));
        }
Ejemplo n.º 16
0
        public InventoryItem AddItem(uint id, uint baseItem, string extraData, bool newFurni)
        {
            if (newFurni)
            {
                if (id == 0)
                {
                    using (DatabaseClient dbClient = Skylight.GetDatabaseManager().GetClient())
                    {
                        dbClient.AddParamWithValue("userid", this.Session.GetHabbo().ID);
                        dbClient.AddParamWithValue("baseitem", baseItem);
                        dbClient.AddParamWithValue("extradata", extraData);
                        dbClient.ExecuteQuery("INSERT INTO items(user_id, base_item, extra_data) VALUES (@userid, @baseitem, @extradata)");

                        id = (uint)dbClient.GetID();
                    }
                }
                else
                {
                    using (DatabaseClient dbClient = Skylight.GetDatabaseManager().GetClient())
                    {
                        dbClient.AddParamWithValue("userid", this.Session.GetHabbo().ID);
                        dbClient.AddParamWithValue("baseitem", baseItem);
                        dbClient.AddParamWithValue("extradata", extraData);
                        dbClient.AddParamWithValue("itemId", id);
                        dbClient.ExecuteQuery("INSERT INTO items(id, user_id, base_item, extra_data) VALUES (@itemId, @userid, @baseitem, @extradata)");
                    }
                }
            }
            else
            {
                using (DatabaseClient dbClient = Skylight.GetDatabaseManager().GetClient())
                {
                    dbClient.AddParamWithValue("userid", this.Session.GetHabbo().ID);
                    dbClient.AddParamWithValue("itemid", id);
                    dbClient.ExecuteQuery("UPDATE items SET room_id = 0, user_id = @userid WHERE id = @itemid LIMIT 1");
                }
            }

            InventoryItem item = new InventoryItem(id, baseItem, extraData);

            if (item.GetItem().IsWallItem)
            {
                this.WallItems.Add(item.ID, item);
            }
            else
            {
                this.FloorItems.Add(item.ID, item);
            }

            ServerMessage Message = BasicUtilies.GetRevisionServerMessage(Revision.RELEASE63_35255_34886_201108111108);

            Message.Init(r63aOutgoing.AddItemToHand);
            item.Serialize(Message);
            this.SendData(Message);

            return(item);
        }
Ejemplo n.º 17
0
        public override void OnRoomCycle()
        {
            this.Ticks++;

            foreach (BotAction action in Skylight.GetGame().GetBotManager().GetBotActionsByTick(this.Ticks))
            {
                this.HandleBotAction(action);
            }
        }
        public void Handle(GameClient session, ClientMessage message)
        {
            Skylight.GetGame().GetModerationToolManager().DeletePendingSupportTicket(session.GetHabbo().ID);

            ServerMessage message_ = BasicUtilies.GetRevisionServerMessage(Revision.RELEASE63_35255_34886_201108111108);

            message_.Init(r63aOutgoing.ShowCallForHelp);
            session.SendMessage(message_);
        }
Ejemplo n.º 19
0
        public void CancelOffer(GameClient session, uint id)
        {
            MarketplaceOffer offer = this.TryGetOffer(id);

            if (offer != null)
            {
                if (!offer.Sold && !offer.Redeem) //for sure both
                {
                    offer.Cancalled = true;

                    Item item = Skylight.GetGame().GetItemManager().TryGetItem(offer.ItemID);
                    if (item != null)
                    {
                        this.Offers.Remove(offer.ID);
                        this.Sold.Remove(offer.ID); //for sure :D
                        this.Expired.Remove(offer.ID);
                        session.GetHabbo().GetInventoryManager().AddItem(offer.FurniID, item.ID, offer.FurniExtraData, true);

                        using (DatabaseClient dbClient = Skylight.GetDatabaseManager().GetClient())
                        {
                            dbClient.AddParamWithValue("offerId", offer.ID);
                            dbClient.ExecuteQuery("DELETE FROM catalog_marketplace_offers WHERE id = @offerId LIMIT 1"); //useless data so we can delete it
                        }

                        ServerMessage message = BasicUtilies.GetRevisionServerMessage(Revision.RELEASE63_35255_34886_201108111108);
                        message.Init(r63aOutgoing.CancelOfferResult);
                        message.AppendUInt(offer.ID);
                        message.AppendInt32(1); //result, 0 = failed, 1 = success
                        session.SendMessage(message);
                    }
                    else
                    {
                        ServerMessage message = BasicUtilies.GetRevisionServerMessage(Revision.RELEASE63_35255_34886_201108111108);
                        message.Init(r63aOutgoing.CancelOfferResult);
                        message.AppendUInt(offer.ID);
                        message.AppendInt32(0); //result, 0 = failed, 1 = success
                        session.SendMessage(message);
                    }
                }
                else
                {
                    ServerMessage message = BasicUtilies.GetRevisionServerMessage(Revision.RELEASE63_35255_34886_201108111108);
                    message.Init(r63aOutgoing.CancelOfferResult);
                    message.AppendUInt(offer.ID);
                    message.AppendInt32(0); //result, 0 = failed, 1 = success
                    session.SendMessage(message);
                }
            }
            else
            {
                ServerMessage message = BasicUtilies.GetRevisionServerMessage(Revision.RELEASE63_35255_34886_201108111108);
                message.Init(r63aOutgoing.CancelOfferResult);
                message.AppendUInt(id);
                message.AppendInt32(0); //result, 0 = failed, 1 = success
                session.SendMessage(message);
            }
        }
Ejemplo n.º 20
0
        public void Handle(GameClient session, ClientMessage message)
        {
            if (session != null && session.GetHabbo() != null)
            {
                uint offerId = message.PopWiredUInt();

                Skylight.GetGame().GetCatalogManager().GetMarketplaceManager().BuyOffer(session, offerId);
            }
        }
Ejemplo n.º 21
0
        public void Handle(GameClient session, ClientMessage message)
        {
            int    minPrice = message.PopWiredInt32();
            int    maxPrice = message.PopWiredInt32();
            string search   = message.PopFixedString();
            int    order    = message.PopWiredInt32();

            session.SendMessage(Skylight.GetGame().GetCatalogManager().GetMarketplaceManager().GetOffers(minPrice, maxPrice, search, order));
        }
Ejemplo n.º 22
0
        public void Handle(GameClient session, ClientMessage message)
        {
            CatalogPage page = Skylight.GetGame().GetCatalogManager().GetCatalogPage(message.PopWiredInt32());

            if (page != null && page.Visible && page.Enabled && page.MinRank <= session.GetHabbo().Rank)
            {
                session.SendData(page.GetBytes(session.Revision));
            }
        }
Ejemplo n.º 23
0
        public void Handle(GameClient session, ClientMessage message)
        {
            ServerMessage club = BasicUtilies.GetRevisionServerMessage(Revision.RELEASE63_35255_34886_201108111108);

            club.Init(r63aOutgoing.ClubOffers);

            List <CatalogItem> items = Skylight.GetGame().GetCatalogManager().GetCatalogPages().Where(p => p.PageLayout == "club_buy").SelectMany(p => p.Items.Values).ToList();

            Subscription subscription = session.GetHabbo().GetSubscriptionManager().TryGetSubscription("habbo_vip", true, false);

            if (subscription == null) //user isint vip
            {
                subscription = session.GetHabbo().GetSubscriptionManager().TryGetSubscription("habbo_club", true, false);

                if (subscription == null) //still null
                {
                    subscription = new Subscription(0, "", TimeUtilies.GetUnixTimestamp(), TimeUtilies.GetUnixTimestamp());
                }
            }

            bool isUpgrade = !session.GetHabbo().IsVIP() && session.GetHabbo().IsHC();

            club.AppendInt32(items.Count); //count
            foreach (CatalogItem item in items)
            {
                double vipUpgradeTime = 0;

                club.AppendUInt(item.Id);           //base id
                club.AppendString(item.Name);       //name
                club.AppendInt32(item.CostCredits); //price

                if (item.Name.StartsWith("DEAL_VIP"))
                {
                    club.AppendBoolean(isUpgrade); //is upgrade, vip thing

                    if (isUpgrade)
                    {
                        vipUpgradeTime = subscription.SecoundsLeft() / 1.67;
                    }
                }
                else
                {
                    club.AppendBoolean(false); //is upgrade, vip thing
                }

                club.AppendBoolean(item.Name.StartsWith("DEAL_VIP"));                                          //is vip packgage
                club.AppendInt32(item.GetItems()[0].Item2);                                                    //months lenght
                club.AppendInt32((int)Math.Ceiling(vipUpgradeTime / 86400) + (31 * item.GetItems()[0].Item2)); //days lenght, vip upgrade thing

                DateTime expires = TimeUtilies.UnixTimestampToDateTime(subscription.GetExpires() + (2678400.0 * item.GetItems()[0].Item2) + vipUpgradeTime);
                club.AppendInt32(expires.Year);  //exprie year
                club.AppendInt32(expires.Month); //expire month
                club.AppendInt32(expires.Day);   //expire day
            }

            session.SendMessage(club);
        }
Ejemplo n.º 24
0
        public void Handle(GameClient session, ClientMessage message)
        {
            if (session != null && session.GetHabbo() != null && session.GetHabbo().GetRoomSession() != null)
            {
                RoomUnit user = session.GetHabbo().GetRoomSession().GetRoomUser();
                if (user != null && user.Room != null)
                {
                    uint     itemId = message.PopWiredUInt();
                    RoomItem item   = user.Room.RoomItemManager.TryGetRoomItem(itemId);
                    if (item != null)
                    {
                        if (item.GetBaseItem().ItemName.StartsWith("CF_") || item.GetBaseItem().ItemName.StartsWith("CFC_") || item.GetBaseItem().ItemName.StartsWith("PixEx_") || item.GetBaseItem().ItemName.StartsWith("PntEx_"))
                        {
                            user.Room.RoomItemManager.RemoveItem(session, item);

                            using (DatabaseClient dbClient = Skylight.GetDatabaseManager().GetClient())
                            {
                                dbClient.AddParamWithValue("itemId", item.ID);
                                dbClient.ExecuteQuery("DELETE FROM items WHERE id = @itemId LIMIT 1");
                            }

                            string[] array = item.GetBaseItem().ItemName.Split(new char[]
                            {
                                '_'
                            });

                            if (!item.GetBaseItem().ItemName.StartsWith("PntEx_"))
                            {
                                int value = int.Parse(array[1]);

                                if (item.GetBaseItem().ItemName.StartsWith("CF_") || item.GetBaseItem().ItemName.StartsWith("CFC_"))
                                {
                                    session.GetHabbo().Credits += value;
                                    session.GetHabbo().UpdateCredits(true);
                                }
                                else
                                {
                                    if (item.GetBaseItem().ItemName.StartsWith("PixEx_"))
                                    {
                                        session.GetHabbo().AddActivityPoints(0, value);
                                        session.GetHabbo().UpdateActivityPoints(0, true);
                                    }
                                }
                            }
                            else //point excahange
                            {
                                int key   = int.Parse(array[1]);
                                int value = int.Parse(array[2]);

                                session.GetHabbo().AddActivityPoints(key, value);
                                session.GetHabbo().UpdateActivityPoints(key, true);
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 25
0
        public ServerMessage Handle(T handler)
        {
            ServerMessage message = BasicUtilies.GetRevisionServerMessage(Revision.PRODUCTION_201601012205_226667486, r63cOutgoing.SendTalentTrack);

            message.AppendString(handler.Track.Name);

            List <string>          perks = null;
            Dictionary <uint, int> items = null;

            bool lastCompleted = true;

            message.AppendInt32(handler.Track.GetLevels().Count);
            foreach (TalentTrackLevel level in handler.Track.GetLevels())
            {
                bool completed = handler.Track.GetLevels().Count - 1 == level.Level ? false : lastCompleted && level.HasCompleted(handler.Habbo);

                message.AppendInt32(level.Level);
                message.AppendInt32(lastCompleted ? completed ? 2 : 1 : 0);
                message.AppendInt32(level.AchievementsRequired.Count);
                foreach (KeyValuePair <string, int> achievement in level.AchievementsRequired)
                {
                    AchievementLevel achievementLevel = Skylight.GetGame().GetAchievementManager().GetAchievement(achievement.Key).GetLevel(achievement.Value);

                    message.AppendInt32(achievementLevel.ID);
                    message.AppendInt32(achievementLevel.Level);
                    message.AppendString(achievementLevel.LevelBadge);
                    message.AppendInt32(lastCompleted ? completed || handler.Habbo.GetUserAchievements().GetAchievementLevel(achievement.Key) >= achievementLevel.Level ? 2 : 1 : 0); //state
                    message.AppendInt32(handler.Habbo.GetUserAchievements().GetAchievementProgress(achievement.Key));
                    message.AppendInt32(achievementLevel.ProgressNeeded);
                }

                message.AppendInt32(perks?.Count ?? 0);
                if (perks != null)
                {
                    foreach (string perk in perks)
                    {
                        message.AppendString(perk);
                    }
                }

                message.AppendInt32(items?.Count ?? 0);
                if (items != null)
                {
                    foreach (KeyValuePair <uint, int> item in items)
                    {
                        message.AppendString(item.Key.ToString());
                        message.AppendInt32(item.Value);
                    }
                }

                lastCompleted = completed;
                perks         = level.PrizePerks;
                items         = level.PrizeItems;
            }
            return(message);
        }
Ejemplo n.º 26
0
        public void Handle(GameClient session, ClientMessage message)
        {
            if (session != null && session.GetHabbo() != null && session.GetHabbo().GetRoomSession() != null)
            {
                Room room = session.GetHabbo().GetRoomSession().GetRoom();
                if (room != null && room.GaveRoomRights(session))
                {
                    string   data         = message.PopStringUntilBreak(null);
                    string[] splittedData = data.Split(' ');

                    uint itemId = uint.Parse(splittedData[0].Replace("-", ""));
                    if (splittedData[1].StartsWith(":"))
                    {
                        InventoryItem item = session.GetHabbo().GetInventoryManager().TryGetWallItem(itemId);
                        if (item != null && item.GetItem() != null)
                        {
                            RoomItem roomItem = RoomItem.GetRoomItem(itemId, room.ID, session.GetHabbo().ID, item.BaseItem, item.ExtraData, 0, 0, 0.0, 0, new WallCoordinate(":" + data.Split(':')[1]), room);
                            if (room.RoomItemManager.AddWallItemToRoom(session, roomItem))
                            {
                                session.GetHabbo().GetInventoryManager().RemoveItemFromHand(itemId, false);

                                using (DatabaseClient dbClient = Skylight.GetDatabaseManager().GetClient())
                                {
                                    dbClient.AddParamWithValue("roomid", room.ID);
                                    dbClient.AddParamWithValue("itemid", itemId);
                                    dbClient.ExecuteQuery("UPDATE items SET room_id = @roomid WHERE id = @itemid LIMIT 1");
                                }
                            }
                        }
                    }
                    else
                    {
                        InventoryItem item = session.GetHabbo().GetInventoryManager().TryGetFloorItem(itemId);
                        if (item != null && item.GetItem() != null)
                        {
                            int x   = int.Parse(splittedData[1]);
                            int y   = int.Parse(splittedData[2]);
                            int rot = int.Parse(splittedData[3]);

                            RoomItem roomItem = RoomItem.GetRoomItem(itemId, room.ID, session.GetHabbo().ID, item.BaseItem, item.ExtraData, x, y, 0.0, rot, null, room);
                            if (room.RoomItemManager.AddFloorItemToRoom(session, roomItem, x, y, rot))
                            {
                                session.GetHabbo().GetInventoryManager().RemoveItemFromHand(itemId, false);

                                using (DatabaseClient dbClient = Skylight.GetDatabaseManager().GetClient())
                                {
                                    dbClient.AddParamWithValue("roomid", room.ID);
                                    dbClient.AddParamWithValue("itemid", itemId);
                                    dbClient.ExecuteQuery("UPDATE items SET room_id = @roomid WHERE id = @itemid LIMIT 1");
                                }
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 27
0
        public void Enable()
        {
            this.Enabled = true;

            using (DatabaseClient dbClient = Skylight.GetDatabaseManager().GetClient())
            {
                dbClient.AddParamWithValue("itemId", this.ItemID);
                dbClient.ExecuteQuery("UPDATE items_moodlight SET enabled = '1' WHERE item_id = @itemId LIMIT 1");
            }
        }
Ejemplo n.º 28
0
        public void Handle(GameClient session, ClientMessage message)
        {
            if (session.GetHabbo().HasPermission("acc_supporttool"))
            {
                uint roomId = message.PopWiredUInt();

                RoomData data = Skylight.GetGame().GetRoomManager().TryGetAndLoadRoomData(roomId);
                session.SendMessage(Skylight.GetGame().GetModerationToolManager().SerializeRoomInfo(data));
            }
        }
Ejemplo n.º 29
0
        public void Handle(GameClient session, ClientMessage message)
        {
            ServerMessage Message = BasicUtilies.GetRevisionServerMessage(Revision.RELEASE63_35255_34886_201108111108);

            Message.Init(r63aOutgoing.BadgePoints);
            Message.AppendInt32(session.GetHabbo().GetUserStats().AchievementPoints);
            session.SendMessage(Message);

            session.SendMessage(Skylight.GetGame().GetAchievementManager().BadgePointLimits(session.Revision));
        }
Ejemplo n.º 30
0
        public void Handle(GameClient session, ClientMessage message)
        {
            if (session.GetHabbo().HasPermission("acc_chatlogs"))
            {
                int  bool_  = message.PopWiredInt32(); //bool
                uint roomId = message.PopWiredUInt();

                session.SendMessage(Skylight.GetGame().GetModerationToolManager().GetRoomChatlog(roomId));
            }
        }