예제 #1
0
        public override void UseItem(CharacterEntity sender)
        {
            if (sender.ItemsInUse.Any(item => ReferenceEquals(item, this)))
            {
                sender.ItemsInUse.Remove(this);
                DbModel.ItemInUse = false;

                ClothesFactory.ChangeClothes(sender, ComponentId, 0, 0);

                switch (ComponentId)
                {
                case (int)ClothesType.Legs: ClothesFactory.ChangeClothes(sender, ComponentId, 21, 0);
                    break;

                case (int)ClothesType.Shoes: ClothesFactory.ChangeClothes(sender, ComponentId, 34, 0);
                    break;

                case (int)ClothesType.Undershirt:
                    ClothesFactory.ChangeClothes(sender, ComponentId, 15, 0);
                    ClothesFactory.ChangeClothes(sender, (int)ClothesType.Torso, 15, 0);
                    break;

                case (int)ClothesType.Top:
                    ClothesFactory.ChangeClothes(sender, ComponentId, 15, 0);
                    ClothesFactory.ChangeClothes(sender, (int)ClothesType.Torso, 15, 0);
                    break;

                default:
                    break;
                }
                sender.AccountEntity.Player.Emit("item:takeOffClothes", ComponentId);
            }
            else
            {
                Alt.Log("componentID: " + ComponentId);
                // Zapobiega to niewidzialnej klatce piersiowej, jak się zrobi eup z kaburą to raczej będzie to już niepotrzebne
                if (ComponentId == (int)ClothesType.Undershirt && sender.ItemsInUse.Any(item => item.ItemEntityType == ItemEntityType.WeaponHolster))
                {
                    sender.AccountEntity.Player.SendNativeNotify(null, NotificationNativeType.Error, 1, "Masz założoną kaburę", "~g~ Ekwipunek", "Nie możesz założyć podkoszulka podczas gdy nosisz na sobie kaburę, zdejmij kaburę");
                    return;
                }


                sender.ItemsInUse.Add(this);
                DbModel.ItemInUse = true;

                ClothesFactory.ChangeClothes(sender, ComponentId, DrawableId, TextureId);

                sender.AccountEntity.Player.Emit("item:equipClothes", ComponentId, DrawableId, TextureId, sender.DbModel.CharacterLook.TorsoId, sender.DbModel.CharacterLook.TorsoTexture);
            }
        }
예제 #2
0
        public override void UseItem(CharacterEntity sender)
        {
            if (sender.ItemsInUse.Any(item => ReferenceEquals(item, this)))
            {
                DbModel.ItemInUse = false;
                ClothesFactory.ChangeClothes(sender, (int)ClothesType.Undershirt, 15, 0);
                Save();

                sender.AccountEntity.Player.Emit("item:weaponHolsterHide", DbModel.Character.CharacterLook.UndershirtId, DbModel.Character.CharacterLook.UndershirtTexture);
                sender.ItemsInUse.Remove(this);
            }
            else
            {
                ClothesFactory.ChangeClothes(sender, (int)ClothesType.Undershirt, GunHolsterObject, 0);

                DbModel.ItemInUse = true;
                sender.AccountEntity.Player.Emit("item:weaponHolsterTakeOut", GunHolsterObject);
                sender.ItemsInUse.Add(this);
            }
        }