Exemplo n.º 1
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;
}
Exemplo n.º 2
0
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;
}
Exemplo n.º 3
0
bool NFCHeroPropertyModule::CalHeroEquipProperty(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;
	}

	////////////////////Equip//////////////////////////////////////////////////////
	xDataList.Clear();

	for (int i = 0; i < pHeroPropertyRecord->GetCols(); ++i)
	{
		xDataList.AddInt(0);
	}

	for (int i = NFrame::Player::PlayerHero_Equip1; i <= NFrame::Player::PlayerHero_Equip6; ++i)
	{
		NFCDataList EquipDataList;
		const NFGUID xEquipID = pHeroRecord->GetObject(nRow, i);
		if (!xEquipID.IsNull() && m_pEquipPropertyModule->CalEquipProperty(self, xEquipID, EquipDataList))
		{
			//one equip
			for (int j = 0; j < pHeroPropertyRecord->GetCols(); ++j)
			{
				int nOldValue = xDataList.Int(j);
				int nEquipValue = EquipDataList.Int(j);

				xDataList.SetInt(j, nOldValue + nEquipValue);
			}
		}
	}

	return true;
}
Exemplo n.º 4
0
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;
}
Exemplo n.º 5
0
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;
}
Exemplo n.º 6
0
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);
}
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;
}
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;
}
Exemplo n.º 9
0
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;
}
Exemplo n.º 10
0
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);
}
Exemplo n.º 11
0
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);
}
Exemplo n.º 12
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;
}
Exemplo n.º 13
0
bool NFCHeroPropertyModule::OnHeroPropertyUpdate(const NFGUID & self, const NFGUID & xHeroGUID)
{
	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;
	}

	NF_SHARE_PTR<NFIRecord> pHeroPropertyRecord = m_pKernelModule->FindRecord(self, NFrame::Player::R_HeroPropertyValue());
	if (nullptr == pHeroPropertyRecord)
	{
		return false;
	}

	const int nRow = varFind.Int(0);

	NFCDataList xHeroAllValue;
	bool bRet = CalHeroAllProperty(self, xHeroGUID, xHeroAllValue);
	if (bRet)
	{
		pHeroPropertyRecord->AddRow(nRow, xHeroAllValue);
	}

	return true;
}
Exemplo n.º 14
0
bool NFCEquipModule::Ramdom( const int nNowLevel , const int nMaxLevel)
{
    if (nNowLevel >= nMaxLevel)
    {
        return false;
    }

    if (nNowLevel < 0)
    {
        return false;
    }

    if (nMaxLevel <= 0)
    {
        return false;
    }

    NFCDataList varList;
    m_pKernelModule->Random(0, nMaxLevel, 1, varList);

    const NFINT64 nRandomNum = varList.Int(0);

    if (nRandomNum > nNowLevel && nRandomNum <= nMaxLevel)
    {
        return true;
    }

    return false;
}
Exemplo n.º 15
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;
}
Exemplo n.º 16
0
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;
}
Exemplo n.º 17
0
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;
}
Exemplo n.º 18
0
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;
}
Exemplo n.º 19
0
bool NFCHeroPropertyModule::CalHeroTalentProperty(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;
	}

	////////////////////Talent//////////////////////////////////////////////////////
	xDataList.Clear();

	for (int i = 0; i < pHeroPropertyRecord->GetCols(); ++i)
	{
		xDataList.AddInt(0);
	}

	for (int i = NFrame::Player::PlayerHero_Talent1; i <= NFrame::Player::PlayerHero_Talent5; ++i)
	{
		const std::string& strTalentID = pHeroRecord->GetString(nRow, i);
		const std::string& strTalentEffectData = m_pElementModule->GetPropertyString(strTalentID, NFrame::Talent::EffectData());
		if (!strTalentEffectData.empty())
		{
			//one talent
			for (int j = 0; j < pHeroPropertyRecord->GetCols(); ++j)
			{
				const std::string& strColTag = pHeroPropertyRecord->GetColTag(j);
				int nValue = m_pElementModule->GetPropertyInt(strTalentEffectData, strColTag);
				int nOldValue = xDataList.Int(j);

				xDataList.SetInt(j, nOldValue + nValue);
			}
		}
	}

	return true;
}
Exemplo n.º 20
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;
}
Exemplo n.º 21
0
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;
}
Exemplo n.º 22
0
bool NFCPackModule::CreateItem( const NFGUID& self, const std::string& strConfigName, const int nCount )
{
	if (nCount <= 0)
	{
		return 0;
	}

	NF_SHARE_PTR<NFIObject> pObject = m_pKernelModule->GetObject( self );
	if ( NULL == pObject )
	{
		return 0;
	}

	//还得确定有这个装备
	bool bExist = m_pElementModule->ExistElement(NFrame::Item::ThisName(), strConfigName );
	if ( !bExist )
	{
		return 0;
	}

	NF_SHARE_PTR<NFIRecord> pRecord = pObject->GetRecordManager()->GetElement( NFrame::Player::R_BagItemList() );
	if (!pRecord)
	{
		return 0;
	}

	NFCDataList varFindResult;
	int nFindRowCount = pRecord->FindString(NFrame::Player::BagItemList_ConfigID, strConfigName, varFindResult);
	if (nFindRowCount <= 0)
	{
		NF_SHARE_PTR<NFIDataList> xRowData = pRecord->GetInitData();

		xRowData->SetString(NFrame::Player::BagItemList_ConfigID, strConfigName);
		xRowData->SetInt(NFrame::Player::BagItemList_ItemCount, nCount);
		xRowData->SetInt(NFrame::Player::BagItemList_Date, NFTime::GetNowTime());
	}
	else
	{
		int nFindRow = varFindResult.Int(0);
		int nOldCount = pRecord->GetInt(nFindRow, NFrame::Player::BagItemList_ItemCount);
		int nNewCount = nOldCount + nCount;
		pRecord->SetInt(nFindRow, NFrame::Player::BagItemList_ItemCount, nNewCount);
	}

	return 0;
}
Exemplo n.º 23
0
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;
}
Exemplo n.º 24
0
bool NFCHeroPropertyModule::CalHeroBaseProperty(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;
	}

	/////////////PropertyBase/////////////////////////////////////////
	xDataList.Clear();

	const std::string& strConfigID = pHeroRecord->GetString(nRow, NFrame::Player::PlayerHero::PlayerHero_ConfigID);
	const std::string& strPropertyEffectData = m_pElementModule->GetPropertyString(strConfigID, NFrame::NPC::EffectData());
	if (!strPropertyEffectData.empty())
	{
		for (int i = 0; i < pHeroPropertyRecord->GetCols(); ++i)
		{
			const std::string& strColTag = pHeroPropertyRecord->GetColTag(i);
			int nValue = m_pElementModule->GetPropertyInt(strPropertyEffectData, strColTag);
			xDataList.AddInt(nValue);
		}
	}

	return true;
}
Exemplo n.º 25
0
void NFCStateMachine::Execute()
{
    //same for the current state
    if (State_Error != meCurrentState)
    {
        if (mfHeartBeatTime > 0)
        {
            mfHeartBeatTime -= 0.001f;
        }
        else
        {
            NFIState* pState = m_pAIControlInterface->GetState(meCurrentState);
            pState->Execute(mOwnerID);

            //设置心跳时间
            NFCDataList xDataList;
            m_pKernelModule->Random(0, 10, 1, xDataList);

            mfHeartBeatTime = pState->GetHeartBeatTime() + xDataList.Int(0);
        }
    }
}
Exemplo n.º 26
0
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;
}
Exemplo n.º 27
0
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;
    }

    NFCDataList 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;
}
Exemplo n.º 28
0
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 NFCHeroItemConsumeProcessModule::AwardItemProperty(const NFGUID& self, const NFGUID& xHeroID, const ::string& strID)
{
    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, xHeroID, varList) <= 0)
    {
        return 0;
    }

    if (strID.empty())
    {
        return false;
    }

    const int nRow = varList.Int(0);

    const int nVIPEXP = m_pElementModule->GetPropertyInt(strID, NFrame::ConsumeData::VIPEXP());
    const int nEXP = m_pElementModule->GetPropertyInt(strID, NFrame::ConsumeData::EXP());
