bool NFCWorldGuildDataModule::GetPlayerInfo( const NFIDENTID& self, std::string& strRoleName, int& nLevel, int& nJob , int& nDonation , int& nVIP )
{
    nDonation = 0;//这什么字段,还没加?
    nVIP = 1;
    std::vector<std::string> vFieldVec;
    std::vector<std::string> vValueVec;

    vFieldVec.push_back("Name");
    vFieldVec.push_back("Level");
    vFieldVec.push_back("Job");

    if (!m_pClusterSQLModule->Query( "Player", self.ToString(), vFieldVec, vValueVec))
    {
        return false;
    }

    if (!NF_StrTo(vValueVec[0], strRoleName))
    {
        return false;
    }

    if (!NF_StrTo(vValueVec[1], nLevel))
    {
        return false;
    }

    if (!NF_StrTo(vValueVec[2], nJob))
    {
        return false;
    }

    return true;
}
예제 #2
0
bool NFCProperty::FromString( const std::string& strData )
{
    const TDATA_TYPE eType = GetType();
    bool bRet = false;
    switch (eType)
    {
    case TDATA_INT:
        {
            NFINT64  nValue = 0;
            bRet = NF_StrTo(strData, nValue);
            SetInt(nValue);
        }
        break;

    case TDATA_FLOAT:
        {
            float  fValue = 0;
            bRet = NF_StrTo(strData, fValue);
            SetFloat(fValue);
        }
        break;

    case TDATA_DOUBLE:
        {
            double  dValue = 0;
            bRet = NF_StrTo(strData, dValue);
            SetDouble(dValue);
        }
        break;

    case TDATA_STRING:
        {
            SetString(strData);
            bRet = true;
        }
        break; 
    case TDATA_OBJECT:
        {
            NFIDENTID xID;
            
            bRet = xID.FromString(strData);           
            SetObject(xID);
        }
        break;
    default:
        break;
    }

    return bRet;
}
bool NFCWorldGuildDataModule::GetGuildInfo( const NFIDENTID& self, const NFIDENTID& xGuild, SearchGuildObject& xGuildInfo )
{
    std::vector<std::string> vFieldVec;
    std::vector<std::string> vValueVec;

    vFieldVec.push_back("Name");
    vFieldVec.push_back("GuilIDIcon");
    vFieldVec.push_back("GuildMemeberCount");
    vFieldVec.push_back("GuildMemeberMaxCount");
    vFieldVec.push_back("GuildHonor");
    vFieldVec.push_back("Rank");

    if (!m_pClusterSQLModule->Query(mstrGuildTalble, xGuild.ToString(), vFieldVec, vValueVec))
    {
        return false;
    }

    const std::string& strGuildName = vValueVec[0];

    int nGuildIconn = 0;
    int nGuildMemeberCount = 0;
    int nGuildMemeberMaxCount = 0;
    int nGuildHonor = 0;
    int nGuildRank = 0;

    NF_StrTo(vValueVec[1], nGuildIconn);
    NF_StrTo(vValueVec[2], nGuildMemeberCount);
    NF_StrTo(vValueVec[3], nGuildMemeberMaxCount);
    NF_StrTo(vValueVec[4], nGuildHonor);
    NF_StrTo(vValueVec[5], nGuildRank);

    xGuildInfo.mxGuildID = xGuild    ;
    xGuildInfo.mstrGuildName = strGuildName  ;
    xGuildInfo.mnGuildIcon = nGuildIconn  ;
    xGuildInfo.mnGuildMemberCount = nGuildMemeberCount  ;
    xGuildInfo.mnGuildMemberMaxCount = nGuildMemeberMaxCount  ;
    xGuildInfo.mnGuildHonor = nGuildHonor ;
    xGuildInfo.mnGuildRank = nGuildRank  ;  

    return true;
}
예제 #4
0
bool NFCPluginManager::LoadPluginConfig()
{
    rapidxml::file<> fdoc("Plugin.xml");
    rapidxml::xml_document<>  doc;
    doc.parse<0>(fdoc.data());

    rapidxml::xml_node<>* pRoot = doc.first_node();
    for (rapidxml::xml_node<>* pPluginNode = pRoot->first_node("Plugin"); pPluginNode; pPluginNode = pPluginNode->next_sibling("Plugin"))
    {
        const char* strPluginName = pPluginNode->first_attribute("Name")->value();
        const char* strMain = pPluginNode->first_attribute("Main")->value();

        mPluginNameMap.insert(PluginNameMap::value_type(strPluginName, true));

    }

    rapidxml::xml_node<>* pPluginAppNode = pRoot->first_node("APPID");
    if (!pPluginAppNode)
    {
        NFASSERT(0, "There are no App ID", __FILE__, __FUNCTION__);
        return false;
    }

    const char* strAppID = pPluginAppNode->first_attribute("Name")->value();
    if (!strAppID)
    {
        NFASSERT(0, "There are no App ID", __FILE__, __FUNCTION__);
        return false;
    }

    if (!NF_StrTo(strAppID, mnAppID))
    {
        NFASSERT(0, "App ID Convert Error", __FILE__, __FUNCTION__);
        return false;
    }

    rapidxml::xml_node<>* pPluginConfigPathNode = pRoot->first_node("ConfigPath");
    if (!pPluginConfigPathNode)
    {
        NFASSERT(0, "There are no ConfigPath", __FILE__, __FUNCTION__);
        return false;
    }

    if (NULL == pPluginConfigPathNode->first_attribute("Name"))
    {
        NFASSERT(0, "There are no ConfigPath.Name", __FILE__, __FUNCTION__);
        return false;
    }

    mstrConfigPath = pPluginConfigPathNode->first_attribute("Name")->value();

    return true;
}
bool NFCWorldGuildDataModule::GetPlayerGameID( const NFIDENTID& self, int& nGameID )
{
    std::vector<std::string> xVecFeild;
    std::vector<std::string> xVecValue;

    xVecFeild.push_back("GameID");
    if (!m_pClusterSQLModule->Query("Player", self.ToString(), xVecFeild, xVecValue))
    {
        return false;
    }

    const std::string& strGameID = xVecValue[0];
    if (!NF_StrTo(strGameID, nGameID))
    {
        return false;
    }

    return true;
}
예제 #6
0
int NFCEctypeModule::OnObjectClassEvent(const NFIDENTID& self, const std::string& strClassName, const CLASS_OBJECT_EVENT eClassEvent, const NFIDataList& var)
{
    if (strClassName == "Player")
    {
        if (COE_CREATE_BEFORE_EFFECT == eClassEvent)
        {
            int nOnlineCount = m_pKernelModule->GetPropertyInt(self, "OnlineCount");
            if (nOnlineCount <= 0)
            {
                NF_SHARE_PTR<NFILogicClass> pLogicCLass = m_pLogicClassModule->GetElement("Scene");
                if (!pLogicCLass.get())
                {
                   return 0;
                }

                NFList<std::string>& configList = pLogicCLass->GetConfigNameList();
                std::string strSceneConfigID;
                for (bool bRet = configList.First(strSceneConfigID); bRet; bRet = configList.Next(strSceneConfigID))
                {
                    int nFirstScene = m_pElementInfoModule->GetPropertyInt(strSceneConfigID, "IsFirstCloneScene");
                    //第一关,并且是普通模式才可以,其他模式要求普通模式开启才行
                    if (nFirstScene > 0)
                    {
                        int nSceneId = 0;
                        if(NF_StrTo(strSceneConfigID, nSceneId))
                        {//免激活的地图直接可以进,这里手动激活一下,否则EctypeList里没有数据
                            AddEctypeActiveState(self, nSceneId);
                        }
                    }
                }
            }
        }
        else if (COE_CREATE_FINISH == eClassEvent)
        {
            m_pKernelModule->AddPropertyCallBack(self, "GroupID", this, &NFCEctypeModule::OnObjectGroupIDEvent);

            //m_pEventProcessModule->AddEventCallBack(self, NFED_ON_OBJECT_ENTER_SCENE_RESULT, this, &NFCEctypeModule::OnEntrySceneEvent);
        }
    }
    return 0;
}