int NFCEctypeModule::AddEctypeAward(const NFIDENTID& self, const int nSceneID) { std::string strSceneID = boost::lexical_cast<std::string>(nSceneID); int nType = m_pElementInfoModule->GetPropertyInt(strSceneID, "SceneType"); int nAddMoney = 0; int nAddExp = 0; int nAddDiamnod = 0; NFCDataList xItemList; NFCDataList xCountList; // 掉落奖励 m_pPackModule->DrawDropAward(self, nAddMoney, nAddExp, xItemList, xCountList); // 通关奖励 // 通知客户端 NFCDataList xAwardInfoList; xAwardInfoList << nAddMoney; xAwardInfoList << nAddExp; xAwardInfoList << nAddDiamnod; if (xItemList.GetCount() == xCountList.GetCount()) { for (int i = 0; i < xItemList.GetCount(); ++i) { xAwardInfoList << xItemList.String(i); xAwardInfoList << xCountList.Int(i); } } m_pEventProcessModule->DoEvent(self, NFED_ON_NOTICE_ECTYPE_AWARD, xAwardInfoList); return 0; }
bool NFCEquipModule::DressEquipForHero(const NFGUID& self, const NFGUID& hero, const NFGUID& id) { if (id.IsNull() || self.IsNull() || hero.IsNull()) { return false; } NF_SHARE_PTR<NFIObject> pObject = m_pKernelModule->GetObject(self); if (NULL == pObject) { return false; } NF_SHARE_PTR<NFIRecord> pBagRecord = pObject->GetRecordManager()->GetElement(NFrame::Player::R_BagEquipList()); if (!pBagRecord) { return false; } NF_SHARE_PTR<NFIRecord> pHeroRecord = pObject->GetRecordManager()->GetElement(NFrame::Player::R_PlayerHero()); if (!pHeroRecord) { return false; } NFCDataList xEquipDataList; pBagRecord->FindObject(NFrame::Player::BagEquipList_GUID, id, xEquipDataList); if (xEquipDataList.GetCount() != 1) { return false; } NFCDataList xHeroDataList; pHeroRecord->FindObject(NFrame::Player::PlayerHero_GUID, hero, xHeroDataList); if (xHeroDataList.GetCount() != 1) { return false; } const int nEquipRow = xEquipDataList.Int(0); const int nHeroRow = xHeroDataList.Int(0); const std::string& strEquipID = pBagRecord->GetString(nEquipRow, NFrame::Player::BagEquipList_ConfigID); const int nEquipPos = m_pElementModule->GetPropertyInt(strEquipID, NFrame::Equip::ItemSubType()); if (nEquipRow < 0 || nHeroRow < 0 || strEquipID.empty() || nEquipPos < 0 || nEquipPos > (NFrame::Player::PlayerHero_Equip6 - NFrame::Player::PlayerHero_Equip1)) { return false; } //so there have any bind? //hero, position pHeroRecord->SetObject(nHeroRow, nEquipPos + NFrame::Player::PlayerHero_Equip1, id); pBagRecord->SetObject(nEquipRow, NFrame::Player::BagEquipList_WearGUID, hero); return false; }
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; } NFCDataList 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; }
bool NFCHeroPropertyModule::CalHeroAllProperty(const NFGUID& self, const NFGUID& xHeroGUID, NFIDataList& xDataList) { NF_SHARE_PTR<NFIRecord> pHeroRecord = m_pKernelModule->FindRecord(self, NFrame::Player::R_PlayerHero()); if (nullptr == pHeroRecord) { return false; } NFCDataList varFind; if (pHeroRecord->FindObject(NFrame::Player::PlayerHero_GUID, xHeroGUID, varFind) != 1) { return false; } const int nRow = varFind.Int(0); NF_SHARE_PTR<NFIRecord> pHeroPropertyRecord = m_pKernelModule->FindRecord(self, NFrame::Player::R_HeroPropertyValue()); if (nullptr == pHeroPropertyRecord) { return false; } NFCDataList xHeroPropertyValue; CalHeroBaseProperty(self, xHeroGUID, xHeroPropertyValue); NFCDataList xHeroTalentValue; CalHeroTalentProperty(self, xHeroGUID, xHeroTalentValue); NFCDataList xHeroEquipValue; CalHeroEquipProperty(self, xHeroGUID, xHeroEquipValue); for (int i = 0; i < pHeroPropertyRecord->GetCols(); ++i) { int nPropertyValue = 0; int nTalentValue = 0; int nEquipValue = 0; if (xHeroPropertyValue.GetCount() == pHeroPropertyRecord->GetCols()) { nPropertyValue = xHeroPropertyValue.Int(i); } if (xHeroTalentValue.GetCount() == pHeroPropertyRecord->GetCols()) { nTalentValue = xHeroTalentValue.Int(i); } if (xHeroEquipValue.GetCount() == pHeroPropertyRecord->GetCols()) { nEquipValue = xHeroEquipValue.Int(i); } int nAllValue = nPropertyValue + nTalentValue + nEquipValue; xDataList.AddInt(nAllValue); } return true; }
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; } NFCDataList 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)) { //NFCDataList varHeart; //varHeart << xBuilID; //varHeart << strItemID; m_pScheduleModule->AddSchedule(self, strHeartname, this, &NFCSLGBuildingModule::OnProduceHeartBeat, /*varHeart, */nTime, nCount); } return 0; }
bool NFCEctypeModule::CanEntryCloneScene(const NFIDENTID self, const int nContainerID) { std::string strSceneID = boost::lexical_cast<std::string>(nContainerID); //如果没找到,就判断是否是第一个场景IsFirstCloneScene int nLevel = m_pKernelModule->GetPropertyInt(self, "Level"); if (nLevel < m_pElementInfoModule->GetPropertyInt(strSceneID, "SceneLevelLimit")) { m_pLogModule->LogNormal(NFILogModule::NLL_ERROR_NORMAL, self, "Level limit for scene:" + strSceneID, nLevel, __FUNCTION__, __LINE__); return false; } //更改后则直接看是否存在 NF_SHARE_PTR<NFIRecord> pRecord = m_pKernelModule->FindRecord(self, "EctypeList"); if (!pRecord.get()) { return false; } NFCDataList valNormalResult; pRecord->FindInt(EXTYPE_RC_SCENEID, nContainerID, valNormalResult); if (valNormalResult.GetCount() <= 0) { m_pLogModule->LogNormal(NFILogModule::NLL_ERROR_NORMAL, self, "no this scene in record", nContainerID, __FUNCTION__, __LINE__); return false; } return true; }
bool NFCEquipModule::AddEquipIntensifyLevel(const NFGUID& self, const NFGUID& id) { if (id.IsNull() || self.IsNull()) { return false; } NF_SHARE_PTR<NFIObject> pObject = m_pKernelModule->GetObject(self); if (NULL == pObject) { return false; } NF_SHARE_PTR<NFIRecord> pRecord = pObject->GetRecordManager()->GetElement(NFrame::Player::R_BagEquipList()); if (!pRecord) { return false; } NFCDataList xDataList; pRecord->FindObject(NFrame::Player::BagEquipList_GUID, id, xDataList); if (xDataList.GetCount() != 1) { return false; } const int nRow = xDataList.Int(0); const int nLevel = pRecord->GetInt(nRow, NFrame::Player::BagEquipList_IntensifyLevel); pRecord->SetInt(nRow, NFrame::Player::BagEquipList_IntensifyLevel, nLevel + 1); return true; }
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; } NFCDataList 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;//加速时间 // TO ADD const std::string strBuildID = pRecord->GetString(nRow, "BuildingID"); //NFCDataList varHeart; //varHeart << xBuilID; m_pKernelModule->AddHeartBeat(self, "OnBoostHeartBeat", this, &NFCSLGBuildingModule::OnBoostHeartBeat, /*varHeart,*/ nBoostTime, 1); //修改建筑的状态 pRecord->SetInt(nRow, "State", NFMsg::EBS_BOOST); pRecord->SetInt(nRow, "StateStartTime", NFTimeEx::GetNowTime()); pRecord->SetInt(nRow, "StateEndTime", NFTimeEx::GetNowTime() + nBoostTime); return 0; }
bool NFCWorldGuildModule::KickGuildMmember( const NFIDENTID& self, const NFIDENTID& xGuildID, const NFIDENTID& xMmember ) { NF_SHARE_PTR<NFIObject> pGuildObject = m_pWorldGuildDataModule->GetGuild(xGuildID); if (!pGuildObject.get()) { return false; } NF_SHARE_PTR<NFIRecord> pMemberRecord = m_pKernelModule->FindRecord(xGuildID, "GuildMemberList"); if (!pMemberRecord.get()) { return false; } if (self == xMmember) { return false; } CheckPower(self, xGuildID, NFMsg::ReqAckOprGuildMember::EGAT_KICK); NFCDataList varList; pMemberRecord->FindObject(NFMsg::GuildMemberList_GUID, self, varList); if (varList.GetCount() == 0) { return false; } const int nRow = varList.Int(0); pMemberRecord->Remove(nRow); return true; }
int NFCSLGBuildingModule::Upgrade(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; } NFCDataList 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 nNeedTime = 20; const std::string strBuildID = pRecord->GetString(nRow, "BuildingID"); //NFCDataList varHeart; //varHeart << xBuilID; m_pScheduleModule->AddSchedule(self, "OnUpgradeHeartBeat", this, &NFCSLGBuildingModule::OnUpgradeHeartBeat, /*varHeart,*/ nNeedTime, 1); pRecord->SetInt(nRow, "State", NFMsg::EBS_UPGRADE); pRecord->SetInt(nRow, "StateStartTime", pPluginManager->GetNowTime()); pRecord->SetInt(nRow, "StateEndTime", pPluginManager->GetNowTime() + nNeedTime); return 0; }
bool NFCWorldGuildModule::UpGuildMmember( const NFIDENTID& self, const NFIDENTID& xGuildID, const NFIDENTID& xMmember ) { NF_SHARE_PTR<NFIObject> pGuildObject = m_pWorldGuildDataModule->GetGuild(xGuildID); if (!pGuildObject.get()) { return false; } NF_SHARE_PTR<NFIRecord> pMemberRecord = m_pKernelModule->FindRecord(xGuildID, "GuildMemberList"); if (!pMemberRecord.get()) { return false; } CheckPower(self, xGuildID, NFMsg::ReqAckOprGuildMember::EGAT_UP); NFCDataList varList; pMemberRecord->FindObject(NFMsg::GuildMemberList_GUID, self, varList); if (varList.GetCount() == 0) { return false; } const int nRow = varList.Int(0); const int nPower = pMemberRecord->GetInt(nRow, NFMsg::GuildMemberList_Power); if (nPower >= NFMsg::GUILD_POWER_TYPE_PRESIDENT) { return false; } pMemberRecord->SetInt(nRow, NFMsg::GuildMemberList_Power, (nPower + 1)) ; return true; }
int NFCPropertyTrailModule::OnObjectRecordEvent(const NFGUID& self, const RECORD_EVENT_DATA& xEventData, const NFIDataList::TData& oldVar, const NFIDataList::TData& newVar) { std::ostringstream stream; NF_SHARE_PTR<NFIRecord> xRecord = m_pKernelModule->FindRecord(self, xEventData.strRecordName); if (nullptr == xRecord) { return 0; } switch (xEventData.nOpType) { case NFIRecord::RecordOptype::Add: { NFCDataList xDataList; bool bRet = xRecord->QueryRow(xEventData.nRow, xDataList); if (bRet) { stream << " Trail Add Row[" << xEventData.nRow << "]"; for (int j = 0; j < xDataList.GetCount(); ++j) { stream << " [" << j << "] " << xDataList.StringValEx(j); } m_pLogModule->LogRecord(NFILogModule::NF_LOG_LEVEL::NLL_INFO_NORMAL, self, xRecord->GetName(), stream.str(), __FUNCTION__, __LINE__); } } break; case NFIRecord::RecordOptype::Del: { stream << " Trail Del Row[" << xEventData.nRow << "]"; m_pLogModule->LogRecord(NFILogModule::NF_LOG_LEVEL::NLL_INFO_NORMAL, self, xRecord->GetName(), stream.str(), __FUNCTION__, __LINE__); } break; case NFIRecord::RecordOptype::Swap: { stream << " Trail Swap Row[" << xEventData.nRow << "] Row[" << xEventData.nCol << "]"; m_pLogModule->LogRecord(NFILogModule::NF_LOG_LEVEL::NLL_INFO_NORMAL, self, xRecord->GetName(), stream.str(), __FUNCTION__, __LINE__); } break; case NFIRecord::RecordOptype::Create: break; case NFIRecord::RecordOptype::Update: { stream << " Trail UpData Row[" << xEventData.nRow << "] Col[" << xEventData.nCol << "]"; stream << " [Old] " << oldVar.StringValEx(); stream << " [New] " << newVar.StringValEx(); m_pLogModule->LogRecord(NFILogModule::NF_LOG_LEVEL::NLL_INFO_NORMAL, self, xRecord->GetName(), stream.str(), __FUNCTION__, __LINE__); } break; case NFIRecord::RecordOptype::Cleared: break; case NFIRecord::RecordOptype::Sort: break; default: break; } return 0; }
const int NFCGridModule::GetAroundObject(NFCSceneGridInfo* pGridInfo, NFIDataList& objectList, EGRID_AROUND eAround /*= EGRID_AROUND_9 */) { if (!pGridInfo) { return 0; } NFCDataList gridList; if (GetAroundGrid(pGridInfo, gridList, eAround) > 0) { for (int i = 0; i < gridList.GetCount(); i++) { NFCSceneGridInfo* pGridInfo = (NFCSceneGridInfo*)(gridList.Pointer(i)); if (pGridInfo) { NFIDENTID ident; bool bRet = pGridInfo->First(ident); while (bRet) { objectList.Add(ident); bRet = pGridInfo->Next(ident); } } } } return objectList.GetCount(); }
int NFCEquipModule::GetEquipHoleCount(const NFGUID & self, const NFGUID & id) { if (id.IsNull() || self.IsNull()) { return false; } NF_SHARE_PTR<NFIObject> pObject = m_pKernelModule->GetObject(self); if (NULL == pObject) { return false; } NF_SHARE_PTR<NFIRecord> pRecord = pObject->GetRecordManager()->GetElement(NFrame::Player::R_BagEquipList()); if (!pRecord) { return false; } NFCDataList xDataList; pRecord->FindObject(NFrame::Player::BagEquipList_GUID, id, xDataList); if (xDataList.GetCount() != 1) { return false; } const int nRow = xDataList.Int(0); return pRecord->GetInt(nRow, NFrame::Player::BagEquipList_SlotCount); }
int NFCEquipModule::GetEquipElementLevel(const NFGUID & self, const NFGUID & id, NFrame::Player::BagEquipList eIndex) { if (id.IsNull() || self.IsNull()) { return -1; } if (eIndex > NFrame::Player::BagEquipList_ElementLevel5_POISON || eIndex < NFrame::Player::BagEquipList_ElementLevel1_FIRE) { return -1; } NF_SHARE_PTR<NFIObject> pObject = m_pKernelModule->GetObject(self); if (NULL == pObject) { return -1; } NF_SHARE_PTR<NFIRecord> pRecord = pObject->GetRecordManager()->GetElement(NFrame::Player::R_BagEquipList()); if (!pRecord) { return -1; } NFCDataList xDataList; pRecord->FindObject(NFrame::Player::BagEquipList_GUID, id, xDataList); if (xDataList.GetCount() != 1) { return -1; } const int nRow = xDataList.Int(0); return pRecord->GetInt(nRow, eIndex); }
bool NFCPackModule::DeleteEquip( const NFGUID& self, const NFGUID& id ) { if (id.IsNull()) { return false; } //删除3个地方,背包,英雄穿戴,玩家穿戴 NF_SHARE_PTR<NFIObject> pObject = m_pKernelModule->GetObject( self ); if (nullptr == pObject) { return false; } NF_SHARE_PTR<NFIRecord> pRecord = pObject->GetRecordManager()->GetElement( NFrame::Player::R_BagEquipList() ); if (nullptr == pRecord) { return false; } NFCDataList varFindResult; int nFindRowCount = pRecord->FindObject(NFrame::Player::BagItemList_ConfigID, id, varFindResult); if (nFindRowCount > 0) { int nTotalCount = 0; for (int i = 0; i < varFindResult.GetCount(); ++i) { int nFindRow = varFindResult.Int(i); pRecord->Remove(nFindRow); } } return true; }
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::R_BagItemList() ); if (!pRecord) { return false; } NFCDataList 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.Int(i); int nOldCount = pRecord->GetInt(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; }
bool NFCWorldGuildModule::MemberOffeline( const NFIDENTID& self, const NFIDENTID& xGuild ) { NF_SHARE_PTR<NFIObject> pGuildObject = m_pWorldGuildDataModule->GetGuild(xGuild); if (!pGuildObject.get()) { return false; } NF_SHARE_PTR<NFIRecord> pMemberRecord = m_pKernelModule->FindRecord(xGuild, "GuildMemberList"); if (!pMemberRecord.get()) { return false; } NFCDataList varList; pMemberRecord->FindObject(NFMsg::GuildMemberList_GUID, self, varList); if (varList.GetCount() <= 0) { return false; } const int nRow = varList.Int(0); pMemberRecord->SetInt(nRow, NFMsg::GuildMemberList_Online, 0); pMemberRecord->SetInt(nRow, NFMsg::GuildMemberList_GameID, 0); return true; }
bool NFCWorldGuildModule::LeaveGuild( const NFIDENTID& self, const NFIDENTID& xGuildID ) { NF_SHARE_PTR<NFIObject> pGuildObject = m_pWorldGuildDataModule->GetGuild(xGuildID); if (!pGuildObject.get()) { return false; } NF_SHARE_PTR<NFIRecord> pMemberRecord = m_pKernelModule->FindRecord(xGuildID, "GuildMemberList"); if (!pMemberRecord.get()) { return false; } NFCDataList varList; pMemberRecord->FindObject(NFMsg::GuildMemberList_GUID, self, varList); if (varList.GetCount() == 0) { return false; } const int nRow = varList.Int(0); return pMemberRecord->Remove(nRow); }
int NFCPropertyTrailModule::LogObjectData(const NFGUID& self) { NF_SHARE_PTR<NFIObject> xObject = m_pKernelModule->GetObject(self); if (nullptr == xObject) { return -1; } NF_SHARE_PTR<NFIPropertyManager> xPropertyManager = xObject->GetPropertyManager(); if (nullptr != xPropertyManager) { NF_SHARE_PTR<NFIProperty> xProperty = xPropertyManager->First(); while (nullptr != xProperty) { std::ostringstream stream; stream << " Start trail "; stream << xProperty->ToString(); m_pLogModule->LogProperty(NFILogModule::NF_LOG_LEVEL::NLL_INFO_NORMAL, self, xProperty->GetKey(), stream.str(), __FUNCTION__, __LINE__); xProperty = xPropertyManager->Next(); } } NF_SHARE_PTR<NFIRecordManager> xRecordManager = xObject->GetRecordManager(); if (nullptr != xRecordManager) { NF_SHARE_PTR<NFIRecord> xRecord = xRecordManager->First(); while (nullptr != xRecord) { for (int i = 0; i < xRecord->GetRows(); ++i) { NFCDataList xDataList; bool bRet = xRecord->QueryRow(i, xDataList); if (bRet) { std::ostringstream stream; stream << " Start trail Row[" << i << "]"; for (int j = 0; j < xDataList.GetCount(); ++j) { stream << " [" << j << "] " << xDataList.StringValEx(j); } m_pLogModule->LogRecord(NFILogModule::NF_LOG_LEVEL::NLL_INFO_NORMAL, self, xRecord->GetName(), stream.str(), __FUNCTION__, __LINE__); } } xRecord = xRecordManager->Next(); } } return 0; }
int NFCSkillModule::ExistSkill( const NFGUID& self, const std::string& strSkillName ) { NF_SHARE_PTR<NFIRecord> pRecord = m_pKernelModule->FindRecord( self, mstrSkillTableName ); if ( pRecord ) { NFCDataList varResult; pRecord->FindString( EGameSkillStoreType::EGSST_TYPE_SKILL_CONFIGID, strSkillName.c_str(), varResult ); if ( varResult.GetCount() == 1 ) { return varResult.Int( 0 ); } } return -1; }
bool NFCEquipModule::SetEquipInlayStoneID(const NFGUID& self, const NFGUID& id, NFrame::Player::BagEquipList eIndex, const std::string& strStoneID) { if (id.IsNull() || self.IsNull() || strStoneID.empty()) { return false; } if (eIndex > NFrame::Player::BagEquipList_InlayStone10 || eIndex < NFrame::Player::BagEquipList_InlayStone1) { return false; } if (!m_pElementModule->ExistElement(strStoneID)) { return false; } NF_SHARE_PTR<NFIObject> pObject = m_pKernelModule->GetObject(self); if (NULL == pObject) { return false; } NF_SHARE_PTR<NFIRecord> pRecord = pObject->GetRecordManager()->GetElement(NFrame::Player::R_BagEquipList()); if (!pRecord) { return false; } NFCDataList xDataList; pRecord->FindObject(NFrame::Player::BagEquipList_GUID, id, xDataList); if (xDataList.GetCount() != 1) { return false; } const int nRow = xDataList.Int(0); const int nSoltCount = pRecord->GetInt(nRow, NFrame::Player::BagEquipList_SlotCount); if ((eIndex - NFrame::Player::BagEquipList_InlayStone1) <= nSoltCount) { return false; } pRecord->SetString(nRow, eIndex, strStoneID); return true; }
bool NFCPackModule::EnoughItem( 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; } //还得确定有这个装备 bool bExist = m_pElementModule->ExistElement(NFrame::Item::ThisName(), strItemConfigID ); if ( !bExist ) { return false; } NF_SHARE_PTR<NFIRecord> pRecord = pObject->GetRecordManager()->GetElement( NFrame::Player::R_BagItemList() ); if (!pRecord) { return false; } NFCDataList varFindResult; int nFindRowCount = pRecord->FindString(NFrame::Player::BagItemList_ConfigID, strItemConfigID, varFindResult); if (nFindRowCount > 0) { int nTotalCount = 0; for (int i = 0; i < varFindResult.GetCount(); ++i) { int nFindRow = varFindResult.Int(i); int nOldCount = pRecord->GetInt(nFindRow, NFrame::Player::BagItemList_ItemCount); nTotalCount += nOldCount; } if (nTotalCount > 0) { return true; } } return false; }
int NFCSLGBuildingModule::AddProduceData(const NFGUID& self, const NFGUID& xBuilID, const std::string& strItemID, const 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 1; } NFCDataList varProduce; pProduce->FindObject("BuildingGUID", xBuilID, varProduce); int nFindRow = -1; for (int i = 0; i< varProduce.GetCount(); i++) { const std::string& strHasItemID = pProduce->GetString(i, "ItemID"); if (strHasItemID == strItemID) { nFindRow = i; break; } } if (nFindRow < 0) { //already exit const int nOldCount = pProduce->GetInt(nFindRow, "LeftCount"); pProduce->SetInt(nFindRow, "LeftCount", nOldCount + nCount); } else { const int nTime = 20; NFCDataList varItem; varItem << xBuilID; varItem << strItemID; varItem << nCount; varItem << nTime; varItem << pPluginManager->GetNowTime(); pProduce->AddRow(-1, varItem); } return 0; }
bool NFCSceneProcessModule::DestroyCloneScene( const int& nContainerID, const int& nGroupID, const NFIDataList& arg ) { //无条件删除 NFCDataList valueAllObjectList; m_pKernelModule->GetGroupObjectList( nContainerID, nGroupID, valueAllObjectList ); for (int i = 0; i < valueAllObjectList.GetCount(); ++i) { NFIDENTID ident = valueAllObjectList.Object( i ); std::string strObjClassName = m_pKernelModule->GetPropertyString( ident, "ClassName" ); if ( "Player" != strObjClassName ) { m_pKernelModule->DestroyObject(ident); } } m_pKernelModule->ReleaseGroupScene(nContainerID, nGroupID); return false; }
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; }
bool NFCEquipModule::SetEquipRandPropertyID(const NFGUID& self, const NFGUID& id, const std::string& strPropertyID) { if (id.IsNull() || self.IsNull() || strPropertyID.empty()) { return false; } if (!m_pElementModule->ExistElement(strPropertyID)) { return false; } NF_SHARE_PTR<NFIObject> pObject = m_pKernelModule->GetObject(self); if (NULL == pObject) { return false; } NF_SHARE_PTR<NFIRecord> pRecord = pObject->GetRecordManager()->GetElement(NFrame::Player::R_BagEquipList()); if (!pRecord) { return false; } NFCDataList xDataList; pRecord->FindObject(NFrame::Player::BagEquipList_GUID, id, xDataList); if (xDataList.GetCount() != 1) { return false; } const int nRow = xDataList.Int(0); pRecord->SetString(nRow, NFrame::Player::BagEquipList_RandPropertyID, strPropertyID); return true; }
bool NFCWorldGuildModule::CheckPower( const NFIDENTID& self, const NFIDENTID& xGuildID, int nPowerType ) { NF_SHARE_PTR<NFIObject> pGuildObject = m_pWorldGuildDataModule->GetGuild(xGuildID); if (pGuildObject.get()) { NF_SHARE_PTR<NFIRecord> pMemberRecord = m_pKernelModule->FindRecord(xGuildID, "GuildMemberList"); if (pMemberRecord.get()) { NFCDataList varList; pMemberRecord->FindObject(NFMsg::GuildMemberList_GUID, self, varList); if (varList.GetCount() == 1) { const int nRow = varList.Int(0); const int nPower = pMemberRecord->GetInt(nRow, NFMsg::GuildMemberList_Power); if (nPower >= NFMsg::GUILD_POWER_TYPE_PRESIDENT) { return true; } } } } return false; }
bool NFCProperty::DeSerialization() { bool bRet = false; const TDATA_TYPE eType = GetType(); if (eType == TDATA_STRING && nullptr != mxData && !mxData->IsNullValue()) { NFCDataList xDataList; const std::string& strData = mxData->GetString(); xDataList.Split(strData.c_str(), ";"); if (xDataList.GetCount() <= 0) { return bRet; } NFCDataList xTemDataList; xTemDataList.Split(xDataList.String(0).c_str(), ","); const int nSubDataLength = xTemDataList.GetCount(); if (xDataList.GetCount() == 1 && nSubDataLength == 1) { //most of property value only one value return bRet; } if (nullptr == mxEmbeddedList) { mxEmbeddedList = NF_SHARE_PTR<NFList<std::string>>(NF_NEW NFList<std::string>()); } else { mxEmbeddedList->ClearAll(); } for (int i = 0; i < xDataList.GetCount(); ++i) { if (xDataList.String(i).empty()) { NFASSERT(0, strData, __FILE__, __FUNCTION__); } mxEmbeddedList->Add(xDataList.String(i)); } //////////////////////////////////////// if (nSubDataLength < 2 || nSubDataLength > 2) { return bRet; } if (nullptr == mxEmbeddedMap) { mxEmbeddedMap = NF_SHARE_PTR<NFMapEx<std::string, std::string>>(NF_NEW NFMapEx<std::string, std::string>()); } else { mxEmbeddedMap->ClearAll(); } for (int i = 0; i < xDataList.GetCount(); ++i) { NFCDataList xTemDataList; const std::string& strTemData = xDataList.String(i); xTemDataList.Split(strTemData.c_str(), ","); { if (xTemDataList.GetCount() != nSubDataLength) { NFASSERT(0, strTemData, __FILE__, __FUNCTION__); } const std::string& strKey = xTemDataList.String(0); const std::string& strValue = xTemDataList.String(1); if (strKey.empty() || strValue.empty()) { NFASSERT(0, strTemData, __FILE__, __FUNCTION__); } mxEmbeddedMap->AddElement(strKey, NF_SHARE_PTR<std::string>(NF_NEW std::string(strValue))); } } bRet = true; } return bRet; }
bool NFCWorldGuildModule::JoinGuild( const NFIDENTID& self, const NFIDENTID& xGuildID ) { NF_SHARE_PTR<NFIObject> pGuildObject = m_pWorldGuildDataModule->GetGuild(xGuildID); if (!pGuildObject.get()) { return false; } NF_SHARE_PTR<NFIRecord> pMemberRecord = m_pKernelModule->FindRecord(xGuildID, "GuildMemberList"); if (!pMemberRecord.get()) { return false; } NFCDataList varList; pMemberRecord->FindObject(NFMsg::GuildMemberList_GUID, self, varList); if (varList.GetCount() > 0) { return false; } const NFINT64 nCount = m_pKernelModule->GetPropertyInt(xGuildID, "GuildMemeberCount"); if (nCount >= m_pKernelModule->GetPropertyInt(xGuildID, "GuildMemeberMaxCount")) { //limit return false; } NFCDataList varData; std::string strName ; int nLevel = 0; int nJob = 0; int nDonation = 0; int nReceive = 0; int nVIP = 0; int nOnLine = 0; int nPower = NFMsg::GUILD_POWER_TYPE_NORMAL; const NFIDENTID& xPresident = pGuildObject->GetPropertyObject("PresidentID"); if (xPresident == self) { nPower = NFMsg::GUILD_POWER_TYPE_PRESIDENT; } int nTitle = 0; int nOnlineGameID = 0; m_pWorldGuildDataModule->GetPlayerGameID(self, nOnlineGameID); m_pWorldGuildDataModule->GetPlayerInfo(self, strName, nLevel, nJob, nDonation, nVIP); varData << self << strName << (NFINT64)nLevel << (NFINT64)nJob << (NFINT64)nDonation << (NFINT64)nReceive << (NFINT64)nVIP << (NFINT64)nOnLine << (NFINT64)nPower << nTitle << nOnlineGameID ; if (pMemberRecord->AddRow(-1, varData) < 0) { return false; } m_pKernelModule->SetPropertyInt(xGuildID, "GuildMemeberCount", nCount+1); return true; }