本文整理汇总了C++中NFDataList类的典型用法代码示例。如果您正苦于以下问题:C++ NFDataList类的具体用法?C++ NFDataList怎么用?C++ NFDataList使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了NFDataList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateItemInTempBag
bool NFCPackModule::CreateItemInTempBag(const NFGUID & self, const std::string & strConfigName, const int nCount)
{
NF_SHARE_PTR<NFIRecord> pRecord = m_pKernelModule->FindRecord(self, NFrame::Player::TempItemList::ThisName());
if (nullptr == pRecord)
{
return false;
}
NFDataList varFindResult;
int nFindRowCount = pRecord->FindString(NFrame::Player::TempItemList::ConfigID, strConfigName, varFindResult);
if (nFindRowCount <= 0)
{
NF_SHARE_PTR<NFDataList> xRowData = pRecord->GetInitData();
xRowData->SetString(NFrame::Player::TempItemList::ConfigID, strConfigName);
xRowData->SetInt(NFrame::Player::TempItemList::ItemCount, nCount);
pRecord->AddRow(-1, *xRowData);
}
else
{
int nFindRow = varFindResult.Int32(0);
int nOldCount = pRecord->GetInt32(nFindRow, NFrame::Player::TempItemList::ItemCount);
int nNewCount = nOldCount + nCount;
pRecord->SetInt(nFindRow, NFrame::Player::TempItemList::ItemCount, nNewCount);
}
return true;
}
示例2: DeleteItem
bool NFCPackModule::DeleteItem( const NFGUID& self, const std::string& strItemConfigID, const int nCount )
{
if(nCount <= 0)
{
return false;
}
NF_SHARE_PTR<NFIObject> pObject = m_pKernelModule->GetObject( self );
if ( NULL == pObject )
{
return false;
}
if (!m_pElementModule->ExistElement(NFrame::Item::ThisName(), strItemConfigID))
{
return false;
}
NF_SHARE_PTR<NFIRecord> pRecord = pObject->GetRecordManager()->GetElement( NFrame::Player::BagItemList::ThisName() );
if (!pRecord)
{
return false;
}
NFDataList varFindResult;
int nFindRowCount = pRecord->FindString(NFrame::Player::BagItemList::ConfigID, strItemConfigID, varFindResult);
if (nFindRowCount > 0)
{
int nNeedDelCount = nCount;
for (int i = 0; i < varFindResult.GetCount(); ++i)
{
int nFindRow = varFindResult.Int32(i);
int nOldCount = pRecord->GetInt32(nFindRow, NFrame::Player::BagItemList::ItemCount);
if (nOldCount > nNeedDelCount)
{
int nNewCount = nOldCount - nNeedDelCount;
pRecord->SetInt(nFindRow, NFrame::Player::BagItemList::ItemCount, nNewCount);
nNeedDelCount = 0;
}
else if (nOldCount == nNeedDelCount)
{
pRecord->Remove(nFindRow);
nNeedDelCount = 0;
}
else if (nOldCount < nNeedDelCount)
{
pRecord->Remove(nFindRow);
nNeedDelCount -= nOldCount;
}
}
if (nNeedDelCount <= 0)
{
return true;
}
}
return false;
}
示例3: GetElement
bool NFCSceneAOIModule::DestroySceneNPC(const int nSceneID, const int nGroupID)
{
NF_SHARE_PTR<NFCSceneInfo> pSceneInfo = GetElement(nSceneID);
if (pSceneInfo)
{
if (pSceneInfo->GetElement(nGroupID))
{
NFDataList xMonsterlistObject;
if (m_pKernelModule->GetGroupObjectList(nSceneID, nGroupID, xMonsterlistObject, false))
{
for (int i = 0; i < xMonsterlistObject.GetCount(); ++i)
{
NFGUID ident = xMonsterlistObject.Object(i);
m_pKernelModule->DestroyObject(ident);
}
}
pSceneInfo->RemoveElement(nGroupID);
return true;
}
}
return false;
}
示例4: GetProduceDataCount
bool NFCSLGBuildingModule::GetProduceDataCount( const NFGUID& self, const NFGUID& xBuilID, const std::string& strItemID, int& nCount )
{
NF_SHARE_PTR<NFIRecord> pProduce = m_pKernelModule->FindRecord(self, "BuildingProduce");
if (NULL == pProduce.get())
{
m_pLogModule->LogNormal(NFILogModule::NLL_ERROR_NORMAL, self, "this is no [BuildingProduce] Record!", "", __FUNCTION__, __LINE__);
return false;
}
NFDataList varProduce;
pProduce->FindObject("BuildingGUID", xBuilID, varProduce);
if(varProduce.GetCount() <= 0)
{
nCount = 0;
return true;
}
for (int i = 0; i< varProduce.GetCount(); i++)
{
const std::string& strHasItemID = pProduce->GetString(i, "ItemID");
if (strHasItemID == strItemID)
{
const int nOldCount = pProduce->GetInt(i, "LeftCount");
nCount = pProduce->GetInt(i, "LeftCount");
return true;
}
}
return false;
}
示例5: MemberOffline
bool NFCTeamModule::MemberOffline( const NFGUID& self, const NFGUID& xTeam )
{
NF_SHARE_PTR<NFIRecordManager> pRecordManager = m_pCommonRedisModule->GetCacheRecordInfo(xTeam, NFrame::Team::ThisName());
if (!pRecordManager)
{
return false;
}
NF_SHARE_PTR<NFIRecord> pMemberRecord = pRecordManager->GetElement(NFrame::Team::MemberList::ThisName());
if (!pMemberRecord.get())
{
return false;
}
NFDataList varList;
pMemberRecord->FindObject(NFrame::Team::MemberList::GUID, self, varList);
if (varList.GetCount() <= 0)
{
return false;
}
const int nRow = varList.Int32(0);
pMemberRecord->SetInt(nRow, NFrame::Team::MemberList::Online, 0);
pMemberRecord->SetInt(nRow, NFrame::Team::MemberList::GameID, 0);
return m_pCommonRedisModule->SaveCacheRecordInfo(xTeam, pRecordManager);
}
示例6: Boost
int NFCSLGBuildingModule::Boost(const NFGUID& self, const NFGUID& xBuilID)
{
NF_SHARE_PTR<NFIRecord> pRecord = m_pKernelModule->FindRecord(self, "BuildingList");
if (NULL == pRecord.get())
{
m_pLogModule->LogNormal(NFILogModule::NLL_ERROR_NORMAL, self, "this is no [BuildingList] Record!", "", __FUNCTION__, __LINE__);
return 1;
}
NFDataList var;
pRecord->FindObject("BuildingGUID", xBuilID, var);
if (var.GetCount() <= 0)
{
m_pLogModule->LogNormal(NFILogModule::NLL_ERROR_NORMAL, self, "there are no the building", xBuilID.ToString(), __FUNCTION__, __LINE__);
return 1;
}
const int nRow = var.Int(0);
const int nBoostTime = 20;
const std::string strBuildID = pRecord->GetString(nRow, "BuildingID");
//NFDataList varHeart;
//varHeart << xBuilID;
m_pScheduleModule->AddSchedule(self, "OnBoostHeartBeat", this, &NFCSLGBuildingModule::OnBoostHeartBeat, /*varHeart,*/ nBoostTime, 1);
pRecord->SetInt(nRow, "State", NFMsg::EBS_BOOST);
pRecord->SetInt(nRow, "StateStartTime", pPluginManager->GetNowTime());
pRecord->SetInt(nRow, "StateEndTime", pPluginManager->GetNowTime() + nBoostTime);
return 0;
}
示例7: DeleteEquip
bool NFCPackModule::DeleteEquip( const NFGUID& self, const NFGUID& id )
{
if (id.IsNull())
{
return false;
}
NF_SHARE_PTR<NFIObject> pObject = m_pKernelModule->GetObject( self );
if (nullptr == pObject)
{
return false;
}
NF_SHARE_PTR<NFIRecord> pRecord = pObject->GetRecordManager()->GetElement( NFrame::Player::BagEquipList::ThisName() );
if (nullptr == pRecord)
{
return false;
}
NFDataList varFindResult;
int nFindRowCount = pRecord->FindObject(NFrame::Player::BagEquipList::GUID, id, varFindResult);
if (nFindRowCount > 0)
{
//int nTotalCount = 0;
for (int i = 0; i < varFindResult.GetCount(); ++i)
{
int nFindRow = varFindResult.Int32(i);
pRecord->Remove(nFindRow);
}
}
return true;
}
示例8: AddProduceData
int NFCSLGBuildingModule::Produce(const NFGUID& self, const NFGUID& xBuilID, const std::string& strItemID, const int nCount)
{
NF_SHARE_PTR<NFIRecord> pRecord = m_pKernelModule->FindRecord(self, "BuildingList");
if (NULL == pRecord.get())
{
m_pLogModule->LogNormal(NFILogModule::NLL_ERROR_NORMAL, self, "this is no [BuildingList] Record!", "", __FUNCTION__, __LINE__);
return 1;
}
NFDataList var;
pRecord->FindObject("BuildingGUID", xBuilID, var);
if (var.GetCount() <= 0)
{
m_pLogModule->LogNormal(NFILogModule::NLL_ERROR_NORMAL, self, "there are no the building", xBuilID.ToString(), __FUNCTION__, __LINE__);
return 1;
}
AddProduceData(self, xBuilID, strItemID, nCount);
const std::string strHeartname = GetProduceHeartName(self, xBuilID, strItemID);
const int nTime = 50;//To ADD
if (!m_pScheduleModule->ExistSchedule(self, strHeartname))
{
//NFDataList varHeart;
//varHeart << xBuilID;
//varHeart << strItemID;
m_pScheduleModule->AddSchedule(self, strHeartname, this, &NFCSLGBuildingModule::OnProduceHeartBeat, /*varHeart, */nTime, nCount);
}
return 0;
}
示例9: LeaveTeam
bool NFCTeamModule::LeaveTeam( const NFGUID& self, const NFGUID& xTeamID )
{
NF_SHARE_PTR<NFIRecordManager> pRecordManager = m_pCommonRedisModule->GetCacheRecordInfo(xTeamID, NFrame::Team::ThisName());
if (!pRecordManager)
{
return false;
}
NF_SHARE_PTR<NFIRecord> pMemberRecord = pRecordManager->GetElement(NFrame::Team::MemberList::ThisName());
if (!pMemberRecord.get())
{
return false;
}
NFDataList varList;
pMemberRecord->FindObject(NFrame::Team::MemberList::GUID, self, varList);
if (varList.GetCount() == 0)
{
return false;
}
const int nRow = varList.Int32(0);
if (!pMemberRecord->Remove(nRow))
{
return false;
}
return m_pCommonRedisModule->SaveCacheRecordInfo(xTeamID, pRecordManager);
}
示例10: AddHeroExp
bool NFCHeroModule::AddHeroExp(const NFGUID& self, const NFGUID& xHeroID, const int64_t nExp)
{
NF_SHARE_PTR<NFIRecord> pHeroRecord = m_pKernelModule->FindRecord(self, NFrame::Player::PlayerHero::ThisName());
if (nullptr == pHeroRecord.get())
{
return false;
}
if (xHeroID.IsNull())
{
return false;
}
if (nExp <= 0)
{
return false;
}
int nRow = pHeroRecord->FindObject(NFrame::Player::PlayerHero::GUID, xHeroID);
if (nRow < 0)
{
return false;
}
NFDataList varRowData;
if (!pHeroRecord->QueryRow(nRow, varRowData))
{
return false;
}
const int64_t nCurExp = varRowData.Int(NFrame::Player::PlayerHero::Exp);
const int nBeforeLevel = varRowData.Int32(NFrame::Player::PlayerHero::Level);
int64_t nLeftExp = nCurExp + nExp;
int nAfterLevel = nBeforeLevel;
for (int i = nBeforeLevel; i < ECONSTDEFINE_HERO_MAXLEVEL; i++)
{
const int64_t nNeedExp = (i + 1) * ECONSTDEFINE_HERO_ONCELEVEEXP;
if (nLeftExp >= nNeedExp)
{
nAfterLevel += 1;
nLeftExp -= nNeedExp;
pHeroRecord->SetInt(nRow, NFrame::Player::PlayerHero::Level, nAfterLevel);
}
else
{
break;
}
}
pHeroRecord->SetInt(nRow, NFrame::Player::PlayerHero::Exp, nLeftExp);
return true;
}
示例11: double
bool NFPatrolState::RandomPatrol(const NFGUID& self, NFIStateMachine* pStateMachine)
{
//首先,得看有没路径
//没有的话,随机找个地址走吧(以出生点为中心开始找,种子地址)NPCConfigID
const std::string& strConfigID = m_pKernelModule->GetPropertyString(self, "NPCConfigID");
const std::string& strNPCID = m_pKernelModule->GetPropertyString(self, "ConfigID");
if (!strConfigID.empty())
{
NF_SHARE_PTR<NFIPropertyManager> xPropertyManager = m_pElementModule->GetPropertyManager(strConfigID);
if (xPropertyManager)
{
NF_SHARE_PTR<NFIProperty> xPropertyX = xPropertyManager->GetElement("SeedX");
NF_SHARE_PTR<NFIProperty> xPropertyY = xPropertyManager->GetElement("SeedY");
NF_SHARE_PTR<NFIProperty> xPropertyZ = xPropertyManager->GetElement("SeedZ");
double fCurX = xPropertyX->GetFloat();
double fCurY = xPropertyY->GetFloat();
double fCurZ = xPropertyZ->GetFloat();
double fPosOffestX = (double)(rand() / double(RAND_MAX) - 0.5);
double fPosOffestZ = (double)(rand() / double(RAND_MAX) - 0.5);
fPosOffestX *= 10;
fPosOffestZ *= 10;
fCurX += fPosOffestX;
fCurZ += fPosOffestZ;
//if (fCurX > 0.0f && fCurZ > 0.0f)
{
//看能否寻路,不能寻路则重来
NFAI_STATE eStateType = NFAI_STATE::ChaseState;
double fRand = (double)(rand() / double(RAND_MAX));
if (fRand < 0.5f)
{
eStateType = NFAI_STATE::ChaseState;
}
NFDataList valueList;
valueList.AddFloat(fCurX);
valueList.AddFloat(fCurY);
valueList.AddFloat(fCurZ);
//m_pKernelModule->DoEvent(self, NFED_ON_CLIENT_REQUIRE_MOVE, valueList);
m_pKernelModule->SetPropertyFloat(self, "X", fCurX);
m_pKernelModule->SetPropertyFloat(self, "Y", fCurY);
m_pKernelModule->SetPropertyFloat(self, "Z", fCurZ);
return true;
}
}
}
return false;
}
示例12:
int NFCRecord::FindVector3(const std::string & strColTag, const NFVector3 & value)
{
NFDataList xDataList;
int nRowCount = FindVector3(strColTag, value, xDataList);
if (nRowCount > 0 && xDataList.GetCount() > 0)
{
return (int) xDataList.Int(0);
}
return -1;
}
示例13: FindString
int NFCRecord::FindString(const int nCol, const std::string & value)
{
NFDataList xDataList;
int nRowCount = FindString(nCol, value, xDataList);
if (nRowCount > 0 && xDataList.GetCount() > 0)
{
return (int) xDataList.Int(0);
}
return -1;
}
示例14: FindFloat
int NFCRecord::FindFloat(const int nCol, const double value)
{
NFDataList xDataList;
int nRowCount = FindFloat(nCol, value, xDataList);
if (nRowCount > 0 && xDataList.GetCount() > 0)
{
return (int) xDataList.Int(0);
}
return -1;
}
示例15: FindRowByColValue
int NFCRecord::FindRowByColValue(const int nCol, const NFData & var)
{
NFDataList xDataList;
int nRowCount = FindRowByColValue(nCol, var, xDataList);
if (nRowCount > 0 && xDataList.GetCount() > 0)
{
return (int) xDataList.Int(0);
}
return -1;
}