Exemplo n.º 1
0
bool NFCEctypeModule::AddEctypeActiveState(const NFIDENTID self, const int nContainerID)
{
    NF_SHARE_PTR<NFIRecord> pRecord = m_pKernelModule->FindRecord(self, "EctypeList");
    if (pRecord.get() && nContainerID > 0)
    {
        NFCDataList valNormalResult;
        pRecord->FindInt(EXTYPE_RC_SCENEID, nContainerID, valNormalResult);
        if (valNormalResult.GetCount()  <= 0)
        {
            NFCDataList valValue;
            valValue.AddInt(nContainerID);
            valValue.AddInt(ECS_HAS_OPEN);
            valValue.AddInt(0);

            pRecord->AddRow(-1, valValue);
            m_pLogModule->LogNormal(NFILogModule::NLL_INFO_NORMAL, self, "EctypeList AddEctypeActiveState", nContainerID);
        }
    }

    return true;
}
Exemplo n.º 2
0
int NFCBuffModule::ProcessBuffValuePropertyReferAbsoluteValue( const NFIDENTID& self, NFIBuffConfigModule::NFCBuffConfig* pBuffConfig, const NFIDENTID& releaserIdent )
{
    //buff group property
    int nBuffGroup = 0;
    //RUNTIME_BUFF_INFO
    NF_SHARE_PTR<NFIObject> pObject = m_pKernelModule->GetObject( self );
    NF_SHARE_PTR<NFIRecord> pBuffRecord = pObject->GetRecordManager()->GetElement( mstrRunTimeEffectTable );
    if ( pBuffRecord )
    {
        NF_SHARE_PTR<NFIRecord> pPropertyGroupRecord = pObject->GetRecordManager()->GetElement( mstrPropertyTable );

        std::string strPropertyList;
        std::string strPropertyName;
        int* pnEffectValue = pBuffConfig->First( strPropertyName );
        while ( pnEffectValue )
        {
            NF_SHARE_PTR<NFIProperty> pProperty = pObject->GetPropertyManager()->GetElement( strPropertyName );
            if ( pProperty )
            {
                char szEffectValue[MAX_PATH] = {0};
                printf( szEffectValue, "%d", *pnEffectValue );

                strPropertyList.append( strPropertyName );
                strPropertyList.append( "," );
                strPropertyList.append( szEffectValue );
                strPropertyList.append( ";" );

                //相继设置属性到buff group,增值
                //从属性系统得到属性应该在的col函数
                int nPropertyGroupCol = 0;
                int nPropertyBuffGroupRow = 0;
                TDATA_TYPE eColType = pPropertyGroupRecord->GetColType( nPropertyGroupCol );

                if ( NFIBuffConfigModule::BuffReverseType::ERT_NEED_REVERSE == pBuffConfig->NeedReverseType )
                {
                    //需要还原
                    switch ( eColType )
                    {
                        case TDATA_INT:
                            pPropertyGroupRecord->SetInt( nPropertyBuffGroupRow, nPropertyGroupCol, *pnEffectValue );
                            break;

                        case TDATA_FLOAT:
                            pPropertyGroupRecord->SetFloat( nPropertyBuffGroupRow, nPropertyGroupCol, float( *pnEffectValue ) );
                            break;

                        case TDATA_DOUBLE:
                            pPropertyGroupRecord->SetDouble( nPropertyBuffGroupRow, nPropertyGroupCol, double( *pnEffectValue ) );
                            break;

                        default:
                            break;
                    }
                }
                else if ( NFIBuffConfigModule::BuffReverseType::ERT_NO_REVERSE == pBuffConfig->NeedReverseType )
                {
                    //不需要还原
                    NFIDataList::TData valueEffectValue;
                    switch ( eColType )
                    {
                        case TDATA_INT:
                            valueEffectValue.nType = TDATA_INT;
                            valueEffectValue.variantData =  NFINT64( *pnEffectValue );
                            break;

                        case TDATA_FLOAT:
                            valueEffectValue.nType = TDATA_FLOAT;
                            valueEffectValue.variantData =  float( *pnEffectValue );
                            break;

                        case TDATA_DOUBLE:
                            valueEffectValue.nType = TDATA_DOUBLE;
                            valueEffectValue.variantData = double( *pnEffectValue );
                            break;

                        default:
                            break;
                    }

                    //const NFIDataList& oldValue = pProperty->GetValue();
                    pObject->GetPropertyManager()->SetProperty( strPropertyName, valueEffectValue );
                }

                pnEffectValue = pBuffConfig->Next( strPropertyName );
            }

            //还原与否,都需要保存在runtimebuff表
            NFCDataList valueBuffProperty;
            valueBuffProperty.AddString( strPropertyName.c_str() );
            valueBuffProperty.AddObject( releaserIdent );
            valueBuffProperty.AddFloat( pBuffConfig->EffectTimeInterval );
            valueBuffProperty.AddInt( pBuffConfig->EffectTimeValue );
            valueBuffProperty.AddString( strPropertyName.c_str() );

            pBuffRecord->AddRow( -1, valueBuffProperty );
        }
    }

    return 0;
}
Exemplo n.º 3
0
int NFCSkillModule::OnRequireUseSkillEvent( const NFGUID& self, const int nEventID, const NFIDataList& var )
{
    if ( var.GetCount() < 3)
    {
        return 1;
    }

    //EGameErrorCode errorCode = EGameErrorCode::EGEC_INVALID_SKILL;
    NF_SHARE_PTR<NFIObject> pObejct = m_pKernelModule->GetObject( var.Object( 0 ) );
    if ( pObejct == NULL )
    {
        return 1;
    }

    NF_SHARE_PTR<NFIRecord> pRecordSkill = pObejct->GetRecordManager()->GetElement( NFrame::Player::R_SkillTable() );
    if ( pRecordSkill == NULL )
    {
        return 1;
    }

    NF_SHARE_PTR<NFIPropertyManager> pPropertyManager = m_pElementInfoModule->GetPropertyManager( var.String( 2 ) );
    if ( pPropertyManager == NULL )
    {
        return 1;
    }

    NF_SHARE_PTR<NFIProperty> pItemTypeProperty = pPropertyManager->GetElement(NFrame::Skill::SkillType());
    if ( pItemTypeProperty == NULL )
    {
        return 1;
    }

    //配置表中真的有这么个技能类别
    EGameSkillType eItemType = ( EGameSkillType )pItemTypeProperty->GetInt();
    NFISkillConsumeProcessModule* pConsumeProcessModule = m_pSkillConsumeManagerModule->GetConsumeModule( EGameSkillType::EGST_JOBSKILL_BRIEF );
    if ( pConsumeProcessModule == NULL )
    {
        return 1;
    }

    NFCDataList valueOther;
    valueOther.Append( var, 3, var.GetCount() - 3 ); // 被攻击玩家数量 3表示从第几个参数开始是被攻击玩家
    //     if ( pConsumeProcessModule->ConsumeLegal( var.ObjectVal( 0 ), var.StringVal( 2 ), valueOther ) != 0 )
    //     {
    //         return 1;
    //     }
    // 
    //     if ( pConsumeProcessModule->ConsumeSelf( var.ObjectVal( 0 ), var.StringVal( 2 ) ) != 0 )
    //     {
    //         return 1;
    //     }
    // 
    NFCDataList damageValueList;
    NFCDataList damageResultList;
    int nResult = pConsumeProcessModule->ConsumeProcess( var.Object( 0 ), var.String( 2 ), valueOther, damageValueList, damageResultList );
    for (int i = 0; i < valueOther.GetCount(); i++)
    {
        m_pKernelModule->SetPropertyInt(valueOther.Object(i), NFrame::NPC::HP(), 0);
        damageValueList.AddInt(0);
        damageResultList.AddInt(0);
    }

    //结果事件--无论失败或者是成功,都会发下去--当然使用结果只对使用者下发--成果的结果,还得对被施放的人发
    if ( damageValueList.GetCount() == damageResultList.GetCount()
        && damageValueList.GetCount() == valueOther.GetCount() )
    {
        NFCDataList valueResult;
        valueResult.AddString( var.String( 2 ).c_str() );
        valueResult.AddInt( valueOther.GetCount() );
        valueResult.Append( valueOther, 0, valueOther.GetCount() ); //伤害对象
        valueResult.Append( damageValueList, 0, damageValueList.GetCount() ); //伤害值
        valueResult.Append( damageResultList, 0, damageResultList.GetCount() ); //击打效果

        //现在不需要反馈,杀了就杀了
        //m_pEventProcessModule->DoEvent( pObejct->Self(), NFED_ON_CLIENT_USE_SKILL_RESULT, valueResult );
    }

    return 0;
}