コード例 #1
0
        /// <summary>
        /// Gets a item description pre-formatted into friendly data.
        /// </summary>
        /// <param name="index">Index of item.</param>
        /// <returns>ItemTemplate</returns>
        public ItemTemplate GetItemDescription(int index)
        {
            ItemTemplate desc = new ItemTemplate();
            if (items.Count > 0 && index >= 0 && index < items.Count)
            {
                DFItem item = items[index];
                desc.index = index;
                desc.name = Encoding.UTF8.GetString(item.name).TrimEnd('\0');
                desc.baseWeight = (float)item.baseWeightUnits * 0.25f;
                desc.hitPoints = item.hitPoints;
                desc.capacityOrTarget = item.capacityOrTarget;
                desc.basePrice = item.basePrice;
                desc.enchantmentPoints = item.enchantmentPoints;
                desc.unknown = item.unknown;
                desc.variants = item.variants;
                desc.drawOrderOrEffect = item.drawOrderOrEffect;
                desc.isBluntWeapon = (((item.propertiesBitfield >> 4) & 1) == 1) ? true : false;
                desc.isLiquid = (((item.propertiesBitfield >> 3) & 1) == 1) ? true : false;
                desc.isOneHanded = (((item.propertiesBitfield >> 2) & 1) == 1) ? true : false;
                desc.isIngredient = ((item.propertiesBitfield & 1) == 1) ? true : false;
                desc.worldTextureArchive = item.worldTextureBitfield >> 7;
                desc.worldTextureRecord = item.worldTextureBitfield & 0x7f;
                desc.playerTextureArchive = item.playerTextureBitfield >> 7;
                desc.playerTextureRecord = item.playerTextureBitfield & 0x7f;
            }

            return desc;
        }
コード例 #2
0
        /// <summary>
        /// Caches item template.
        /// </summary>
        ItemTemplate GetCachedItemTemplate()
        {
            if (itemGroup != cachedItemGroup || groupIndex != cachedGroupIndex)
            {
                cachedItemTemplate = DaggerfallUnity.Instance.ItemHelper.GetItemTemplate(itemGroup, groupIndex);
                cachedItemGroup = itemGroup;
                cachedGroupIndex = groupIndex;
            }

            return cachedItemTemplate;
        }