Beispiel #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);
    }
Beispiel #2
0
    // Carry a weapon
    public void RaiseWeapon()
    {
        EA_CItem pItemBase = GetItemBase();

        if (pItemBase != null)
        {
            if (pItemBase.GetItemInfo().m_iItemIndex != CObjGlobal.InvalidItemID)
            {
                EA_CItemUnit pItemUnit = EA_ItemManager.instance.FindItemUnit(pItemBase.GetItemInfo().m_iItemIndex);

                if (pItemUnit != null)
                {
                    WeaponInfo.Copy(pItemUnit.GetAttackWeaponInfo());
                }
            }
        }

        StopFire();
    }
Beispiel #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);
        }
    }