Ejemplo n.º 1
0
        internal static void SellItem(GameClient Session, uint ItemId, int SellingPrice)
        {
            UserItem Item = Session.GetHabbo().GetInventoryComponent().GetItem(ItemId);

            if (Item == null || SellingPrice > 10000 || !CanSellItem(Item))
            {
                Session.GetMessageHandler().GetResponse().Init(610);
                Session.GetMessageHandler().GetResponse().AppendBoolean(false);
                Session.GetMessageHandler().GetResponse();
                Session.GetMessageHandler().SendResponse();
                return;
            }

            int Comission = CalculateComissionPrice(SellingPrice);
            int TotalPrice = SellingPrice + Comission;
            int ItemType = 1;

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

            using (IQueryAdapter dbClient = PiciEnvironment.GetDatabaseManager().getQueryreactor())
            {
                if (dbClient.dbType == DatabaseType.MSSQL)
                    dbClient.setQuery("INSERT INTO catalog_marketplace_offers (item_id,user_id,asking_price,total_price,public_name,sprite_id,item_type,timestamp,extra_data,state) VALUES (" + Item.BaseItem + "," + Session.GetHabbo().Id + "," + SellingPrice + "," + TotalPrice + ",@public_name," + Item.GetBaseItem().SpriteId + "," + ItemType + "," + PiciEnvironment.GetUnixTimestamp() + ",@extra_data, '1')");
                else
                    dbClient.setQuery("INSERT INTO catalog_marketplace_offers (item_id,user_id,asking_price,total_price,public_name,sprite_id,item_type,timestamp,extra_data) VALUES (" + Item.BaseItem + "," + Session.GetHabbo().Id + "," + SellingPrice + "," + TotalPrice + ",@public_name," + Item.GetBaseItem().SpriteId + "," + ItemType + "," + PiciEnvironment.GetUnixTimestamp() + ",@extra_data)");
                dbClient.addParameter("public_name", Item.GetBaseItem().PublicName);
                dbClient.addParameter("extra_data", Item.ExtraData);
                dbClient.runQuery();
            }

            Session.GetHabbo().GetInventoryComponent().RemoveItem(ItemId, false);
            Session.GetHabbo().GetInventoryComponent().RunDBUpdate();

            Session.GetMessageHandler().GetResponse().Init(610);
            Session.GetMessageHandler().GetResponse().AppendBoolean(true);
            Session.GetMessageHandler().SendResponse();
        }
Ejemplo n.º 2
0
        internal void RemoveUserFromRoom(GameClient Session, Boolean NotifyClient, Boolean NotifyKick)
        {
            try
            {
                if (Session == null)
                    return;

                if (Session.GetHabbo() == null)
                    return;

                Session.GetHabbo().GetAvatarEffectsInventoryComponent().OnRoomExit();

                if (NotifyClient)
                {
                    if (NotifyKick)
                    {
                        Session.GetMessageHandler().GetResponse().Init(33);
                        Session.GetMessageHandler().GetResponse().AppendInt32(4008);
                        Session.GetMessageHandler().SendResponse();
                    }

                    Session.GetMessageHandler().GetResponse().Init(18);
                    Session.GetMessageHandler().SendResponse();
                }

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

                if (User != null)
                {
                    RemoveRoomUser(User);

                    if (Session.GetHabbo() != null)
                    {
                        if (!User.IsSpectator)
                        {
                            if (User.CurrentItemEffect != ItemEffectType.None)
                            {
                                User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().CurrentEffect = -1;
                            }
                            //UserMatrix[User.X, User.Y] = false;

                            if (Session.GetHabbo() != null)
                            {
                                if (room.HasActiveTrade(Session.GetHabbo().Id))
                                    room.TryStopTrade(Session.GetHabbo().Id);

                                if (Session.GetHabbo().Username == room.Owner)
                                {
                                    if (room.HasOngoingEvent)
                                    {
                                        room.Event = new RoomEvent(0, null, null, 0, new List<string>());

                                        ServerMessage Message = new ServerMessage(370);
                                        Message.AppendStringWithBreak("-1");
                                        room.SendMessage(Message);

                                        PiciEnvironment.GetGame().GetRoomManager().GetEventManager().QueueRemoveEvent(room.RoomData, room.Event.Category);
                                    }
                                }
                                Session.GetHabbo().CurrentRoomId = 0;

                                if (Session.GetHabbo().GetMessenger() != null)
                                    Session.GetHabbo().GetMessenger().OnStatusChanged(true);
                            }

                            //DateTime Start = DateTime.Now;
                            //using (IQueryAdapter dbClient = PiciEnvironment.GetDatabaseManager().getQueryreactor())
                            //{
                            //    //TimeSpan TimeUsed1 = DateTime.Now - Start;
                            //    //Logging.LogThreadException("Time used on sys part 2: " + TimeUsed1.Seconds + "s, " + TimeUsed1.Milliseconds + "ms", "");

                            //    //if (Session.GetHabbo() != null)
                            //    //    dbClient.runFastQuery("UPDATE user_roomvisits SET exit_timestamp = '" + PiciEnvironment.GetUnixTimestamp() + "' WHERE room_id = '" + this.Id + "' AND user_id = '" + Id + "' ORDER BY exit_timestamp DESC LIMIT 1");
                            //    //dbClient.runFastQuery("UPDATE rooms SET users_now = " + UsersNow + " WHERE id = " + Id);
                            //    //dbClient.runFastQuery("REPLACE INTO room_active VALUES (" + RoomId + ", " + UsersNow + ")");
                            //    dbClient.runFastQuery("UPDATE room_active SET active_users = " + UsersNow);
                            //}
                        }
                    }

                    usersByUserID.Remove(User.userID);
                    if (Session.GetHabbo() != null)
                        usersByUsername.Remove(Session.GetHabbo().Username.ToLower());

                    User.Dispose();
                }

            }
            catch (Exception e)
            {
                Logging.LogCriticalException("Error during removing user from room:" + e.ToString());
            }
        }
