本文整理汇总了C++中NF_SHARE_PTR::FindObject方法的典型用法代码示例。如果您正苦于以下问题:C++ NF_SHARE_PTR::FindObject方法的具体用法?C++ NF_SHARE_PTR::FindObject怎么用?C++ NF_SHARE_PTR::FindObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NF_SHARE_PTR
的用法示例。
在下文中一共展示了NF_SHARE_PTR::FindObject方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DressEquipForHero
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;
}
示例2: HeroStarUp
bool NFCHeroModule::HeroStarUp(const NFGUID& self, const NFGUID& xHeroID)
{
NF_SHARE_PTR<NFIRecord> pHeroRecord = m_pKernelModule->FindRecord(self, NFrame::Player::PlayerHero::ThisName());
if (nullptr == pHeroRecord.get())
{
return false;
}
if (xHeroID.IsNull())
{
return false;
}
int nRow = pHeroRecord->FindObject(NFrame::Player::PlayerHero::GUID, xHeroID);
if (nRow < 0)
{
return false;
}
const int nBeforeStar = pHeroRecord->GetInt32(nRow, NFrame::Player::PlayerHero::Star);
int nAfterStar = nBeforeStar + 1;
if (nAfterStar > ECONSTDEFINE_HERO_MAXSTAR)
{
nAfterStar = ECONSTDEFINE_HERO_MAXSTAR;
}
pHeroRecord->SetInt(nRow, NFrame::Player::PlayerHero::Star, nAfterStar);
return true;
}
示例3: 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;
}
示例4: ConsumeProcess
int NFCHeroItemConsumeProcessModule::ConsumeProcess( const NFGUID& self, const std::string& strItemName, const NFGUID& targetID )
{
NF_SHARE_PTR<NFIRecord> pHero = m_pKernelModule->FindRecord(self, NFrame::Player::R_PlayerHero());
if (nullptr == pHero.get())
{
return 0;
}
NFCDataList varList;
if (pHero->FindObject(NFrame::Player::PlayerHero::PlayerHero_GUID, targetID, varList) <= 0)
{
return 0;
}
const int nItemType = m_pElementModule->GetPropertyInt(strItemName, NFrame::Item::ItemType());
const int nItemSubType = m_pElementModule->GetPropertyInt(strItemName, NFrame::Item::ItemSubType());
const std::string& strAwardProperty = m_pElementModule->GetPropertyString(strItemName, "AwardProperty");
if (!strAwardProperty.empty())
{
AwardItemProperty(self, targetID, strAwardProperty);
}
m_pLogModule->LogElement(NFILogModule::NLL_ERROR_NORMAL, self, strItemName, "There is no element", __FUNCTION__, __LINE__);
return 1;
}
示例5: HeroSkillUp
bool NFCHeroModule::HeroSkillUp(const NFGUID& self, const NFGUID& xHeroID, const int nIndex)
{
if (xHeroID.IsNull())
{
return false;
}
if (nIndex > NFrame::Player::PlayerHero::Skill5 && nIndex < NFrame::Player::PlayerHero::Skill1)
{
return false;
}
NF_SHARE_PTR<NFIRecord> pHeroRecord = m_pKernelModule->FindRecord(self, NFrame::Player::PlayerHero::ThisName());
if (nullptr == pHeroRecord)
{
return false;
}
int nRow = pHeroRecord->FindObject(NFrame::Player::PlayerHero::GUID, xHeroID);
if (nRow < 0)
{
return false;
}
const std::string& strSkillID = pHeroRecord->GetString(nRow, nIndex);
const std::string& strNextSkillID = m_pElementModule->GetPropertyString(strSkillID, NFrame::Skill::NextID());
if (strNextSkillID.empty())
{
//no next talent id, this skill is the best talent
return false;
}
pHeroRecord->SetString(nRow, nIndex, strNextSkillID);
return true;
}
示例6: Upgrade
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;//升级所需要的时间 //TO ADD
const std::string strBuildID = pRecord->GetString(nRow, "BuildingID");
//NFCDataList varHeart;
//varHeart << xBuilID;
m_pKernelModule->AddHeartBeat(self, "OnUpgradeHeartBeat", this, &NFCSLGBuildingModule::OnUpgradeHeartBeat, /*varHeart,*/ nNeedTime, 1);
//修改建筑的状态
pRecord->SetInt(nRow, "State", NFMsg::EBS_UPGRADE);
pRecord->SetInt(nRow, "StateStartTime", NFTimeEx::GetNowTime());
pRecord->SetInt(nRow, "StateEndTime", NFTimeEx::GetNowTime() + nNeedTime);
return 0;
}
示例7: RefereshHeroPropertytoPlayer
int NFCHeroModule::RefereshHeroPropertytoPlayer(const NFGUID & self, const NFGUID & xHeroID)
{
NF_SHARE_PTR<NFIRecord> pHeroRecord = m_pKernelModule->FindRecord(self, NFrame::Player::PlayerHero::ThisName());
if (nullptr == pHeroRecord)
{
return 0;
}
int nRow = pHeroRecord->FindObject(NFrame::Player::PlayerHero::GUID, xHeroID);
if (nRow < 0)
{
return 0;
}
const std::string& strCnfID = pHeroRecord->GetString(nRow, NFrame::Player::PlayerHero::ConfigID);
const std::string& strSkillNormal = m_pElementModule->GetPropertyString(strCnfID, NFrame::NPC::SkillNormal());
const std::string& strSkillAttack = m_pElementModule->GetPropertyString(strCnfID, NFrame::NPC::SkillAttack());
const std::string& strSkillTHUMP = m_pElementModule->GetPropertyString(strCnfID, NFrame::NPC::SkillTHUMP());
m_pKernelModule->SetPropertyString(self, NFrame::Player::Skill1(), strSkillNormal);
m_pKernelModule->SetPropertyString(self, NFrame::Player::Skill2(), strSkillAttack);
m_pKernelModule->SetPropertyString(self, NFrame::Player::Skill3(), strSkillTHUMP);
return 0;
}
示例8: DownGuildMmember
bool NFCWorldGuildModule::DownGuildMmember( 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_DOWN);
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 == 0)
{
return false;
}
pMemberRecord->SetInt(nRow, NFMsg::GuildMemberList_Power, (nPower - 1));
return true;
}
示例9: SetFightHero
bool NFCHeroModule::SetFightHero(const NFGUID& self, const NFGUID& xHeroID, const int nPos)
{
NF_SHARE_PTR<NFIRecord> pHeroRecord = m_pKernelModule->FindRecord(self, NFrame::Player::PlayerHero::ThisName());
if (nullptr == pHeroRecord)
{
return false;
}
if (xHeroID.IsNull())
{
return false;
}
int nRow = pHeroRecord->FindObject(NFrame::Player::PlayerHero::GUID, xHeroID);
if (nRow < 0)
{
return false;
}
int nActivite = pHeroRecord->GetInt32(nRow, NFrame::Player::PlayerHero::Activated);
if (nActivite <= 0)
{
return false;
}
AddToFightList(self, xHeroID, nPos);
return false;
}
示例10: GetEquipHoleCount
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);
}
示例11: MemberOffline
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;
}
示例12: DeleteEquip
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;
}
示例13: Offeline
bool NFCWorldChatGroupModule::Offeline( const NFGUID& self, const NFGUID& xGroupID )
{
NF_SHARE_PTR<NFIObject> pGroup = GetGroup(xGroupID);
if (NULL == pGroup)
{
return false;
}
NF_SHARE_PTR<NFIRecord> pRecord = pGroup->GetRecordManager()->GetElement("GroupMemberList");
if (NULL == pRecord)
{
return false;
}
NFCDataList varList;
if (pRecord->FindObject(NFrame::ChatGroup::GroupMemberList_GUID, self, varList) <= 0)
{
return false;
}
const int nRow = varList.Int(0);
pRecord->SetInt(nRow, NFrame::ChatGroup::GroupMemberList_Online, 0);
pRecord->SetInt(nRow, NFrame::ChatGroup::GroupMemberList_GameID, 0);
return true;
}
示例14: UpGuildMmember
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;
}
示例15: 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);
}