Exemple #1
0
    public void Toggle(ClothingItem item)
    {
        var slot = GetSlot(item); // find a slot corresponding to the item
        if (slot.Value == item) // if item is equipped
        {
            slot.Value = null; // remove it from slot
            Backpack.Add(item); // and put to backpack
        }
        else // otherwise if item is not equipped
        {
            if (slot.Value != null)
                Backpack.Add(slot.Value); // clear the slot if it was used

            Backpack.Remove(item); // take item from backpack
            slot.Value = item; // and put to the slot
        }
    }
Exemple #2
0
 private EZData.VariableContext<ClothingItem> GetSlot(ClothingItem item)
 {
     switch(item.Slot)
     {
     case Slot.Shoulders: return ShouldersEzVariableContext;
     case Slot.Bracers: return BracersEzVariableContext;
     case Slot.Boots: return BootsEzVariableContext;
     }
     return null;
 }
Exemple #3
0
    public void Add(ClothingItem item)
    {
        item.OnToggle += Toggle;

        Backpack.Add(item);
    }
Exemple #4
0
    public void Remove(ClothingItem item)
    {
        Backpack.Remove(item);

        var slot = GetSlot(item);
        if (slot.Value == item)
            slot.Value = null;

        item.OnToggle -= Toggle;
    }
    public void removeClothing(ClothingItem ci)
    {
        if (clothesBeingWorn.Contains(ci) == false)
        {
            return;
        }


        if (ci.head == null)
        {
        }
        else
        {
            aac.head = transform.root.GetComponentInChildren <HeadController>().defaultHead;
        }

        if (ci.torso == null)
        {
        }
        else
        {
            aac.torso   = CommonObjectsStore.me.defaultClothes.torso;
            aac.torFall = CommonObjectsStore.me.defaultClothes.torFall;
        }

        if (ci.lShoulder == null)
        {
        }
        else
        {
            aac.lShoulder = CommonObjectsStore.me.defaultClothes.lShoulder;
        }

        if (ci.rShoulder == null)
        {
        }
        else
        {
            aac.rShoulder = CommonObjectsStore.me.defaultClothes.rShoulder;
        }

        if (ci.lFore == null)
        {
        }
        else
        {
            aac.lFore = CommonObjectsStore.me.defaultClothes.lFore;
        }

        if (ci.rFore == null)
        {
        }
        else
        {
            aac.rFore = CommonObjectsStore.me.defaultClothes.rFore;
        }

        if (ci.lHandFist == null)
        {
        }
        else
        {
            aac.lHandFist    = CommonObjectsStore.me.defaultClothes.lHandFist;
            aac.lHandHold    = CommonObjectsStore.me.defaultClothes.lHandHold;
            aac.lHandTrigger = CommonObjectsStore.me.defaultClothes.lHandTrigger;
        }

        if (ci.rHandFist == null)
        {
        }
        else
        {
            aac.rHandFist    = CommonObjectsStore.me.defaultClothes.rHandFist;
            aac.rHandHold    = CommonObjectsStore.me.defaultClothes.rHandHold;
            aac.rHandTrigger = CommonObjectsStore.me.defaultClothes.rHandTrigger;
        }

        if (ci.lCalf == null)
        {
        }
        else
        {
            aac.lCalf  = CommonObjectsStore.me.defaultClothes.lCalf;
            aac.lThigh = CommonObjectsStore.me.defaultClothes.lThigh;
        }

        if (ci.rCalf == null)
        {
        }
        else
        {
            aac.rCalf  = CommonObjectsStore.me.defaultClothes.rCalf;
            aac.rThigh = CommonObjectsStore.me.defaultClothes.rThigh;
        }

        if (ci.lFoot == null)
        {
        }
        else
        {
            aac.lFoot = CommonObjectsStore.me.defaultClothes.lFoot;
        }

        if (ci.rFoot == null)
        {
        }
        else
        {
            aac.rFoot = CommonObjectsStore.me.defaultClothes.rFoot;
        }

        aac.setAesthetics();
        ci.inUse = false;
        //ci.unequipItem ();
        clothesBeingWorn.Remove(ci);
    }
    public void equipClothing(ClothingItem ci)
    {
        removeConflictingClothing(ci);

        if (ci.head == null)
        {
        }
        else
        {
            aac.head = ci.head;
        }

        if (ci.torso == null)
        {
        }
        else
        {
            aac.torso   = ci.torso;
            aac.torFall = ci.torFall;
        }

        if (ci.lShoulder == null)
        {
        }
        else
        {
            aac.lShoulder = ci.lShoulder;
        }

        if (ci.rShoulder == null)
        {
        }
        else
        {
            aac.rShoulder = ci.rShoulder;
        }

        if (ci.lFore == null)
        {
        }
        else
        {
            aac.lFore = ci.lFore;
        }

        if (ci.rFore == null)
        {
        }
        else
        {
            aac.rFore = ci.rFore;
        }

        if (ci.lHandFist == null)
        {
        }
        else
        {
            aac.lHandFist    = ci.lHandFist;
            aac.lHandHold    = ci.lHandHold;
            aac.lHandTrigger = ci.lHandTrigger;
        }

        if (ci.rHandFist == null)
        {
        }
        else
        {
            aac.rHandFist    = ci.rHandFist;
            aac.rHandHold    = ci.rHandHold;
            aac.rHandTrigger = ci.rHandTrigger;
        }

        if (ci.lCalf == null)
        {
        }
        else
        {
            aac.lCalf  = ci.lCalf;
            aac.lThigh = ci.lThigh;
        }

        if (ci.rCalf == null)
        {
        }
        else
        {
            aac.rCalf  = ci.rCalf;
            aac.rThigh = ci.rThigh;
        }

        if (ci.lFoot == null)
        {
        }
        else
        {
            aac.lFoot = ci.lFoot;
        }

        if (ci.rFoot == null)
        {
        }
        else
        {
            aac.rFoot = ci.rFoot;
        }

        aac.setAesthetics();
        ci.inUse = true;
        clothesBeingWorn.Add(ci);
    }
