Exemple #1
0
        // Convert item
        public ExtendedItemData(ItemDrop.ItemData from)
        {
            m_stack          = from.m_stack;
            m_durability     = from.m_durability;
            m_quality        = from.m_quality;
            m_variant        = from.m_variant;
            m_shared         = from.m_shared;
            m_crafterID      = from.m_crafterID;
            m_crafterName    = from.m_crafterName;
            m_gridPos        = from.m_gridPos;
            m_equiped        = from.m_equiped;
            m_dropPrefab     = from.m_dropPrefab;
            m_lastAttackTime = from.m_lastAttackTime;
            m_lastProjectile = from.m_lastProjectile;

            if (from is ExtendedItemData fromExtendedItemData)
            {
                ExtendedItemDataFramework.LogWarning($"Copying ExtendedItemData ({from.m_shared.m_name})");
                Components.AddRange(fromExtendedItemData.Components);
            }
            else
            {
                ExtendedItemDataFramework.LogWarning($"Converting old ItemData to new ExtendedItemData ({from.m_shared.m_name})");
                var crafterNameData = new CrafterNameData(this)
                {
                    CrafterName = from.m_crafterName
                };
                Components.Add(crafterNameData);
                NewExtendedItemData?.Invoke(this);
            }

            Save();
        }
Exemple #2
0
 private void Initialize()
 {
     Components.Add(new CrafterNameData(this));
     NewExtendedItemData?.Invoke(this);
     Save();
 }