Example #1
0
 public void CopyFrom(ItemStackViewModel other)
 {
     this.ItemId = other.itemId;
     this.Size   = other.size;
     this.Damage = other.damage;
     this.NBT    = other.nbt;
 }
 public void CopyFrom(ItemStackViewModel other)
 {
     this.ItemId = other.itemId;
     this.Size = other.size;
     this.Damage = other.damage;
     this.NBT = other.nbt;
 }
        private void EditIcon()
        {
            this.Quest.Icon = this.Quest.Icon ?? new ItemStackViewModel();

            ItemStackViewModel itemStack = new ItemStackViewModel();
            itemStack.CopyFrom(this.Quest.Icon);

            EditItemStackMessage message = new EditItemStackMessage { ItemStack = itemStack };
            this.MessengerInstance.Send(message);
            if (!message.Accepted)
            {
                return;
            }

            this.Quest.Icon.CopyFrom(message.ItemStack);
        }
Example #4
0
        private void EditIcon()
        {
            this.Quest.Icon = this.Quest.Icon ?? new ItemStackViewModel();

            ItemStackViewModel itemStack = new ItemStackViewModel();

            itemStack.CopyFrom(this.Quest.Icon);

            EditItemStackMessage message = new EditItemStackMessage {
                ItemStack = itemStack
            };

            this.MessengerInstance.Send(message);
            if (!message.Accepted)
            {
                return;
            }

            this.Quest.Icon.CopyFrom(message.ItemStack);
        }
Example #5
0
        internal static ItemStackViewModel ItemStackToItemStackViewModel(ItemStack itemStack)
        {
            if (itemStack == null)
            {
                return(null);
            }

            ItemStackViewModel result = new ItemStackViewModel
            {
                ItemId = itemStack.ItemId,
                Damage = itemStack.Damage,
                Size   = itemStack.Size
            };

            if (itemStack?.NBT?.OriginalData != null)
            {
                result.NBT = Convert.ToBase64String(itemStack.NBT.OriginalData);
            }

            return(result);
        }
Example #6
0
        internal static ItemStack ItemStackViewModelToItemStack(ItemStackViewModel itemStack)
        {
            if (itemStack == null)
            {
                return null;
            }

            ItemStack result = new ItemStack
            {
                ItemId = itemStack.ItemId,
                Damage = itemStack.Damage,
                Size = itemStack.Size
            };

            if (!String.IsNullOrEmpty(itemStack.NBT))
            {
                result.NBT = new NbtWrapper { OriginalData = Convert.FromBase64String(itemStack.NBT) };
            }

            return result;
        }
Example #7
0
        internal static ItemStackViewModel ItemStackToItemStackViewModel(ItemStack itemStack)
        {
            if (itemStack == null)
            {
                return null;
            }

            ItemStackViewModel result = new ItemStackViewModel
            {
                ItemId = itemStack.ItemId,
                Damage = itemStack.Damage,
                Size = itemStack.Size
            };

            if (itemStack?.NBT?.OriginalData != null)
            {
                result.NBT = Convert.ToBase64String(itemStack.NBT.OriginalData);
            }

            return result;
        }
Example #8
0
        internal static ItemStack ItemStackViewModelToItemStack(ItemStackViewModel itemStack)
        {
            if (itemStack == null)
            {
                return(null);
            }

            ItemStack result = new ItemStack
            {
                ItemId = itemStack.ItemId,
                Damage = itemStack.Damage,
                Size   = itemStack.Size
            };

            if (!String.IsNullOrEmpty(itemStack.NBT))
            {
                result.NBT = new NbtWrapper {
                    OriginalData = Convert.FromBase64String(itemStack.NBT)
                };
            }

            return(result);
        }
Example #9
0
 public EditItemStackViewModel(ItemStackViewModel itemStack)
 {
     this.ItemStack = itemStack.ValidateNotNull(nameof(itemStack));
 }
 public EditItemStackWindow(ItemStackViewModel itemStack)
 {
     this.ViewModel = new EditItemStackViewModel(itemStack.ValidateNotNull(nameof(itemStack)));
     this.InitializeComponent();
 }
 public EditItemStackViewModel(ItemStackViewModel itemStack)
 {
     this.ItemStack = itemStack.ValidateNotNull(nameof(itemStack));
 }