Exemple #7
0
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            if (Session == null || Session.GetHabbo() == null || !Session.GetHabbo().InRoom)
            {
                return;
            }

            Room Room = Session.GetHabbo().CurrentRoom;

            if (Room == null)
            {
                return;
            }

            int ItemId = Packet.PopInt();

            Item Item = Room.GetRoomItemHandler().GetItem(ItemId);

            if (Item == null)
            {
                return;
            }

            if (Item.Data == null)
            {
                return;
            }

            if (Item.UserID != Session.GetHabbo().Id)
            {
                return;
            }

            if (Item.Data.InteractionType != InteractionType.PURCHASABLE_CLOTHING)
            {
                Session.SendNotification("Oops, this item isn't set as a sellable clothing item!");
                return;
            }

            if (Item.Data.ClothingId == 0)
            {
                Session.SendNotification("Oops, this item doesn't have a linking clothing configuration, please report it!");
                return;
            }

            ClothingItem Clothing = null;

            if (!RocketEmulador.GetGame().GetCatalog().GetClothingManager().TryGetClothing(Item.Data.ClothingId, out Clothing))
            {
                Session.SendNotification("Oops, we couldn't find this clothing part!");
                return;
            }

            //Quickly delete it from the database.
            using (IQueryAdapter dbClient = RocketEmulador.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("DELETE FROM `items` WHERE `id` = @ItemId LIMIT 1");
                dbClient.AddParameter("ItemId", Item.Id);
                dbClient.RunQuery();
            }

            //Remove the item.
            Room.GetRoomItemHandler().RemoveFurniture(Session, Item.Id);

            Session.GetHabbo().GetClothing().AddClothing(Clothing.ClothingName, Clothing.PartIds);
            Session.SendMessage(new FigureSetIdsComposer(Session.GetHabbo().GetClothing().GetClothingAllParts));
            Session.SendMessage(new RoomNotificationComposer("figureset.redeemed.success"));
            Session.SendNotification("If for some reason cannot see your new clothing, reload the hotel!");
        }
    public void SetVariation(int variation, int hair, List <int> clothingItemIdList)
    {
        Material[] tShirtClean = null;
        Material[] tShirtRed   = null;
        Mesh       hatMesh     = null;

        Material[]             hatClean = null;
        Material[]             hatRed   = null;
        ClothingItem.BoneGroup index    = ClothingItem.BoneGroup.Tops;
        Mesh topMesh = null;

        Material[] array     = null;
        Material[] topRed    = null;
        Mesh       pantsMesh = null;

        Material[]  pantsClean = null;
        Material[]  pantsRed   = null;
        bool        flag       = false;
        BodyOptions tshirt     = BodyOptions.Default;
        BodyOptions arms       = BodyOptions.Default;
        BodyOptions pants      = BodyOptions.Default;
        BodyOptions shoes      = BodyOptions.Default;

        this._activeVariationIndex = variation;
        for (int i = 0; i < this.Variations.Length; i++)
        {
            if (i != this._activeVariationIndex)
            {
                this.Variations[i].Toggle(false);
            }
        }
        for (int j = clothingItemIdList.Count - 1; j >= 0; j--)
        {
            if (clothingItemIdList[j] <= 0)
            {
                tshirt = BodyOptions.None;
                arms   = BodyOptions.JustHands;
                pants  = BodyOptions.None;
            }
            else
            {
                ClothingItem clothingItem = ClothingItemDatabase.ClothingItemById(clothingItemIdList[j]);
                if (clothingItem._displayType == ClothingItem.DisplayTypes.FullBody)
                {
                    tshirt    = BodyOptions.None;
                    arms      = BodyOptions.JustHands;
                    pants     = BodyOptions.None;
                    shoes     = BodyOptions.None;
                    index     = clothingItem._boneGroup;
                    topMesh   = clothingItem._meshLods[0];
                    array     = this.GetMaterials(clothingItem);
                    topRed    = ((clothingItem._materialsRed == null || clothingItem._materialsRed.Length <= 0) ? array : clothingItem._materialsRed);
                    pantsMesh = null;
                }
                else if (clothingItem._displayType == ClothingItem.DisplayTypes.Pants)
                {
                    pantsMesh  = clothingItem._meshLods[0];
                    pantsClean = this.GetMaterials(clothingItem);
                    pantsRed   = clothingItem._materialsRed;
                }
                else if (clothingItem._displayType == ClothingItem.DisplayTypes.TShirt)
                {
                    tShirtClean = this.GetMaterials(clothingItem);
                    tShirtRed   = clothingItem._materialsRed;
                }
                else if (clothingItem._displayType == ClothingItem.DisplayTypes.Hat)
                {
                    if (this.AllowHats())
                    {
                        hatMesh  = clothingItem._meshLods[0];
                        hatClean = this.GetMaterials(clothingItem);
                        hatRed   = clothingItem._materialsRed;
                        flag     = true;
                    }
                }
                else
                {
                    index   = clothingItem._boneGroup;
                    topMesh = clothingItem._meshLods[0];
                    array   = this.GetMaterials(clothingItem);
                    topRed  = ((clothingItem._materialsRed == null || clothingItem._materialsRed.Length <= 0) ? array : clothingItem._materialsRed);
                    switch (clothingItem._displayType)
                    {
                    case ClothingItem.DisplayTypes.TopPartial_Hands:
                        tshirt = BodyOptions.NoArms;
                        arms   = BodyOptions.JustHands;
                        break;

                    case ClothingItem.DisplayTypes.TopPartial_Arms:
                        tshirt = BodyOptions.Default;
                        arms   = BodyOptions.Default;
                        break;

                    case ClothingItem.DisplayTypes.TopFull_Hands:
                        tshirt = BodyOptions.None;
                        arms   = BodyOptions.JustHands;
                        break;

                    case ClothingItem.DisplayTypes.TopFull_Arms:
                        tshirt = BodyOptions.None;
                        arms   = BodyOptions.Default;
                        break;
                    }
                }
                if (clothingItem._hidePants)
                {
                    pants = BodyOptions.None;
                }
                if (clothingItem._hideShoes)
                {
                    shoes = BodyOptions.None;
                }
            }
        }
        this.ActiveVariation.Toggle(true);
        this.ActiveVariation.SetMeshes(hatMesh, topMesh, this.BoneGroups[(int)index].Bones, pantsMesh);
        this.ActiveVariation.SetMaterials(hatClean, hatRed, array, topRed, tShirtClean, tShirtRed, pantsClean, pantsRed);
        this.ActiveVariation.SetBodyOptions(tshirt, arms, pants, shoes);
        this.ActiveVariation.SetHair((!flag) ? hair : -1);
    }
 public void Post([FromBody] ClothingItem value)
 {
     _service.AddLocation(value);
 }
 public void Put(Guid id, [FromBody] ClothingItem value)
 {
     _service.UpdateClothingItem(id, value);
 }
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            if (Session == null || Session.GetHabbo() == null || !Session.GetHabbo().InRoom)
            {
                return;
            }

            Room Room = Session.GetHabbo().CurrentRoom;

            if (Room == null)
            {
                return;
            }

            int ItemId = Packet.PopInt();

            Item Item = Room.GetRoomItemHandler().GetItem(ItemId);

            if (Item == null)
            {
                return;
            }

            if (Item.Data == null)
            {
                return;
            }

            if (Item.UserID != Session.GetHabbo().Id)
            {
                return;
            }

            if (Item.Data.InteractionType != InteractionType.PURCHASABLE_CLOTHING)
            {
                Session.SendNotification("Oeps! Dit kledingstuk is niet te koop.");
                return;
            }

            if (Item.Data.ClothingId == 0)
            {
                Session.SendNotification("Oeps! Dit item is niet ingesteld als een kledingstuk.");
                return;
            }

            ClothingItem Clothing = null;

            if (!QuasarEnvironment.GetGame().GetCatalog().GetClothingManager().TryGetClothing(Item.Data.ClothingId, out Clothing))
            {
                Session.SendNotification("Oeps! Dit kledingstuk kan helaas niet worden gevonden.");
                return;
            }

            //Quickly delete it from the database.
            using (IQueryAdapter dbClient = QuasarEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("DELETE FROM `items` WHERE `id` = @ItemId LIMIT 1");
                dbClient.AddParameter("ItemId", Item.Id);
                dbClient.RunQuery();
            }

            //Remove the item.
            Room.GetRoomItemHandler().RemoveFurniture(Session, Item.Id);

            Session.GetHabbo().GetClothing().AddClothing(Clothing.ClothingName, Clothing.PartIds);
            Session.SendMessage(new FigureSetIdsComposer(Session.GetHabbo().GetClothing().GetClothingAllParts));
            Session.SendMessage(new RoomNotificationComposer("figureset.redeemed.success"));
            Session.SendWhisper("Wanneer het kledij niet volledig correct zichbaar is kan het helpen om het hotel even te herladen!");
        }
 public void resetGearSlot()
 {
     itemImage.sprite = null;
     itemImage.color  = Color.clear;
     itemEquiped      = null;
 }
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            if (Session == null || Session.GetHabbo() == null || !Session.GetHabbo().InRoom)
            {
                return;
            }

            Room Room = Session.GetHabbo().CurrentRoom;

            if (Room == null)
            {
                return;
            }

            int ItemId = Packet.PopInt();

            Item Item = Room.GetRoomItemHandler().GetItem(ItemId);

            if (Item == null)
            {
                return;
            }

            if (Item.Data == null)
            {
                return;
            }

            if (Item.UserID != Session.GetHabbo().Id)
            {
                return;
            }

            if (Item.Data.InteractionType != InteractionType.PURCHASABLE_CLOTHING)
            {
                Session.SendNotification("Ops, deu ruim ae em, chama um staff!");
                return;
            }

            if (Item.Data.BehaviourData == 0)
            {
                Session.SendNotification("Ops, este artigo não tem nenhuma configurações de roupa, por favor informe!");
                return;
            }

            ClothingItem Clothing = null;

            if (!BiosEmuThiago.GetGame().GetCatalog().GetClothingManager().TryGetClothing(Item.Data.ClothingId, out Clothing))
            {
                Session.SendNotification("Ops! essa parte da roupa não foi encontrada!");
                return;
            }

            //Quickly delete it from the database.
            using (IQueryAdapter dbClient = BiosEmuThiago.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("DELETE FROM `items` WHERE `id` = @ItemId LIMIT 1");
                dbClient.AddParameter("ItemId", Item.Id);
                dbClient.RunQuery();
            }

            //Remove the item.
            Room.GetRoomItemHandler().RemoveFurniture(Session, Item.Id);

            Session.GetHabbo().GetClothing().AddClothing(Clothing.ClothingName, Clothing.PartIds);
            Session.SendMessage(new FigureSetIdsComposer(Session.GetHabbo().GetClothing().GetClothingParts));
            Session.SendMessage(new RoomNotificationComposer("figureset.redeemed.success"));
            Session.SendWhisper("Por algum motivo você não pode ver as suas roupas novas, tente novamente!");
        }