//     const int nHP = m_pElementModule->GetPropertyInt(strID, NFrame::ConsumeData::HP());
//     const int nSP = m_pElementModule->GetPropertyInt(strID, NFrame::ConsumeData::SP());
//     const int nMP = m_pElementModule->GetPropertyInt(strID, NFrame::ConsumeData::MP());
//     const int nGold = m_pElementModule->GetPropertyInt(strID, NFrame::ConsumeData::Gold());
//     const int nMoney = m_pElementModule->GetPropertyInt(strID, NFrame::ConsumeData::Money());

//     if (nVIPEXP > 0)
//     {
//         const NFINT64 nOldValue = m_pKernelModule->GetPropertyInt(self, NFrame::Player::VIPEXP());
//         const NFINT64 nNewValue = nOldValue + nVIPEXP;
//         m_pKernelModule->SetPropertyInt(self, NFrame::Player::VIPEXP(), nNewValue);
//     }

    if (nEXP > 0)
    {
        m_pHeroModule->AddHeroExp(self, xHeroID, nEXP);
    }

//     if (nHP > 0)
//     {
//         m_pPropertyModule->AddHP(self, nHP);
//     }
//     if (nSP > 0)
//     {
//         m_pPropertyModule->AddSP(self, nHP);
//     }
// 
//     if (nMP > 0)
//     {
//         m_pPropertyModule->AddMP(self, nHP);
//     }
// 
//     if (nGold > 0)
//     {
//         m_pPropertyModule->AddDiamond(self, nHP);
//     }
// 
//     if (nMoney > 0)
//     {
//         m_pPropertyModule->AddMoney(self, nHP);
//     }

    return true;
}