bool NFCGuildModule::GetOnlineMember( const NFGUID& self, const NFGUID& xGuild, NFDataList& varMemberList, NFDataList& varGameList) { 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; } for (int i = 0; i< pMemberRecord->GetRows(); i++) { if (!pMemberRecord->IsUsed(i)) { continue; } const NFINT64 nOnline = pMemberRecord->GetInt(i, NFrame::Guild::GuildMemberList_Online); const NFINT64 nGameID = pMemberRecord->GetInt(i, NFrame::Guild::GuildMemberList_GameID); const NFGUID& xID = pMemberRecord->GetObject(i, NFrame::Guild::GuildMemberList_GUID); if (nOnline > 0 && !xID.IsNull()) { varMemberList.Add(xID); varGameList.Add(nGameID); } } return true; }
void NFCPlayerLogic::OnObjectEntry(const NFSOCK nSockIndex, const int nMsgID, const char* msg, const uint32_t nLen) { NFGUID nPlayerID; NFMsg::AckPlayerEntryList xMsg; if (!NFINetModule::ReceivePB(nMsgID, msg, nLen, xMsg, nPlayerID)) { return; } for(int i = 0; i < xMsg.object_list_size(); i++) { const NFMsg::PlayerEntryInfo info = xMsg.object_list(i); NFDataList var; var.Add("X"); var.AddFloat(info.x()); var.Add("Y"); var.AddFloat(info.y()); var.Add("Z"); var.AddFloat(info.z()); g_pKernelModule->CreateObject(NFINetModule::PBToNF(info.object_guid()), info.scene_id(), 0, info.class_id(), info.config_id(), var); } }
int NFCSceneAOIModule::GetBroadCastObject(const NFGUID & self, const std::string & strPropertyName, const bool bTable, NFDataList & valueObject) { int nObjectContainerID = m_pKernelModule->GetPropertyInt32(self, NFrame::IObject::SceneID()); int nObjectGroupID = m_pKernelModule->GetPropertyInt32(self, NFrame::IObject::GroupID()); const std::string& strClassName = m_pKernelModule->GetPropertyString(self, NFrame::IObject::ClassName()); NF_SHARE_PTR<NFIRecordManager> pClassRecordManager = m_pClassModule->GetClassRecordManager(strClassName); NF_SHARE_PTR<NFIPropertyManager> pClassPropertyManager = m_pClassModule->GetClassPropertyManager(strClassName); NF_SHARE_PTR<NFIRecord> pRecord(NULL); NF_SHARE_PTR<NFIProperty> pProperty(NULL); if (bTable) { if (NULL == pClassRecordManager) { return -1; } pRecord = pClassRecordManager->GetElement(strPropertyName); if (NULL == pRecord) { return -1; } } else { if (NULL == pClassPropertyManager) { return -1; } pProperty = pClassPropertyManager->GetElement(strPropertyName); if (NULL == pProperty) { return -1; } } if (bTable) { //upload property can not board to itself if (!pRecord->GetUpload()) { if (pRecord->GetPublic()) { m_pKernelModule->GetGroupObjectList(nObjectContainerID, nObjectGroupID, valueObject, true, self); } if (pRecord->GetPrivate()) { valueObject.Add(self); } } } else { //upload property can not board to itself if (!pProperty->GetUpload()) { if (pProperty->GetPublic()) { m_pKernelModule->GetGroupObjectList(nObjectContainerID, nObjectGroupID, valueObject, true, self); } if (pProperty->GetPrivate()) { valueObject.Add(self); } } } return valueObject.GetCount(); }
bool NFCRecord::QueryRow(const int nRow, NFDataList& varList) { if (!ValidRow(nRow)) { return false; } if (!IsUsed(nRow)) { return false; } varList.Clear(); for (int i = 0; i < GetCols(); ++i) { NF_SHARE_PTR<NFData>& pVar = mtRecordVec.at(GetPos(nRow, i)); if (pVar) { varList.Append(*pVar); } else { switch (GetColType(i)) { case TDATA_INT: varList.Add(NFINT64(0)); break; case TDATA_FLOAT: varList.Add(0.0f); break; case TDATA_STRING: varList.Add(NULL_STR.c_str()); break; case TDATA_OBJECT: varList.Add(NFGUID()); break; case TDATA_VECTOR2: varList.Add(NFVector2()); break; case TDATA_VECTOR3: varList.Add(NFVector3()); break; default: return false; break; } } } if (varList.GetCount() != GetCols()) { return false; } return true; }