Ejemplo n.º 1
0
    public bool IsHaveEquipItem(eEQUIP_ITEM Slot, ref ITEM srcItem, NkSoldierInfo solInfo)
    {
        if (solInfo == null)
        {
            return(false);
        }
        int itemPosType;

        if (Slot == eEQUIP_ITEM.EQUIP_WEAPON1)
        {
            itemPosType = solInfo.GetItemPosTypeByWeaponType();
        }
        else
        {
            itemPosType = 1;
        }
        int      inventoryIndex = this.GetInventoryIndex(itemPosType);
        bool     result         = false;
        ITEM     iTEM           = null;
        ITEMINFO iTEMINFO       = null;

        if (inventoryIndex > -1 && inventoryIndex < 7)
        {
            for (int i = 0; i < ItemDefine.INVENTORY_ITEMSLOT_MAX; i++)
            {
                ITEM item = this.m_Inventory[inventoryIndex].GetItem(i);
                if (item != null)
                {
                    if (NrTSingleton <ItemManager> .Instance.GetItemMinLevelFromItem(item) <= (int)solInfo.GetLevel())
                    {
                        ITEMTYPE_INFO itemTypeInfo = NrTSingleton <ItemManager> .Instance.GetItemTypeInfo(item.m_nItemUnique);

                        if (itemTypeInfo != null)
                        {
                            if (solInfo.IsEquipClassType(itemTypeInfo.WEAPONTYPE, itemTypeInfo.EQUIPCLASSTYPE))
                            {
                                ITEMINFO itemInfo = NrTSingleton <ItemManager> .Instance.GetItemInfo(item.m_nItemUnique);

                                int equipItemPos = (int)NrTSingleton <ItemManager> .Instance.GetEquipItemPos(item.m_nItemUnique);

                                if (Slot == (eEQUIP_ITEM)equipItemPos)
                                {
                                    if (itemInfo.m_nMinDamage != 0)
                                    {
                                        int num = 0;
                                        if (iTEM != null)
                                        {
                                            num = Tooltip_Dlg.GetOptionValue(iTEM.m_nOption[0], iTEMINFO.m_nMinDamage);
                                        }
                                        int optionValue = Tooltip_Dlg.GetOptionValue(item.m_nOption[0], itemInfo.m_nMinDamage);
                                        if (num < optionValue)
                                        {
                                            iTEM     = item;
                                            iTEMINFO = itemInfo;
                                            srcItem  = item;
                                            result   = true;
                                        }
                                    }
                                    else if (itemInfo.m_nDefense != 0)
                                    {
                                        int num2 = 0;
                                        if (iTEM != null)
                                        {
                                            num2 = Tooltip_Dlg.GetOptionValue(iTEM.m_nOption[0], iTEMINFO.m_nDefense);
                                        }
                                        int optionValue2 = Tooltip_Dlg.GetOptionValue(item.m_nOption[0], itemInfo.m_nDefense);
                                        if (num2 < optionValue2)
                                        {
                                            iTEM     = item;
                                            iTEMINFO = itemInfo;
                                            srcItem  = item;
                                            result   = true;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        return(result);
    }