Example #1
0
        public sealed override string ToString()
        {
            var value = new ChatLinkStruct();
            var length = this.CopyTo(value);
            var bytes = new byte[Size];
            var ptr = Marshal.AllocHGlobal(Size);
            try
            {
                Marshal.StructureToPtr(value, ptr, false);
                Marshal.Copy(ptr, bytes, 0, Size);
            }
            finally
            {
                Marshal.FreeHGlobal(ptr);
            }

            return string.Format("[&{0}]", Convert.ToBase64String(bytes, 0, length));
        }
Example #2
0
        protected override int CopyTo(ChatLinkStruct value)
        {
            value.header = Header.Item;
            value.item.count = (byte)this.Quantity;
            value.item.itemId = new UInt24((uint)this.ItemId);
            var modifiers = new Queue<int>(3);
            if (this.SkinId.HasValue)
            {
                modifiers.Enqueue(this.SkinId.Value);
                value.item.Modifiers |= ItemModifiers.Skin;
            }

            if (this.SuffixItemId.HasValue)
            {
                modifiers.Enqueue(this.SuffixItemId.Value);
                value.item.Modifiers |= ItemModifiers.SuffixItem;
            }

            if (this.SecondarySuffixItemId.HasValue)
            {
                modifiers.Enqueue(this.SecondarySuffixItemId.Value);
                value.item.Modifiers |= ItemModifiers.SecondarySuffixItem;
            }

            if (modifiers.Count == 0)
            {
                return 6;
            }

            value.item.modifier1 = modifiers.Dequeue();
            if (modifiers.Count == 0)
            {
                return 10;
            }

            value.item.modifier2 = modifiers.Dequeue();
            if (modifiers.Count == 0)
        {
                return 14;
            }

            value.item.modifier3 = modifiers.Dequeue();
            return 18;
        }
Example #3
0
 protected override int CopyTo(ChatLinkStruct value)
 {
     value.header = Header.Text;
     value.text.dialogId = this.DialogId;
     return 5;
 }
Example #4
0
 protected override int CopyTo(ChatLinkStruct value)
 {
     value.header = Header.Skin;
     value.skin.skinId = this.SkinId;
     return 5;
 }
Example #5
0
 protected override int CopyTo(ChatLinkStruct value)
 {
     value.header = Header.Coin;
     value.coin.count = this.Quantity;
     return 5;
 }
Example #6
0
 protected override int CopyTo(ChatLinkStruct value)
 {
     value.header = Header.Recipe;
     value.recipe.recipeId = this.RecipeId;
     return 5;
 }
Example #7
0
 protected override int CopyTo(ChatLinkStruct value)
 {
     value.header = Header.Trait;
     value.trait.traitId = this.TraitId;
     return 5;
 }
Example #8
0
 /// <summary>Copies the current instance to a data structure for serialization. A return value indicates the number of bytes copied.</summary>
 /// <param name="value">An object to copy values to.</param>
 /// <returns>The number of significant bytes in the data structure after copying.</returns>
 protected abstract int CopyTo(ChatLinkStruct value);
Example #9
0
 protected override int CopyTo(ChatLinkStruct value)
 {
     value.header = Header.Outfit;
     value.outfit.outfitId = this.OutfitId;
     return 5;
 }
 protected override int CopyTo(ChatLinkStruct value)
 {
     value.header = Header.Map;
     value.map.pointOfInterestId = this.PointOfInterestId;
     return 5;
 }