예제 #1
0
    public _DBC_CHARACTER_ACTION_SET GetActionSet(string strFileName, uint dwID)
    {
        bool bFind = false;
        COMMON_DBC <_DBC_CHARACTER_ACTION_SET> pActionDBCFile = new COMMON_DBC <_DBC_CHARACTER_ACTION_SET>();

        if (!m_mapActionSet.ContainsKey(strFileName))
        {
            string strPathName = m_strResPath + strFileName;
            bool   bResult     = pActionDBCFile.OpenFromTXT(strPathName, DBStruct.GetResources);
            if (bResult)
            {
                m_mapActionSet.Add(strFileName, pActionDBCFile);
                bFind = m_mapActionSet.ContainsKey(strFileName);
            }
        }

        if (!bFind)
        {
            return(null);
        }

        pActionDBCFile = (COMMON_DBC <_DBC_CHARACTER_ACTION_SET>)m_mapActionSet[strFileName];
        _DBC_CHARACTER_ACTION_SET pActionSet = (_DBC_CHARACTER_ACTION_SET)pActionDBCFile.Search_Index_EQU((int)dwID);

        return(pActionSet);
    }
예제 #2
0
    public CObject_Item NewItem(uint idTable)
    {
        CObject_Item newItem = null;

        if (IsWhiteEquip(idTable))
        {
            //搜索纪录
            _DBC_ITEM_EQUIP_BASE pEquip = EquipDBC.Search_Index_EQU((int)idTable);
            if (pEquip == null)
            {
                return(null);
            }

            newItem = new CObject_Item_Equip(CreateID());
            ((CObject_Item_Equip)newItem).AsWhiteEquip(ref pEquip);

            //物品规则
            itemRule(pEquip, newItem);
        }
        else if (IsGreenEquip(idTable))
        {
            //搜索纪录
            _DBC_ITEM_EQUIP_BASE pEquip = EquipDBC.Search_Index_EQU((int)idTable);
            if (pEquip == null)
            {
                return(null);
            }

            newItem = new CObject_Item_Equip(CreateID());
            ((CObject_Item_Equip)newItem).AsGreenEquip(ref pEquip);

            //物品规则
            itemRule(pEquip, newItem);
        }
        else if (IsBlueEquip(idTable))
        {
            //搜索纪录
            _DBC_ITEM_EQUIP_BASE pEquip = EquipDBC.Search_Index_EQU((int)idTable);
            if (pEquip == null)
            {
                return(null);
            }

            newItem = new CObject_Item_Equip(CreateID());
            ((CObject_Item_Equip)newItem).AsBlueEquip(ref pEquip);

            //物品规则
            itemRule(pEquip, newItem);
        }
        else if (IsPurpleEquip(idTable))
        {
            //搜索纪录
            _DBC_ITEM_EQUIP_BASE pEquip = EquipDBC.Search_Index_EQU((int)idTable);
            if (pEquip == null)
            {
                return(null);
            }

            newItem = new CObject_Item_Equip(CreateID());
            ((CObject_Item_Equip)newItem).AsPurpleEquip(ref pEquip);

            //物品规则
            itemRule(pEquip, newItem);
        }
        else if (IsMedicItem(idTable))
        {
            COMMON_DBC <_DBC_ITEM_MEDIC> allMedic = CDataBaseSystem.Instance.GetDataBase <_DBC_ITEM_MEDIC>((int)DataBaseStruct.DBC_ITEM_MEDIC);
            if (allMedic != null)
            {
                _DBC_ITEM_MEDIC pMedic = allMedic.Search_Index_EQU((int)idTable);

                newItem = new CObject_Item_Medicine(CreateID());
                ((CObject_Item_Medicine)newItem).AsMedicine(pMedic);

                itemRule(pMedic, newItem);
            }
            else
            {
                throw new Exception("_DBC_ITEM_MEDIC database not found");
            }
        }
        else if (IsGemItem((int)idTable))
        {
            //搜索纪录
            _DBC_ITEM_GEM pGem = GemDBC.Search_Index_EQU((int)idTable);
            if (pGem == null)
            {
                return(null);
            }

            newItem = new CObject_Item_Gem(CreateID());
            ((CObject_Item_Gem)newItem).AsGem(pGem);

            //物品规则
            itemRule(pGem, newItem);
        }
        else if (isSymbolItem(idTable))    //是符印
        {
            _DBC_ITEM_SYMBOL pSymbol = SymbolDBC.Search_Index_EQU((int)idTable);
            if (pSymbol == null)
            {
                return(null);
            }

            newItem = new CObject_Item_Symbol(CreateID());
            ((CObject_Item_Symbol)newItem).AsSymbol(pSymbol);
            //物品规则
            itemRule(pSymbol, newItem);
        }
        else if (isTalismanItem(idTable))    //是法宝
        {
            _DBC_ITEM_TALISMAN dbItem = CDataBaseSystem.Instance.GetDataBase <_DBC_ITEM_TALISMAN>((int)DataBaseStruct.DBC_ITEM_TALISMAN).Search_Index_EQU((int)idTable);
            if (dbItem == null)
            {
                return(null);
            }

            newItem = new CTalisman_Item(CreateID());
            CTalisman_Item curItem = newItem as CTalisman_Item;
            curItem.Define = dbItem;
            //物品规则
            itemRule(dbItem, newItem);
        }
        if (newItem == null)
        {
            LogManager.LogError("物品编号填写错误!,ID:" + idTable);
        }
        else
        {
            newItem.m_idTable         = (int)idTable;
            allItems[newItem.GetID()] = newItem;
        }

        return(newItem);
    }