Пример #1
0
    EAObjID SetActorItem(EA_CCharBPlayer pUser, EA_CItemUnit pItemUnit)
    {
        if (pUser == null || pItemUnit == null)
        {
            return(CObjGlobal.InvalidObjID);
        }

        EAObjID objID = CObjGlobal.InvalidObjID;

        ObjectInfo ObjInfo = new ObjectInfo();

        ObjInfo.m_ModelTypeIndex = pItemUnit.GetItemBaseInfo().m_ModelTypeIndex;
        ObjInfo.m_objClassType   = pItemUnit.GetItemBaseInfo().m_objClassType;

        ItemObjInfo itemInfo = new ItemObjInfo();

        itemInfo.m_HavenUser  = pUser.GetObjID();
        itemInfo.m_iItemIndex = pItemUnit.GetItemId(); //  [4/7/2014 puos] The item ID of the item object

        if (pItemUnit.GetItemBaseInfo().m_eItemType == eItemType.eIT_Weapon)
        {
            itemInfo.m_eItemType = eItemObjType.IK_WEAPON;

            //  [3/21/2018 puos] If there is an item object created in the current slot, it is not created.
            //  Fixed bug that was created even with created item object

            EA_CItem pItem = EACObjManager.instance.GetItemObject(pItemUnit.GetItemBaseInfo().m_GDObjId);

            if (pItem == null)
            {
                pItem = EACObjManager.instance.CreateItem(ObjInfo, itemInfo);
            }

            if (pItem != null)
            {
                pUser.SetWeaponAttachment(pItemUnit.GetAttackWeaponInfo().weaponType, pItem.GetLinkEntity());
                return(pItem.GetObjID());
            }
        }


        return(objID);
    }
Пример #2
0
    public bool DeleteItemUnit(ITEM_UNIT_INDEX _id)
    {
        EA_CItemUnit pItemUnit = FindItemUnit(_id);

        if (pItemUnit != null)
        {
            //GDDebug.Log("EA_ItemManager - DeleteItemUnit - ITEM_UNIT_INDEX :" + _id);

            //  [4/10/2014 puos] Delete when an item object is created in an item unit
            if (pItemUnit.GetItemBaseInfo().m_GDObjId != CObjGlobal.InvalidObjID)
            {
                EACObjManager.instance.RemoveItem(pItemUnit.GetItemBaseInfo().m_GDObjId);
            }

            m_mapItemUnitList.Remove((uint)_id);
            m_pIDGenerator.FreeID(_id);
        }

        return(true);
    }
Пример #3
0
    public void EquipItem(EA_CCharBPlayer pUser, uint equip_slot)
    {
        EA_CItemUnit pItemUnit = FindEquipItembySlot(equip_slot);

        if (pItemUnit != null)
        {
            if (pItemUnit.GetItemBaseInfo().m_eItemType == eItemType.eIT_Weapon)
            {
                EAObjID objId = SetActorItem(pUser, pItemUnit);

                pItemUnit.GetItemBaseInfo().m_GDObjId = objId;
                m_nCurrEquipSlot = equip_slot;
                pUser.DoSwitchWeapons((uint)pItemUnit.GetAttackWeaponInfo().weaponType);
            }
        }
        else // 무기가 없을시에도 장착을 시도해야함
        {
            m_nCurrEquipSlot = equip_slot;
            pUser.DoSwitchWeapons(0);
        }
    }