Beispiel #1
0
        public static bool Prefix(ItemStand __instance)
        {
            if (!__instance.HaveAttachment())
            {
                return(false);
            }
            GameObject itemPrefab = ObjectDB.instance.GetItemPrefab(__instance.m_nview.GetZDO().GetString("item"));

            if (itemPrefab != null)
            {
                GameObject gameObject = Object.Instantiate(itemPrefab, __instance.m_dropSpawnPoint.position, __instance.m_dropSpawnPoint.rotation);
                ItemDrop   itemDrop   = gameObject.GetComponent <ItemDrop>();
                ItemDrop.LoadFromZDO(itemDrop.m_itemData, __instance.m_nview.GetZDO());
                itemDrop.m_itemData = new ExtendedItemData(
                    itemDrop.m_itemData,
                    itemDrop.m_itemData.m_stack,
                    itemDrop.m_itemData.m_durability,
                    new Vector2i(),
                    false,
                    itemDrop.m_itemData.m_quality,
                    itemDrop.m_itemData.m_variant,
                    itemDrop.m_itemData.m_crafterID,
                    itemDrop.m_itemData.m_crafterName);
                itemDrop.Save();
                gameObject.GetComponent <Rigidbody>().velocity = Vector3.up * 4f;
                __instance.m_effects.Create(__instance.m_dropSpawnPoint.position, Quaternion.identity);
            }
            __instance.m_nview.GetZDO().Set("item", "");
            __instance.m_nview.InvokeRPC(ZNetView.Everybody, "SetVisualItem", "", 0);
            return(false);
        }
Beispiel #2
0
    // Token: 0x060006DD RID: 1757 RVA: 0x00038B18 File Offset: 0x00036D18
    public static ItemDrop DropItem(ItemDrop.ItemData item, int amount, Vector3 position, Quaternion rotation)
    {
        ItemDrop component = UnityEngine.Object.Instantiate <GameObject>(item.m_dropPrefab, position, rotation).GetComponent <ItemDrop>();

        component.m_itemData = item.Clone();
        if (amount > 0)
        {
            component.m_itemData.m_stack = amount;
        }
        component.Save();
        return(component);
    }
Beispiel #3
0
        static bool DropItem(ref ItemDrop __result, ref ItemDrop.ItemData item, ref int amount, ref Vector3 position, ref Quaternion rotation)
        {
            ItemDrop component = UnityEngine.Object.Instantiate(item.m_dropPrefab, position, rotation).GetComponent <ItemDrop>();

            component.m_itemData = item.Clone();
            if (item is TyrData)
            {
                var otherData = (TyrData)item;
                var thisData  = (TyrData)component.m_itemData;
                thisData.Copy(otherData);

                component.m_itemData = thisData;
            }
            if (amount > 0)
            {
                component.m_itemData.m_stack = amount;
            }
            component.Save();
            __result = component;
            return(false);
        }