Ejemplo n.º 3
0
        internal void HandleRowchase(GameClient Session, int PageId, uint ItemId, string ExtraData, Boolean IsGift, string GiftUser, string GiftMessage)
        {
            CatalogPage Page;

            if (!Pages.TryGetValue(PageId, out Page))
                return;

            if (Page == null || Page.ComingSoon || !Page.Enabled || !Page.Visible || Session == null || Session.GetHabbo() == null)
            {
                return;
            }

            if (Page.ClubOnly && !Session.GetHabbo().GetSubscriptionManager().HasSubscription("habbo_club"))
            {
                return;
            }
            if (Page.MinRank > Session.GetHabbo().Rank)
            {
                return;
            }
            CatalogItem Item = Page.GetItem(ItemId);

            if (Item == null)
            {
                return;
            }

            uint GiftUserId = 0;

            if (IsGift)
            {
                if (!Item.GetBaseItem().AllowGift)
                {
                    return;
                }

                DataRow dRow;
                using (IQueryAdapter dbClient = PiciEnvironment.GetDatabaseManager().getQueryreactor())
                {
                    dbClient.setQuery("SELECT id FROM users WHERE username = @gift_user");
                    dbClient.addParameter("gift_user", GiftUser);

                    dRow = dbClient.getRow();
                }

                if (dRow == null)
                {
                    Session.GetMessageHandler().GetResponse().Init(76);
                    Session.GetMessageHandler().GetResponse().AppendBoolean(true);
                    Session.GetMessageHandler().GetResponse().AppendStringWithBreak(GiftUser);
                    Session.GetMessageHandler().SendResponse();

                    return;
                }

                GiftUserId = Convert.ToUInt32(dRow[0]);

                if (GiftUserId == 0)
                {
                    Session.GetMessageHandler().GetResponse().Init(76);
                    Session.GetMessageHandler().GetResponse().AppendBoolean(true);
                    Session.GetMessageHandler().GetResponse().AppendStringWithBreak(GiftUser);
                    Session.GetMessageHandler().SendResponse();

                    return;
                }
            }

            Boolean CreditsError = false;
            Boolean PixelError = false;

            if (Session.GetHabbo().Credits < Item.CreditsCost)
            {
                CreditsError = true;
            }

            if (Session.GetHabbo().ActivityPoints < Item.PixelsCost)
            {
                PixelError = true;
            }

            if (CreditsError || PixelError)
            {
                Session.GetMessageHandler().GetResponse().Init(68);
                Session.GetMessageHandler().GetResponse().AppendBoolean(CreditsError);
                Session.GetMessageHandler().GetResponse().AppendBoolean(PixelError);
                Session.GetMessageHandler().SendResponse();

                return;
            }

            if (IsGift && Item.GetBaseItem().Type == 'e')
            {
                Session.SendNotif(LanguageLocale.GetValue("catalog.gift.send.error"));
                return;
            }

            if (Item.CrystalCost > 0)
            {
                int userCrystals = 0;
                using (IQueryAdapter dbClient = PiciEnvironment.GetDatabaseManager().getQueryreactor())
                {
                    dbClient.setQuery("SELECT crystals FROM users WHERE id = " + Session.GetHabbo().Id);
                    userCrystals = dbClient.getInteger();
                }

                if (Item.CrystalCost > userCrystals)
                {
                    Session.SendNotif(LanguageLocale.GetValue("catalog.crystalerror") + Item.CrystalCost);
                    return;
                }

                userCrystals = userCrystals - Item.CrystalCost;

                Session.GetMessageHandler().GetResponse().Init(MessageComposerIds.ActivityPointsMessageComposer);
                Session.GetMessageHandler().GetResponse().AppendInt32(2);
                Session.GetMessageHandler().GetResponse().AppendInt32(4);
                Session.GetMessageHandler().GetResponse().AppendInt32(userCrystals);
                Session.GetMessageHandler().SendResponse();

                using (IQueryAdapter dbClient = PiciEnvironment.GetDatabaseManager().getQueryreactor())
                {
                    dbClient.runFastQuery("UPDATE users SET crystals = " + userCrystals + " WHERE id = " + Session.GetHabbo().Id);

                }

                Session.SendNotif(LanguageLocale.GetValue("catalog.crystalsbought") + userCrystals);
            }

            if (Item.Name.Contains("HABBO_CLUB"))
            {
                #region Purchase Club!
                // PAYmQHABBO_CLUB_BASIC_1_MONTHSCHHISGZvGSBSE[mQHABBO_CLUB_VIP_1_MONTHQFHIISGZvGSBSEXnQHABBO_CLUB_VIP_3_MONTHSPOHIKQW[vGIPFZmQHABBO_CLUB_BASIC_3_MONTHSQKHHKQW[vGIPF
                int TypeOfClub = 0;
                Subscription Sub;
                if (Session.GetHabbo().GetSubscriptionManager().HasSubscription("habbo_vip"))
                    Sub = Session.GetHabbo().GetSubscriptionManager().GetSubscription("habbo_vip");
                else if (Session.GetHabbo().GetSubscriptionManager().HasSubscription("habbo_club"))
                    Sub = Session.GetHabbo().GetSubscriptionManager().GetSubscription("habbo_club");
                else
                    Sub = null;

                if (Item.Name == "HABBO_CLUB_BASIC_1_MONTH")
                {
                    TypeOfClub = 1;
                }
                else if (Item.Name.Contains("HABBO_CLUB_BASIC_3"))
                {
                    TypeOfClub = 2;
                }
                else if (Item.Name == "HABBO_CLUB_VIP_1_MONTH")
                {
                    TypeOfClub = 3;
                }
                else if (Item.Name.Contains("HABBO_CLUB_VIP_3"))
                {
                    TypeOfClub = 4;
                }
                else if (Item.Name == "HABBO_CLUB_UPGRADE_1")
                {
                    TypeOfClub = 5;
                }
                else if (Item.Name == "HABBO_CLUB_UPGRADE_3")
                {
                    TypeOfClub = 6;
                }

                if (TypeOfClub == 1)
                {
                    Session.GetHabbo().GetSubscriptionManager().AddOrExtendSubscription("habbo_club", (60 * 60 * 24 * 31));
                    ServerMessage FuseRight = new ServerMessage(2);
                    FuseRight.AppendInt32(1);
                    Session.SendMessage(FuseRight);
                    Session.GetMessageHandler().GetSubscriptionData();
                }
                else if (TypeOfClub == 2)
                {
                    Session.GetHabbo().GetSubscriptionManager().AddOrExtendSubscription("habbo_club", (60 * 60 * 24 * 31 * 3));
                    ServerMessage FuseRight = new ServerMessage(2);
                    FuseRight.AppendInt32(1);
                    Session.SendMessage(FuseRight);
                    Session.GetMessageHandler().GetSubscriptionData();
                }
                else if (TypeOfClub == 3)
                {
                    Session.GetHabbo().GetSubscriptionManager().AddOrExtendSubscription("habbo_vip", (60 * 60 * 24 * 31));
                    ServerMessage FuseRight = new ServerMessage(2);
                    FuseRight.AppendInt32(2);
                    Session.SendMessage(FuseRight);
                    Session.GetMessageHandler().GetSubscriptionData();
                }
                else if (TypeOfClub == 4)
                {
                    Session.GetHabbo().GetSubscriptionManager().AddOrExtendSubscription("habbo_vip", (60 * 60 * 24 * 31 * 3));
                    ServerMessage FuseRight = new ServerMessage(2);
                    FuseRight.AppendInt32(2);
                    Session.SendMessage(FuseRight);
                    Session.GetMessageHandler().GetSubscriptionData();
                }
                else if (TypeOfClub == 5)
                {
                    Session.GetHabbo().GetSubscriptionManager().AddOrExtendSubscription("habbo_vip", (60 * 60 * 24 * 31));
                    ServerMessage FuseRight = new ServerMessage(2);
                    FuseRight.AppendInt32(2);
                    Session.SendMessage(FuseRight);
                    Session.GetMessageHandler().GetSubscriptionData();
                }
                else if (TypeOfClub == 6)
                {
                    Session.GetHabbo().GetSubscriptionManager().AddOrExtendSubscription("habbo_vip", (60 * 60 * 24 * 31 * 3));
                    ServerMessage FuseRight = new ServerMessage(2);
                    FuseRight.AppendInt32(2);
                    Session.SendMessage(FuseRight);
                    Session.GetMessageHandler().GetSubscriptionData();
                }

                bool CreditsFail = false;
                bool PixelsFail = false;

                if (Session.GetHabbo().Credits < Item.CreditsCost)
                {
                    CreditsFail = true;
                }

                if (CreditsFail || PixelsFail)
                {
                    ServerMessage Failed = new ServerMessage(68);
                    Failed.AppendBoolean(CreditsFail);
                    Failed.AppendBoolean(PixelsFail);
                    Session.SendMessage(Failed);
                    return;
                }

                if (Item.CreditsCost > 0)
                {
                    Session.GetHabbo().Credits -= Item.CreditsCost;
                    Session.GetHabbo().UpdateCreditsBalance();
                }

                ServerMessage PurchaseClub = new ServerMessage(67);
                //AC[mQHABBO_CLUB_VIP_1_MONTH{2}QFHHH{1}
                PurchaseClub.AppendUInt(Item.Id);
                PurchaseClub.AppendStringWithBreak(Item.Name);
                PurchaseClub.AppendInt32(Item.CreditsCost);
                PurchaseClub.AppendBoolean(true);
                PurchaseClub.AppendBoolean(false);
                PurchaseClub.AppendBoolean(false);
                Session.SendMessage(PurchaseClub);
                #endregion
                return;
            }

            if (Item.OudeCredits > 0)
            {
                int oudeCredits = 0;
                using (IQueryAdapter dbClient = PiciEnvironment.GetDatabaseManager().getQueryreactor())
                {
                    dbClient.setQuery("SELECT belcredits FROM users WHERE id = " + Session.GetHabbo().Id);
                    oudeCredits = dbClient.getInteger();
                }

                if (Item.OudeCredits > oudeCredits)
                {
                    Session.SendNotif(LanguageLocale.GetValue("catalog.oudebelcreditserror") + Item.OudeCredits);
                    return;
                }

                oudeCredits = oudeCredits - Item.OudeCredits;
                using (IQueryAdapter dbClient = PiciEnvironment.GetDatabaseManager().getQueryreactor())
                {
                    dbClient.runFastQuery("UPDATE users SET belcredits = " + oudeCredits + " WHERE id = " + Session.GetHabbo().Id);
                }

                Session.SendNotif(LanguageLocale.GetValue("catalog.oudebelcreditsok") + oudeCredits);
            }

            //Console.WriteLine(Item.GetBaseItem().ItemId);
            //Console.WriteLine(Item.GetBaseItem().InteractionType.ToLower());
            // Extra Data is _NOT_ filtered at this point and MUST BE VERIFIED BELOW:
            switch (Item.GetBaseItem().InteractionType)
            {
                case InteractionType.none:
                    ExtraData = "";
                    break;

                case InteractionType.musicdisc:
                    ExtraData = Item.songID.ToString();
                    break;

                #region Pet handling
                case InteractionType.pet0:
                case InteractionType.pet1:
                case InteractionType.pet2:
                case InteractionType.pet3:
                case InteractionType.pet4:
                case InteractionType.pet5:
                case InteractionType.pet6:
                case InteractionType.pet7:
                case InteractionType.pet8:
                case InteractionType.pet9:
                case InteractionType.pet10:
                case InteractionType.pet11:
                case InteractionType.pet12:
                case InteractionType.pet14:
                case InteractionType.pet15:
                    try
                    {

                        //uint count = 0;
                        //using (IQueryAdapter dbClient = ButterflyEnvironment.GetDatabaseManager().getQueryreactor())
                        //{
                        //    dbClient.setQuery("SELECT COUNT(*) FROM user_pets WHERE user_id = " + Session.GetHabbo().Id);
                        //    count = uint.Parse(dbClient.getString());
                        //}

                        //if (count > 5)
                        //{
                        //    Session.SendNotif(LanguageLocale.GetValue("catalog.pets.maxpets"));
                        //    return;
                        //}

                        string[] Bits = ExtraData.Split('\n');
                        string PetName = Bits[0];
                        string Race = Bits[1];
                        string Color = Bits[2];

                        int.Parse(Race); // to trigger any possible errors

                        if (!CheckPetName(PetName))
                            return;

                        if (Race.Length != 1)
                            return;

                        if (Color.Length != 6)
                            return;
                    }
                    catch (Exception e) {
                        //Logging.WriteLine(e.ToString());
                        Logging.HandleException(e, "Catalog.HandleRowchase");
                        return;
                    }

                    break;

                #endregion

                case InteractionType.roomeffect:

                    Double Number = 0;

                    try
                    {
                        if (string.IsNullOrEmpty(ExtraData))
                            Number = 0;
                        else
                            Number = Double.Parse(ExtraData, PiciEnvironment.cultureInfo);
                    }
                    catch (Exception e) { Logging.HandleException(e, "Catalog.HandleRowchase: " + ExtraData); }

                    ExtraData = Number.ToString().Replace(',', '.');
                    break; // maintain extra data // todo: validate

                case InteractionType.postit:
                    ExtraData = "FFFF33";
                    break;

                case InteractionType.dimmer:
                    ExtraData = "1,1,1,#000000,255";
                    break;

                case InteractionType.trophy:
                    ExtraData = Session.GetHabbo().Username + Convert.ToChar(9) + DateTime.Now.Day + "-" + DateTime.Now.Month + "-" + DateTime.Now.Year + Convert.ToChar(9) + PiciEnvironment.FilterInjectionChars(ExtraData, true);
                    break;

                default:
                    ExtraData = "";
                    break;
            }

            if (Item.CreditsCost > 0)
            {
                Session.GetHabbo().Credits -= Item.CreditsCost;
                Session.GetHabbo().UpdateCreditsBalance();
            }

            if (Item.PixelsCost > 0)
            {
                Session.GetHabbo().ActivityPoints -= Item.PixelsCost;
                Session.GetHabbo().UpdateActivityPointsBalance(true);
            }

            Session.GetMessageHandler().GetResponse().Init(101);
            Session.GetMessageHandler().SendResponse();

            Session.GetMessageHandler().GetResponse().Init(67);
            Session.GetMessageHandler().GetResponse().AppendUInt(Item.GetBaseItem().ItemId);
            Session.GetMessageHandler().GetResponse().AppendStringWithBreak(Item.GetBaseItem().Name);
            Session.GetMessageHandler().GetResponse().AppendInt32(Item.CreditsCost);
            Session.GetMessageHandler().GetResponse().AppendInt32(Item.PixelsCost);
            Session.GetMessageHandler().GetResponse().AppendInt32(0);
            Session.GetMessageHandler().GetResponse().AppendInt32(1);
            Session.GetMessageHandler().GetResponse().AppendStringWithBreak(Item.GetBaseItem().Type.ToString().ToLower());
            Session.GetMessageHandler().GetResponse().AppendInt32(Item.GetBaseItem().SpriteId);
            Session.GetMessageHandler().GetResponse().AppendStringWithBreak("");
            Session.GetMessageHandler().GetResponse().AppendInt32(1);
            Session.GetMessageHandler().GetResponse().AppendInt32(0);
            Session.GetMessageHandler().SendResponse();

            if (IsGift)
            {
                uint itemID;
                //uint GenId = GenerateItemId();
                Item Present = GeneratePresent();

                using (IQueryAdapter dbClient = PiciEnvironment.GetDatabaseManager().getQueryreactor())
                {
                    if (dbClient.dbType == DatabaseType.MSSQL)
                        dbClient.setQuery("INSERT INTO items (base_id) OUTPUT INSERTED.* VALUES (" + Present.ItemId + ")");
                    else
                        dbClient.setQuery("INSERT INTO items (base_id) VALUES (" + Present.ItemId + ")");
                    itemID = (uint)dbClient.insertQuery();

                    dbClient.runFastQuery("INSERT INTO items_users VALUES (" + itemID + "," + GiftUserId + ")");

                    if (!string.IsNullOrEmpty(GiftMessage))
                    {
                        dbClient.setQuery("INSERT INTO items_extradata VALUES (" + itemID + ",@data)");
                        dbClient.addParameter("data", GiftMessage);
                        dbClient.runQuery();
                    }

                    dbClient.setQuery("INSERT INTO user_presents (item_id,base_id,amount,extra_data) VALUES (" + itemID + "," + Item.GetBaseItem().ItemId + "," + Item.Amount + ",@extra_data)");
                    dbClient.addParameter("gift_message", "!" + GiftMessage);
                    dbClient.addParameter("extra_data", ExtraData);
                    dbClient.runQuery();
                }

                GameClient Receiver = PiciEnvironment.GetGame().GetClientManager().GetClientByUserID(GiftUserId);

                if (Receiver != null)
                {
                    Receiver.SendNotif(LanguageLocale.GetValue("catalog.gift.received") + Session.GetHabbo().Username);
                    Receiver.GetHabbo().GetInventoryComponent().AddNewItem(itemID, Present.ItemId, ExtraData, false, false, 0);
                    Receiver.GetHabbo().GetInventoryComponent().SendFloorInventoryUpdate();

                    InventoryComponent targetInventory = Receiver.GetHabbo().GetInventoryComponent();
                    if (targetInventory != null)
                        targetInventory.RunDBUpdate();
                }

                Session.SendNotif(LanguageLocale.GetValue("catalog.gift.sent"));
            }
            else
            {
                DeliverItems(Session, Item.GetBaseItem(), Item.Amount, ExtraData, Item.songID);
            }
        }
