Exemplo n.º 1
0
BOOL KSO3Gateway::LoadConfig()
{
    BOOL        bResult     = false;
    BOOL        bRetCode    = false;
    IIniFile*   piIniFile   = NULL;

    piIniFile = g_OpenIniFile(GATEWAY_CONFIG_FILE);
    KGLOG_PROCESS_ERROR(piIniFile);

    bRetCode = piIniFile->GetString("Global", "Locale", "", m_szLocale, sizeof(m_szLocale));
    KGLOG_PROCESS_ERROR(bRetCode);

    bRetCode = piIniFile->GetBool("Global", "SD", &m_bSndaAgent);
    KGLOG_PROCESS_ERROR(bRetCode);

    bResult = true;
Exit0:
    KG_COM_RELEASE(piIniFile);
    return bResult;
}
Exemplo n.º 2
0
BOOL KSO3GameCenterSettings::LoadCenterConst()
{
    BOOL        bResult     = false;
	int         nRetCode    = false;	
    IIniFile*	piIniFile   = NULL;
	int			nValue      = 0;

	piIniFile = g_OpenIniFile(CENTER_CONST_FILENAME);
	KGLOG_PROCESS_ERROR(piIniFile);

    // Mail System config
    nRetCode = piIniFile->GetInteger(GCS_SECTION_MAIL, "SurvivalTime", 3600, &m_nMailSurvivalTime);
    KGLOG_PROCESS_ERROR(nRetCode && m_nMailSurvivalTime > 0);
    nRetCode = piIniFile->GetInteger(GCS_SECTION_MAIL, "MaxPlayerMailCount", 100, &m_nMaxPlayerMailCount);
    KGLOG_PROCESS_ERROR(nRetCode && m_nMaxPlayerMailCount > 0);
    nRetCode = piIniFile->GetInteger(GCS_SECTION_MAIL, "MaxAuctionMailCount", 100, &m_nMaxAuctionMailCount);
    KGLOG_PROCESS_ERROR(nRetCode && m_nMaxAuctionMailCount > 0);
    nRetCode = piIniFile->GetInteger(GCS_SECTION_MAIL, "MaxSystemMailCount", 100, &m_nMaxSystemMailCount);
    KGLOG_PROCESS_ERROR(nRetCode && m_nMaxSystemMailCount > 0);
    nRetCode = piIniFile->GetInteger(GCS_SECTION_MAIL, "MaxGmMsgMailCount", 50, &m_nMaxGmMsgMailCount);
    KGLOG_PROCESS_ERROR(nRetCode && m_nMaxGmMsgMailCount > 0);
    nRetCode = piIniFile->GetInteger(GCS_SECTION_MAIL, "MaxPlayerMsgMailCount", 50, &m_nMaxPlayerMsgMailCount);
    KGLOG_PROCESS_ERROR(nRetCode && m_nMaxPlayerMsgMailCount > 0);
    nRetCode = piIniFile->GetString(GCS_SECTION_MAIL, "SendFailedName", "System", m_szMailSendFailedName, sizeof(m_szMailSendFailedName));
    KGLOG_PROCESS_ERROR(nRetCode);
    nRetCode = piIniFile->GetString(GCS_SECTION_MAIL, "WithdrawName", "System", m_szMailWithdrawName, sizeof(m_szMailWithdrawName));
    KGLOG_PROCESS_ERROR(nRetCode);
    nRetCode = piIniFile->GetString(GCS_SECTION_MAIL, "UserReturnTitle", "Return", m_szMailUserReturnTitle, sizeof(m_szMailUserReturnTitle));
    KGLOG_PROCESS_ERROR(nRetCode);
    nRetCode = piIniFile->GetString(GCS_SECTION_MAIL, "SystemMailSender", "[SYSTEM]", m_szSystemMailSender, sizeof(m_szSystemMailSender));
    KGLOG_PROCESS_ERROR(nRetCode);

    // PlayerRelation System config
    nRetCode = piIniFile->GetInteger(GCS_SECTION_FELLOWSHIP, "SaveIntervalFrame", 60, &m_nFellowshipSaveInterval);
    KGLOG_PROCESS_ERROR(nRetCode && m_nFellowshipSaveInterval > 0);
    
    // Auction config
    nRetCode = piIniFile->GetString(GCS_SECTION_AUCTION, "AuctionName", "Auction", m_szAuctionName, sizeof(m_szAuctionName));
    KGLOG_PROCESS_ERROR(nRetCode);
    nRetCode = piIniFile->GetString(GCS_SECTION_AUCTION, "Gold", "Gold", m_szGold, sizeof(m_szGold));
    KGLOG_PROCESS_ERROR(nRetCode);
    nRetCode = piIniFile->GetString(GCS_SECTION_AUCTION, "Silver", "Silver", m_szSilver, sizeof(m_szSilver));
    KGLOG_PROCESS_ERROR(nRetCode);
    nRetCode = piIniFile->GetString(GCS_SECTION_AUCTION, "Copper", "Copper", m_szCopper, sizeof(m_szCopper));
    KGLOG_PROCESS_ERROR(nRetCode);
    nRetCode = piIniFile->GetString(GCS_SECTION_AUCTION, "SellSucceed", "SellSucceed", m_szSellSucceed, sizeof(m_szSellSucceed));
    KGLOG_PROCESS_ERROR(nRetCode);
    nRetCode = piIniFile->GetString(GCS_SECTION_AUCTION, "Buyyer", "Buyyer", m_szBuyyer, sizeof(m_szBuyyer));
    KGLOG_PROCESS_ERROR(nRetCode);
    nRetCode = piIniFile->GetString(GCS_SECTION_AUCTION, "Price", "Price", m_szPrice, sizeof(m_szPrice));
    KGLOG_PROCESS_ERROR(nRetCode);
    nRetCode = piIniFile->GetString(GCS_SECTION_AUCTION, "CustodyCharges", "CustodyCharges", m_szCustodyCharges, sizeof(m_szCustodyCharges));
    KGLOG_PROCESS_ERROR(nRetCode);
    nRetCode = piIniFile->GetString(GCS_SECTION_AUCTION, "TaxMoney", "TaxMoney", m_szTaxMoney, sizeof(m_szTaxMoney));
    KGLOG_PROCESS_ERROR(nRetCode);
    nRetCode = piIniFile->GetString(GCS_SECTION_AUCTION, "GetMoney", "GetMoney", m_szGetMoney, sizeof(m_szGetMoney));
    KGLOG_PROCESS_ERROR(nRetCode);
    nRetCode = piIniFile->GetString(GCS_SECTION_AUCTION, "CancelSucceed", "CancelSucceed", m_szCancelSucceed, sizeof(m_szCancelSucceed));
    KGLOG_PROCESS_ERROR(nRetCode);
    nRetCode = piIniFile->GetString(GCS_SECTION_AUCTION, "BidFailed", "BidFailed", m_szBidFailed, sizeof(m_szBidFailed));
    KGLOG_PROCESS_ERROR(nRetCode);
    nRetCode = piIniFile->GetString(GCS_SECTION_AUCTION, "BuySucceed", "BuySucceed", m_szBuySucceed, sizeof(m_szBuySucceed));
    KGLOG_PROCESS_ERROR(nRetCode);
    nRetCode = piIniFile->GetString(GCS_SECTION_AUCTION, "BuyItNowPrice", "BuyItNowPrice", m_szBuyItNowPrice, sizeof(m_szBuyItNowPrice));
    KGLOG_PROCESS_ERROR(nRetCode);
    nRetCode = piIniFile->GetString(GCS_SECTION_AUCTION, "TopPrice", "TopPrice", m_szTopPrice, sizeof(m_szTopPrice));
    KGLOG_PROCESS_ERROR(nRetCode);
    nRetCode = piIniFile->GetString(GCS_SECTION_AUCTION, "Seller", "Seller", m_szSeller, sizeof(m_szSeller));
    KGLOG_PROCESS_ERROR(nRetCode);
    nRetCode = piIniFile->GetString(GCS_SECTION_AUCTION, "Coin", "Coin", m_szCoin, sizeof(m_szCoin));
    KGLOG_PROCESS_ERROR(nRetCode);
    nRetCode = piIniFile->GetInteger(GCS_SECTION_AUCTION, "AuctionTaxRate", 5, &m_nAuctionTaxRate);
    KGLOG_PROCESS_ERROR(nRetCode);
    nRetCode = piIniFile->GetInteger(GCS_SECTION_AUCTION, "GameCardTaxRate", 5, &m_nGameCardTaxRate);
    KGLOG_PROCESS_ERROR(nRetCode);

    // Role config
    nRetCode = piIniFile->GetInteger(GCS_SECTION_ROLE, "MaxNameLen", 0, &m_nMaxRoleNameLength);
    KGLOG_PROCESS_ERROR(nRetCode);
    nRetCode = piIniFile->GetInteger(GCS_SECTION_ROLE, "MinNameLen", 0, &m_nMinRoleNameLength);
    KGLOG_PROCESS_ERROR(nRetCode);
    nRetCode = piIniFile->GetInteger(GCS_SECTION_ROLE, "MaxRoleCount", 0, &m_nMaxRoleCount);
    KGLOG_PROCESS_ERROR(nRetCode);
    /*
    nRetCode = piIniFile->GetInteger(GCS_SECTION_ROLE, "DeleteProtectLevel", 0, &m_nDeleteProtectLevel);
    KGLOG_PROCESS_ERROR(nRetCode);
    nRetCode = piIniFile->GetInteger(GCS_SECTION_ROLE, "DeleteDelayTime", 0, &m_nDeleteDelayTime);
    KGLOG_PROCESS_ERROR(nRetCode);
    */
    m_nDeleteProtectLevel   = 20;
    m_nDeleteDelayTime      = 7 * 24 * 60 * 60;

    // Tong
    nRetCode = piIniFile->GetString(
        GCS_SECTION_TONG, "TongReturnMoneyMailTitle", "tong system return money", 
        m_szTongReturnMoneyMailTitle, sizeof(m_szTongReturnMoneyMailTitle)
    );
    KGLOG_PROCESS_ERROR(nRetCode);

    // AntiFarmer
    nRetCode = piIniFile->GetBool(GCS_SECTION_ANTI_FARMER, "IsEnable", &m_bAntiFarmerEnable);
    KGLOG_PROCESS_ERROR(nRetCode);

    bResult = true;
Exit0:
	KG_COM_RELEASE(piIniFile);
	return bResult;
}