Exemple #14
0
        public void Parse(GameClient session, ClientPacket packet)
        {
            if (session == null || session.GetHabbo() == null || !session.GetHabbo().InRoom)
            {
                return;
            }

            var room = session.GetHabbo().CurrentRoom;

            if (room == null)
            {
                return;
            }

            var itemId = packet.PopInt();

            var item = room.GetRoomItemHandler().GetItem(itemId);

            if (item == null)
            {
                return;
            }

            if (item.Data == null)
            {
                return;
            }

            if (item.UserId != session.GetHabbo().Id)
            {
                return;
            }

            if (item.Data.InteractionType != InteractionType.PurchasableClothing)
            {
                session.SendNotification("Oops, this item isn't set as a sellable clothing item!");
                return;
            }

            if (item.Data.BehaviourData == 0)
            {
                session.SendNotification("Oops, this item doesn't have a linking clothing configuration, please report it!");
                return;
            }

            ClothingItem clothing = null;

            if (!PlusEnvironment.GetGame().GetCatalog().GetClothingManager().TryGetClothing(item.Data.BehaviourData, out clothing))
            {
                session.SendNotification("Oops, we couldn't find this clothing part!");
                return;
            }

            //Quickly delete it from the database.
            using (var dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("DELETE FROM `items` WHERE `id` = @ItemId LIMIT 1");
                dbClient.AddParameter("ItemId", item.Id);
                dbClient.RunQuery();
            }

            //Remove the item.
            room.GetRoomItemHandler().RemoveFurniture(session, item.Id);

            session.GetHabbo().GetClothing().AddClothing(clothing.ClothingName, clothing.PartIds);
            session.SendPacket(new FigureSetIdsComposer(session.GetHabbo().GetClothing().GetClothingParts));
            session.SendPacket(new RoomNotificationComposer("figureset.redeemed.success"));
            session.SendWhisper("If for some reason cannot see your new clothing, reload the hotel!");
        }