Ejemplo n.º 4
0
        internal void DeliverItems(GameClient Session, Item Item, int Amount, String ExtraData, uint songID = 0)
        {
            switch (Item.Type.ToString())
            {
                case "i":
                case "s":
                    for (int i = 0; i < Amount; i++)
                    {
                        //uint GeneratedId = GenerateItemId();
                        switch (Item.InteractionType)
                        {
                            case InteractionType.pet0:

                                string[] PetData = ExtraData.Split('\n');

                                Pet GeneratedPet = CreatePet(Session.GetHabbo().Id, PetData[0], 0, PetData[1], PetData[2]);

                                Session.GetHabbo().GetInventoryComponent().AddPet(GeneratedPet);
                                Session.GetHabbo().GetInventoryComponent().AddNewItem(0, 320, "0", true, false, 0);

                                break;

                            case InteractionType.pet1:

                                string[] PetData1 = ExtraData.Split('\n');

                                Pet GeneratedPet1 = CreatePet(Session.GetHabbo().Id, PetData1[0], 1, PetData1[1], PetData1[2]);

                                Session.GetHabbo().GetInventoryComponent().AddPet(GeneratedPet1);
                                Session.GetHabbo().GetInventoryComponent().AddNewItem(0, 320, "0", true, false, 0);

                                break;

                            case InteractionType.pet2:

                                string[] PetData5 = ExtraData.Split('\n');

                                Pet GeneratedPet5 = CreatePet(Session.GetHabbo().Id, PetData5[0], 2, PetData5[1], PetData5[2]);

                                Session.GetHabbo().GetInventoryComponent().AddPet(GeneratedPet5);
                                Session.GetHabbo().GetInventoryComponent().AddNewItem(0, 320, "0", true, false, 0);

                                break;

                            case InteractionType.pet3:

                                string[] PetData2 = ExtraData.Split('\n');

                                Pet GeneratedPet2 = CreatePet(Session.GetHabbo().Id, PetData2[0], 3, PetData2[1], PetData2[2]);

                                Session.GetHabbo().GetInventoryComponent().AddPet(GeneratedPet2);
                                Session.GetHabbo().GetInventoryComponent().AddNewItem(0, 320, "0", true, false, 0);

                                break;

                            case InteractionType.pet4:

                                string[] PetData3 = ExtraData.Split('\n');

                                Pet GeneratedPet3 = CreatePet(Session.GetHabbo().Id, PetData3[0], 4, PetData3[1], PetData3[2]);

                                Session.GetHabbo().GetInventoryComponent().AddPet(GeneratedPet3);
                                Session.GetHabbo().GetInventoryComponent().AddNewItem(0, 320, "0", true, false, 0);

                                break;

                            case InteractionType.pet5:

                                string[] PetData7 = ExtraData.Split('\n');

                                Pet GeneratedPet7 = CreatePet(Session.GetHabbo().Id, PetData7[0], 5, PetData7[1], PetData7[2]);

                                Session.GetHabbo().GetInventoryComponent().AddPet(GeneratedPet7);
                                Session.GetHabbo().GetInventoryComponent().AddNewItem(0, 320, "0", true, false, 0);

                                break;

                            case InteractionType.pet6:
                                string[] PetData4 = ExtraData.Split('\n');

                                Pet GeneratedPet4 = CreatePet(Session.GetHabbo().Id, PetData4[0], 6, PetData4[1], PetData4[2]);

                                Session.GetHabbo().GetInventoryComponent().AddPet(GeneratedPet4);
                                Session.GetHabbo().GetInventoryComponent().AddNewItem(0, 320, "0", true, false, 0);

                                break;

                            case InteractionType.pet7:

                                string[] PetData6 = ExtraData.Split('\n');

                                Pet GeneratedPet6 = CreatePet(Session.GetHabbo().Id, PetData6[0], 7, PetData6[1], PetData6[2]);

                                Session.GetHabbo().GetInventoryComponent().AddPet(GeneratedPet6);
                                Session.GetHabbo().GetInventoryComponent().AddNewItem(0, 320, "0", true, false, 0);

                                break;

                            case InteractionType.pet8:

                                string[] PetData8 = ExtraData.Split('\n');

                                Pet GeneratedPet8 = CreatePet(Session.GetHabbo().Id, PetData8[0], 8, PetData8[1], PetData8[2]);

                                Session.GetHabbo().GetInventoryComponent().AddPet(GeneratedPet8);
                                Session.GetHabbo().GetInventoryComponent().AddNewItem(0, 320, "0", true, false, 0);

                                break;

                            case InteractionType.pet9:

                                string[] PetData9 = ExtraData.Split('\n');

                                Pet GeneratedPet9 = CreatePet(Session.GetHabbo().Id, PetData9[0], 9, PetData9[1], PetData9[2]);

                                Session.GetHabbo().GetInventoryComponent().AddPet(GeneratedPet9);
                                Session.GetHabbo().GetInventoryComponent().AddNewItem(0, 320, "0", true, false, 0);

                                break;
                            case InteractionType.pet10:

                                string[] PetData10 = ExtraData.Split('\n');

                                Pet GeneratedPet10 = CreatePet(Session.GetHabbo().Id, PetData10[0], 10, PetData10[1], PetData10[2]);

                                Session.GetHabbo().GetInventoryComponent().AddPet(GeneratedPet10);
                                Session.GetHabbo().GetInventoryComponent().AddNewItem(0, 320, "0", true, false, 0);

                                break;
                            case InteractionType.pet11:

                                string[] PetData11 = ExtraData.Split('\n');

                                Pet GeneratedPet11 = CreatePet(Session.GetHabbo().Id, PetData11[0], 11, PetData11[1], PetData11[2]);

                                Session.GetHabbo().GetInventoryComponent().AddPet(GeneratedPet11);
                                Session.GetHabbo().GetInventoryComponent().AddNewItem(0, 320, "0", true, false, 0);

                                break;
                            case InteractionType.pet12:
                                string[] PetData12 = ExtraData.Split('\n');

                                Pet GeneratedPet12 = CreatePet(Session.GetHabbo().Id, PetData12[0], 12, PetData12[1], PetData12[2]);

                                Session.GetHabbo().GetInventoryComponent().AddPet(GeneratedPet12);
                                Session.GetHabbo().GetInventoryComponent().AddNewItem(0, 320, "0", true, false, 0);

                                break;
                            case InteractionType.pet14:
                                string[] PetData14 = ExtraData.Split('\n');

                                Pet GeneratedPet14 = CreatePet(Session.GetHabbo().Id, PetData14[0], 14, PetData14[1], PetData14[2]);

                                Session.GetHabbo().GetInventoryComponent().AddPet(GeneratedPet14);
                                Session.GetHabbo().GetInventoryComponent().AddNewItem(0, 320, "0", true, false, 0);

                                break;
                            case InteractionType.pet15:
                                string[] PetData15 = ExtraData.Split('\n');

                                Pet GeneratedPet15 = CreatePet(Session.GetHabbo().Id, PetData15[0], 15, PetData15[1], PetData15[2]);

                                Session.GetHabbo().GetInventoryComponent().AddPet(GeneratedPet15);
                                Session.GetHabbo().GetInventoryComponent().AddNewItem(0, 320, "0", true, false, 0);

                                break;
                            case InteractionType.teleport:

                                uint idOne = Session.GetHabbo().GetInventoryComponent().AddNewItem(0, Item.ItemId, "0", true, false, 0).Id;
                                uint idTwo = Session.GetHabbo().GetInventoryComponent().AddNewItem(0, Item.ItemId, "0", true, false, 0).Id;

                                using (IQueryAdapter dbClient = PiciEnvironment.GetDatabaseManager().getQueryreactor())
                                {
                                    dbClient.runFastQuery("INSERT INTO items_tele_links (tele_one_id,tele_two_id) VALUES (" + idOne + "," + idTwo + ")");
                                    dbClient.runFastQuery("INSERT INTO items_tele_links (tele_one_id,tele_two_id) VALUES (" + idTwo + "," + idOne + ")");
                                }

                                break;

                            case InteractionType.dimmer:

                                uint id = Session.GetHabbo().GetInventoryComponent().AddNewItem(0, Item.ItemId, ExtraData, true, false, 0).Id;
                                using (IQueryAdapter dbClient = PiciEnvironment.GetDatabaseManager().getQueryreactor())
                                {
                                    dbClient.runFastQuery("INSERT INTO items_moodlight (item_id,enabled,current_preset,preset_one,preset_two,preset_three) VALUES (" + id + ",0,1,'#000000,255,0','#000000,255,0','#000000,255,0')");
                                }

                                break;

                            case InteractionType.musicdisc:
                                {
                                    Session.GetHabbo().GetInventoryComponent().AddNewItem(0, Item.ItemId, songID.ToString(), true, false, songID);
                                    break;
                                }

                            default:

                                Session.GetHabbo().GetInventoryComponent().AddNewItem(0, Item.ItemId, ExtraData, true, false, songID);
                                break;
                        }
                    }

                    Session.GetHabbo().GetInventoryComponent().UpdateItems(false);
                    break;

                case "e":

                    for (int i = 0; i < Amount; i++)
                    {
                        Session.GetHabbo().GetAvatarEffectsInventoryComponent().AddEffect(Item.SpriteId, 3600);
                    }

                    break;

                case "h":

                    for (int i = 0; i < Amount; i++)
                    {
                        Session.GetHabbo().GetSubscriptionManager().AddOrExtendSubscription("habbo_club", 2678400);
                    }

                    if (!Session.GetHabbo().GetBadgeComponent().HasBadge("HC1"))
                    {
                        Session.GetHabbo().GetBadgeComponent().GiveBadge("HC1", true);
                    }

                    Session.GetMessageHandler().GetResponse().Init(7);
                    Session.GetMessageHandler().GetResponse().AppendStringWithBreak("habbo_club");

                    if (Session.GetHabbo().GetSubscriptionManager().HasSubscription("habbo_club"))
                    {
                        Double Expire = Session.GetHabbo().GetSubscriptionManager().GetSubscription("habbo_club").ExpireTime;
                        Double TimeLeft = Expire - PiciEnvironment.GetUnixTimestamp();
                        int TotalDaysLeft = (int)Math.Ceiling(TimeLeft / 86400);
                        int MonthsLeft = TotalDaysLeft / 31;

                        if (MonthsLeft >= 1) MonthsLeft--;

                        Session.GetMessageHandler().GetResponse().AppendInt32(TotalDaysLeft - (MonthsLeft * 31));
                        Session.GetMessageHandler().GetResponse().AppendBoolean(true);
                        Session.GetMessageHandler().GetResponse().AppendInt32(MonthsLeft);
                    }
                    else
                    {
                        for (int i = 0; i < 3; i++)
                        {
                            Session.GetMessageHandler().GetResponse().AppendInt32(0);
                        }
                    }

                    Session.GetMessageHandler().SendResponse();

                    //List<string> Rights = PiciEnvironment.GetGame().GetRoleManager().GetRightsForHabbo(Session.GetHabbo());

                    Session.GetMessageHandler().GetResponse().Init(2);
                    Session.GetMessageHandler().GetResponse().AppendInt32(2);

                    if (Session.GetHabbo().HasRight("acc_anyroomowner"))
                        Session.GetMessageHandler().GetResponse().AppendInt32(7);
                    else if (Session.GetHabbo().HasRight("acc_anyroomrights"))
                        Session.GetMessageHandler().GetResponse().AppendInt32(5);
                    else if (Session.GetHabbo().HasRight("acc_supporttool"))
                        Session.GetMessageHandler().GetResponse().AppendInt32(4);
                    else
                        Session.GetMessageHandler().GetResponse().AppendInt32(0);

                    Session.GetMessageHandler().SendResponse();
                    PiciEnvironment.GetGame().GetAchievementManager().ProgressUserAchievement(Session, "ACH_BasicClub", 1); //ACH_VipClub
                    break;

                default:

                    Session.SendNotif(LanguageLocale.GetValue("catalog.buyerror"));
                    break;
            }
        }