bool NFCGuildModule::UpGuildMmember( const NFGUID& self, const NFGUID& xGuildID, const NFGUID& xMmember ) { NF_SHARE_PTR<NFIObject> pGuildObject = m_pGuildDataModule->GetGuild(xGuildID); if (!pGuildObject.get()) { return false; } NF_SHARE_PTR<NFIRecord> pMemberRecord = m_pKernelModule->FindRecord(xGuildID, NFrame::Guild::R_GuildMemberList()); if (!pMemberRecord.get()) { return false; } CheckPower(self, xGuildID, NFMsg::ReqAckOprGuildMember::EGAT_UP); NFDataList varList; pMemberRecord->FindObject(NFrame::Guild::GuildMemberList_GUID, self, varList); if (varList.GetCount() == 0) { return false; } const int nRow = varList.Int(0); const int nPower = pMemberRecord->GetInt(nRow, NFrame::Guild::GuildMemberList_Power); if (nPower >= NFMsg::GUILD_POWER_TYPE_PRESIDENT) { return false; } pMemberRecord->SetInt(nRow, NFrame::Guild::GuildMemberList_Power, (nPower + 1)) ; return true; }
bool NFCGuildModule::MemberOffline( const NFGUID& self, const NFGUID& xGuild ) { NF_SHARE_PTR<NFIObject> pGuildObject = m_pGuildDataModule->GetGuild(xGuild); if (!pGuildObject.get()) { return false; } NF_SHARE_PTR<NFIRecord> pMemberRecord = m_pKernelModule->FindRecord(xGuild, NFrame::Guild::R_GuildMemberList()); if (!pMemberRecord.get()) { return false; } NFDataList varList; pMemberRecord->FindObject(NFrame::Guild::GuildMemberList_GUID, self, varList); if (varList.GetCount() <= 0) { return false; } const int nRow = varList.Int(0); pMemberRecord->SetInt(nRow, NFrame::Guild::GuildMemberList_Online, 0); pMemberRecord->SetInt(nRow, NFrame::Guild::GuildMemberList_GameID, 0); return true; }
bool NFCGuildModule::KickGuildMmember( const NFGUID& self, const NFGUID& xGuildID, const NFGUID& xMmember ) { NF_SHARE_PTR<NFIObject> pGuildObject = m_pGuildDataModule->GetGuild(xGuildID); if (!pGuildObject.get()) { return false; } NF_SHARE_PTR<NFIRecord> pMemberRecord = m_pKernelModule->FindRecord(xGuildID, NFrame::Guild::R_GuildMemberList()); if (!pMemberRecord.get()) { return false; } if (self == xMmember) { return false; } CheckPower(self, xGuildID, NFMsg::ReqAckOprGuildMember::EGAT_KICK); NFDataList varList; pMemberRecord->FindObject(NFrame::Guild::GuildMemberList_GUID, self, varList); if (varList.GetCount() == 0) { return false; } const int nRow = varList.Int(0); pMemberRecord->Remove(nRow); 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; } 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; }
bool NFCGuildModule::LeaveGuild( const NFGUID& self, const NFGUID& xGuildID ) { NF_SHARE_PTR<NFIObject> pGuildObject = m_pGuildDataModule->GetGuild(xGuildID); if (!pGuildObject.get()) { return false; } NF_SHARE_PTR<NFIRecord> pMemberRecord = m_pKernelModule->FindRecord(xGuildID, NFrame::Guild::R_GuildMemberList()); if (!pMemberRecord.get()) { return false; } NFDataList varList; pMemberRecord->FindObject(NFrame::Guild::GuildMemberList_GUID, self, varList); if (varList.GetCount() == 0) { return false; } const int nRow = varList.Int(0); return pMemberRecord->Remove(nRow); }
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; }
int NFCRecord::FindRowByColValue(const std::string & strColTag, const NFData & var) { NFDataList xDataList; int nRowCount = FindRowByColValue(strColTag, var, xDataList); if (nRowCount > 0 && xDataList.GetCount() > 0) { return (int) xDataList.Int(0); } return -1; }
int NFCRecord::FindVector3(const int nCol, const NFVector3 & value) { NFDataList xDataList; int nRowCount = FindVector3(nCol, value, xDataList); if (nRowCount > 0 && xDataList.GetCount() > 0) { return (int) xDataList.Int(0); } return -1; }
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; }
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; }
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; }
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; }
bool NFCWorldNet_ServerModule::SendMsgToGame(const NFDataList& argObjectVar, const NFDataList& argGameID, const NFMsg::EGameMsgID eMsgID, google::protobuf::Message& xData) { if (argGameID.GetCount() != argObjectVar.GetCount()) { return false; } for (int i = 0; i < argObjectVar.GetCount(); i++) { const NFGUID& identOther = argObjectVar.Object(i); const int nGameID = (int) argGameID.Int(i); SendMsgToGame(nGameID, eMsgID, xData, identOther); } return true; }
bool NFCGuildModule::CheckPower( const NFGUID& self, const NFGUID& xGuildID, int nPowerType ) { NF_SHARE_PTR<NFIObject> pGuildObject = m_pGuildDataModule->GetGuild(xGuildID); if (pGuildObject.get()) { NF_SHARE_PTR<NFIRecord> pMemberRecord = m_pKernelModule->FindRecord(xGuildID, NFrame::Guild::R_GuildMemberList()); if (pMemberRecord.get()) { NFDataList varList; pMemberRecord->FindObject(NFrame::Guild::GuildMemberList_GUID, self, varList); if (varList.GetCount() == 1) { const int nRow = varList.Int(0); const int nPower = pMemberRecord->GetInt(nRow, NFrame::Guild::GuildMemberList_Power); if (nPower >= NFMsg::GUILD_POWER_TYPE_PRESIDENT) { return true; } } } } return false; }
bool NFCStateMachine::Execute() { //same for the current state if (State_Error != meCurrentState) { if (mfHeartBeatTime > 0) { mfHeartBeatTime -= 0.001f; } else { NFIState* pState = GetState(meCurrentState); pState->Execute(mOwnerID, this); //设置心跳时间 NFDataList xDataList; m_pKernelModule->Random(0, 10, 1, xDataList); mfHeartBeatTime = pState->GetHeartBeatTime() + xDataList.Int(0); } } return true; }
int NFCSLGBuildingModule::Move(const NFGUID& self, const NFGUID nGUID, const float fX, const float fY, const float fZ) { 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 xMatchList; int nMatchCount = pRecord->FindObject(BUILDING_GUID, nGUID, xMatchList); if (nMatchCount != 1) { m_pLogModule->LogNormal(NFILogModule::NLL_ERROR_NORMAL, self, "[BuildingList] Record !", "", __FUNCTION__, __LINE__); return 1; } int nMatchRow = xMatchList.Int(0); pRecord->SetInt(nMatchRow, BUILDINNG_X, fX); pRecord->SetInt(nMatchRow, BUILDINNG_Y, fY); pRecord->SetInt(nMatchRow, BUILDINNG_Z, fZ); return 0; }
bool NFCEquipPropertyModule::CalEquipGemProperty(const NFGUID& self, const NFGUID& xEquipGUID, NFDataList& xDataList) { NF_SHARE_PTR<NFIRecord> pBagRecord = m_pKernelModule->FindRecord(self, NFrame::Player::BagEquipList::ThisName()); if (nullptr == pBagRecord) { return false; } NF_SHARE_PTR<NFIRecord> pCommPropertyValueRecord = m_pKernelModule->FindRecord(self, NFrame::Player::CommValue::ThisName()); if (nullptr == pCommPropertyValueRecord) { return false; } NFDataList varFind; if (pBagRecord->FindObject(NFrame::Player::BagEquipList::GUID, xEquipGUID, varFind) != 1) { return false; } const int nRow = varFind.Int32(0); xDataList.Clear(); /////////////GemBase///////////////////////////////////////// int nSlotCount = pBagRecord->GetInt32(nRow, NFrame::Player::BagEquipList::SlotCount); if (nSlotCount <= 0) { return false; } for (int i = 0; i < pCommPropertyValueRecord->GetCols(); ++i) { xDataList.AddInt(0); } for (int i = NFrame::Player::BagEquipList::InlayStone1; i <= NFrame::Player::BagEquipList::InlayStone10; ++i) { int nIndex = i - NFrame::Player::BagEquipList::InlayStone1; if (nIndex > nSlotCount) { break; } const std::string& strGemID = pBagRecord->GetString(nRow, i); if (strGemID.empty()) { continue; } const std::string& strGemEffectData = m_pElementModule->GetPropertyString(strGemID, NFrame::Item::EffectData()); if (strGemEffectData.empty()) { continue; } //one gem for (int j = 0; j < pCommPropertyValueRecord->GetCols(); ++j) { const std::string& strColTag = pCommPropertyValueRecord->GetColTag(j); int64_t nValue = m_pElementModule->GetPropertyInt(strGemEffectData, strColTag); int64_t nOldValue = xDataList.Int(j); xDataList.SetInt(j, nOldValue + nValue); } } return true; }
bool NFCEquipPropertyModule::CalEquipProperty(const NFGUID& self, const NFGUID& xEquipGUID, NFDataList& xDataList) { NF_SHARE_PTR<NFIRecord> pBagRecord = m_pKernelModule->FindRecord(self, NFrame::Player::BagEquipList::ThisName()); if (nullptr == pBagRecord) { return false; } NF_SHARE_PTR<NFIRecord> pCommPropertyValueRecord = m_pKernelModule->FindRecord(self, NFrame::Player::CommValue::ThisName()); if (nullptr == pCommPropertyValueRecord) { return false; } NFDataList varFind; if (pBagRecord->FindObject(NFrame::Player::BagEquipList::GUID, xEquipGUID, varFind) != 1) { return false; } //const int nRow = varFind.Int32(0); xDataList.Clear(); NFDataList xEquipBaseValue; CalEquipBaseProperty(self, xEquipGUID, xEquipBaseValue); NFDataList xEquipRandonValue; CalEquipRandomProperty(self, xEquipGUID, xEquipRandonValue); NFDataList xEquipGemValue; CalEquipGemProperty(self, xEquipGUID, xEquipGemValue); NFDataList xEquipIntensifyValue; CalEquipIntensifyProperty(self, xEquipGUID, xEquipIntensifyValue); NFDataList xEquipElementValue; CalEquipElementProperty(self, xEquipGUID, xEquipElementValue); for (int i = 0; i < pCommPropertyValueRecord->GetCols(); ++i) { int64_t nBaseValue = 0; int64_t nRandonValue = 0; int64_t nGemValue = 0; int64_t nIntensifyValue = 0; int64_t nElementValue = 0; if (xEquipBaseValue.GetCount() == pCommPropertyValueRecord->GetCols()) { nBaseValue = xEquipBaseValue.Int(i); } if (xEquipRandonValue.GetCount() == pCommPropertyValueRecord->GetCols()) { nRandonValue = xEquipRandonValue.Int(i); } if (xEquipGemValue.GetCount() == pCommPropertyValueRecord->GetCols()) { nGemValue = xEquipGemValue.Int(i); } if (xEquipIntensifyValue.GetCount() == pCommPropertyValueRecord->GetCols()) { nIntensifyValue = xEquipIntensifyValue.Int(i); } if (xEquipElementValue.GetCount() == pCommPropertyValueRecord->GetCols()) { nElementValue = xEquipElementValue.Int(i); } int64_t nAllValue = nBaseValue + nRandonValue + nGemValue + nIntensifyValue + nElementValue; xDataList.AddInt(nAllValue); } return true; }