Exemple #15
0
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            if (Session == null || Session.GetHabbo() == null || Session.GetRoleplay() == null || !Session.GetHabbo().InRoom)
            {
                return;
            }

            Room Room = Session.GetHabbo().CurrentRoom;

            if (Room == null)
            {
                return;
            }

            int ItemId = Packet.PopInt();

            Item Item = Room.GetRoomItemHandler().GetItem(ItemId);

            if (Item == null)
            {
                Session.GetRoleplay().PurchasingClothing = true;
                return;
            }

            if (Item.Data == null)
            {
                Session.GetRoleplay().PurchasingClothing = true;
                return;
            }

            if (Item.Data.InteractionType != InteractionType.PURCHASABLE_CLOTHING)
            {
                Session.SendNotification("Opa, este item não está configurado como um item de roupa!");
                Session.GetRoleplay().PurchasingClothing = true;
                return;
            }

            if (Item.Data.ClothingId == 0)
            {
                Session.SendNotification("Opa, este item não tem uma configuração de roupa de ligação, por favor, informe à Equipe!");
                Session.GetRoleplay().PurchasingClothing = true;
                return;
            }

            ClothingItem Clothing = null;

            if (!PlusEnvironment.GetGame().GetCatalog().GetClothingManager().TryGetClothing(Item.Data.ClothingId, out Clothing))
            {
                Session.SendNotification("Opa, não conseguimos encontrar esta peça de roupa!");
                Session.GetRoleplay().PurchasingClothing = true;
                return;
            }

            if (Session.GetRoleplay().PurchasingClothing)
            {
                return;
            }

            if (Session.GetRoleplay().Clothing != Clothing)
            {
                string Discount = "";
                if (Session.GetRoleplay().OfferManager.ActiveOffers.ContainsKey("clothing"))
                {
                    int Bonus   = Convert.ToInt32((double)Clothing.Cost * 0.01);
                    int NewCost = Clothing.Cost - Bonus;

                    Discount = " (R$" + String.Format("{0:N0}", NewCost) + " devido ao desconto de roupa de 5%)";
                }

                Session.SendWhisper("Essa roupa vai custar R$" + String.Format("{0:N0}", Clothing.Cost) + "" + (Discount == null ? "" : Discount) + "! Clique em 'Comprar Roupa' se você realmente quer comprar!", 1);
                Session.GetRoleplay().Clothing           = Clothing;
                Session.GetRoleplay().PurchasingClothing = true;
                return;
            }

            if (Session.GetHabbo().Credits < Clothing.Cost)
            {
                Session.SendWhisper("Desculpe, você não tem dinheiro suficiente para comprar esta roupa!", 1);
                Session.GetRoleplay().PurchasingClothing = true;
                return;
            }

            Session.GetRoleplay().Clothing = null;
            Session.GetHabbo().GetClothing().AddClothing(Clothing.ClothingName, Clothing.PartIds);
            Session.SendMessage(new FigureSetIdsComposer(Session.GetHabbo().GetClothing().GetClothingAllParts));
            Session.Shout("*Comprou " + Item.GetBaseItem().PublicName + " por R$" + String.Format("{0:N0}", Clothing.Cost) + "*", 4);
            //Session.SendMessage(new RoomNotificationComposer("figureset.redeemed.success"));
            Session.SendMessage(new RoomNotificationComposer("purchased_clothing", "message", "Ual! Você comprou com sucesso o '" + Item.GetBaseItem().PublicName + "' por R$" + String.Format("{0:N0}", Clothing.Cost) + "!"));
            Session.SendWhisper("Se, por algum motivo, não puder ver sua nova roupa, recarregue o RP!", 1);

            #region Clothing Discount Check
            if (Session.GetRoleplay().OfferManager.ActiveOffers.ContainsKey("clothing"))
            {
                if (Clothing.Cost > 0)
                {
                    RoleplayOffer Offer = Session.GetRoleplay().OfferManager.ActiveOffers["clothing"];
                    int           Bonus = Convert.ToInt32((double)Clothing.Cost * 0.05);

                    if (Offer.Params == null)
                    {
                        var Offerer = PlusEnvironment.GetGame().GetClientManager().GetClientByUserID(Offer.OffererId);

                        if (Offerer != null && Offerer.GetHabbo() != null)
                        {
                            Offerer.GetHabbo().Credits += Bonus;
                            Offerer.GetHabbo().UpdateCreditsBalance();
                            Offerer.SendWhisper("Você recebeu um bônus de R$" + String.Format("{0:N0}", Bonus) + ", " + Session.GetHabbo().Username + " quando comprou " + Item.GetBaseItem().PublicName + "!", 1);
                            PlusEnvironment.GetGame().GetAchievementManager().ProgressAchievement(Offerer, "ACH_Discounting", 1);
                        }
                    }

                    RoleplayOffer Junk;
                    Session.GetRoleplay().OfferManager.ActiveOffers.TryRemove("clothing", out Junk);

                    int NewCost = Clothing.Cost - Bonus;

                    if (NewCost > 0)
                    {
                        Session.GetHabbo().Credits -= NewCost;
                        Session.GetHabbo().UpdateCreditsBalance();
                    }
                    return;
                }
                else
                {
                    Session.SendWhisper("Você ainda tem o desconto para a próxima vez que você comprar um item de vestuário!", 1);
                    return;
                }
            }
            else
            {
                if (Clothing.Cost > 0)
                {
                    Session.GetHabbo().Credits -= Clothing.Cost;
                    Session.GetHabbo().UpdateCreditsBalance();
                }
            }
            #endregion

            return;
        }