bool CBusinessSystem::InitCreditLevel(const char* filename)
{
	m_vecCreditLevel.clear();

	tagCreditLevel stCredit;

	stringstream stream;	
	CRFile* prfile = rfOpen(filename);
	if( !prfile )
	{
		char str[256];
		sprintf(str, "file '%s' can't found!", filename);
		MessageBox(g_hWnd, str, "error", MB_OK);
		return FALSE;
	}
	prfile->ReadToStream(stream);
	rfClose(prfile);


	while(ReadTo(stream, "#"))
	{
		stream >> stCredit.lMinNum >> stCredit.lMaxNum >> stCredit.LevelName;
		m_vecCreditLevel.push_back(stCredit);
	}

	return TRUE;
}
void CREvent::OnPageLoad(GamePage *pPage)
{
	pPage->LoadPageWindow();
	CEGUI::Window *pPageWin = pPage->GetPageWindow();
	CEGUI::PushButton* pCreateBtn = static_cast<CEGUI::PushButton*>(pPageWin->getChild("CreateRole"));
	pCreateBtn->subscribeEvent(CEGUI::PushButton::EventClicked,CEGUI::Event::Subscriber(&CREvent::OnCreateRoleBtn, this));
	CEGUI::PushButton* pGoBackBtn = static_cast<CEGUI::PushButton*>(pPageWin->getChildRecursive("BackToSelRol"));
	pGoBackBtn->subscribeEvent(CEGUI::PushButton::EventClicked,CEGUI::Event::Subscriber(&CREvent::GoBackBtn,this));
	SetCreateRoleInitProperty(pPageWin);
	m_bRoleLeftRotate = false;    //向左旋转
	m_bRoleRightRotate = false;   //向右旋转
	if (m_SelectSence == NULL)
	{
		m_SelectSence = new GameScene();
		m_SelectSence->CreateSence("model/interface/selectchar/map",
			"model/interface/selectchar/map/camera_end",
			"model/interface/selectchar/map/envcreature",
			"model/interface/selectchar/map/enveffect");
	}
	CRFile* prfile = rfOpen("data/CreateRolePos.ini");
	if (prfile)
	{
		stringstream stream;
		prfile->ReadToStream(stream);
		rfClose(prfile);
		stream >> s_RolePos[0]  >> s_RolePos[1]  >> s_RolePos[2]  >> s_RolePos[3];
	}
	if(m_pPlayer == NULL)
		m_pPlayer = new CPlayer;
	m_pPlayer->SetGraphicsID(CREvent::GetSelectSex()+1);
	LoadFaceHairIni();
	m_pPlayer->SetDisplayModel();
	m_pPlayer->SetDisplayModelGroup();
}
// 从文件读取列表
BOOL CContributeSetup::LoadContributeSetup(const char* filename)
{
	m_vContributeItems.clear();

	CRFile* prfile = rfOpen(filename);
	if(prfile == NULL)
	{
		char str[256];
		_snprintf(str, 256, "file '%s' can't found!", filename);
		MessageBox(g_hWnd, str, "error", MB_OK);
		return FALSE;
	}
	
	stringstream stream;
	string strTemp;
	prfile->ReadToStream(stream);
	rfClose(prfile);

	stream	
		>> strTemp >> lCombatLevel1
		>> strTemp >> lCombatLevel2
		>> strTemp >> lContribute1
		>> strTemp >> lContribute2

		>> strTemp >> lContributeLevel
		>> strTemp >> lContributeMultiple

		>> strTemp >> lContributeBaseValue
		>> strTemp >> lContributeMax

		>> strTemp >> lCountryCityContributeModifierLose
		>> strTemp >> lCountryCityContributeModifierGain
		>> strTemp >> lCountryCityContributeItemModifier;


	// read incrementshop list
	while(ReadTo(stream, "#"))
	{
		tagContributeItem stItem;

		stream>>stItem.dwLoValue;

		stream>>stItem.dwHiValue;

		stream>>stItem.strName;
		
		stream>>stItem.dwNum;

		m_vContributeItems.push_back(stItem);
	}
	return true;
}
bool CCountTimerList::LoadSetup(char* pFileName)
{
	if(!pFileName) return false;
	
	CRFile* prfile = rfOpen(pFileName);
	if(prfile == NULL)
	{
		return false;
	}
	stringstream stream;
	prfile->ReadToStream(stream);
	rfClose(prfile);

	s_mCountTimer.clear();

	std::string temp;
	tagCountTimerParam param;
	stream >> temp >> m_dwMaxTimerNum;

	while(ReadTo(stream, "#"))
	{
		stream  >> param.m_dwType
			>> param.m_strPicPath
			>> param.m_strBackPicPath
			>> param.m_strTextPath
			>> param.m_dwTextTime
			>> param.m_dwTextViewTime
			>> param.m_strText
			>> param.m_strTimeoutText
			>> param.m_strScriptPath
			;

		if(param.m_strText=="null") param.m_strText="";
		if(param.m_strTimeoutText=="null") param.m_strTimeoutText="";
		if(param.m_strScriptPath=="null") param.m_strScriptPath="";

		s_mCountTimer[param.m_dwType] = param;
	}

	return true;
}
Beispiel #5
0
/// 加载表情列表
bool EmotionSetup::LoadSetup(const char* pFileName)
{
	s_mEmotions.clear();
	CRFile* prfile = rfOpen(pFileName);
	if(prfile)
	{
		stringstream stream;
		prfile->ReadToStream(stream);
		rfClose(prfile);

		while(ReadTo(stream, "*"))
		{
			long lID;
			BOOL bLoop;
			stream >> lID >> bLoop;
			s_mEmotions[lID] = bLoop;
		}
		return true;
	}
	return false;
}
bool CREvent::LoadFaceHairIni()			// 读取面部特征、头发及发色的配置文件
{
	stringstream stream;
	const char strFileName[64] = "data/FaceHair.ini";
	CRFile* prfile = rfOpen(strFileName);
	if( !prfile )
	{
		char str[256];
		sprintf(str, "file '%s' can't found!", strFileName);
		MessageBox(g_hWnd, str, "error", MB_OK);
		return false;
	}

	prfile->ReadToStream(stream);
	rfClose(prfile);

	//男模
	if (ReadTo(stream,"<Man>"))
	{
		Read(stream,"*",m_wFaceNum[0]);
		Read(stream,"#",m_wHairNum[0]);
		for (int i = 1;i<=m_wHairNum[0];i++)
		{
			Read(stream,"$",m_mapHairColorNum[0][i]);
		}
	}
	//女模
	if (ReadTo(stream,"<Woman>"))
	{
		Read(stream,"*",m_wFaceNum[1]);
		Read(stream,"#",m_wHairNum[1]);
		for (int j = 1;j<=m_wHairNum[1];j++)
		{
			Read(stream,"$",m_mapHairColorNum[1][j]);
		}
	}
	return true;
}
BOOL CSuitRuleFactory::Load(const CHAR* strPath)
{
	m_mRules.clear();

	CRFile* prfile = rfOpen(strPath);
	if(prfile == NULL)
	{		
		return FALSE;
	}

	stringstream stream;
	prfile->ReadToStream(stream);
	rfClose(prfile);	
	string strVal="";	
	while(ReadTo(stream, "SUIT_ID"))
	{
		int suit_id;
		stream >> suit_id;
		ReadTo(stream,"<SUIT_GOODS>");
		
		CSuitRule* pRule=MP_NEW CSuitRule;
		m_mRules[suit_id]=pRule;
		while(TRUE)
		{
			stream>>strVal;
			if(strVal=="</SUIT_GOODS>")
			{
				break;
			}
			int goods_id=atoi(strVal.c_str());
			stream>>strVal;//原始名
			pRule->m_mEquip[goods_id]=strVal;

		}
        bool bLoop=TRUE;
		while(bLoop)
		{
			ReadTo(stream,"NUM");
			int num;
			stream>>num;//件数
			pRule->m_mAttr[num]=new vector<CSuitRule::tagRuleValue*>;
			ReadTo(stream,"<ATTR>");
			while(TRUE)
			{
				stream>>strVal;
				if(strVal=="</ATTR>")
				{
					break;
				}
				else if(strVal=="</ATTR_END>")
				{
					bLoop=FALSE;
					break;
				}
				CSuitRule::tagRuleValue* pRuleValue=MP_NEW CSuitRule::tagRuleValue;
				pRuleValue->strType=strVal;
				stream>>pRuleValue->lVal;
				pRule->m_mAttr[num]->push_back(pRuleValue);

			}
		}		
	}	
	return TRUE;
}
//从文件读取套装属性列表
void CGoodsList::LoadSuitList(const char* filename)
{
	InitMapEffects();
	m_SuitList.clear();
	CRFile* prfile = rfOpen(filename);

	if (prfile == NULL)
	{
		char str[256];
		sprintf(str, "file '%s' can't found!", filename);
		MessageBox(g_hWnd, str, "error", MB_OK);
		return ;
	}
	stringstream  stream;
	prfile->ReadToStream(stream);
	rfClose(prfile);

	ulong suitID = 0;						//存放套装的ID号
	string strSuitName;						//存放套装的名称 
	while (ReadTo(stream,"SUIT_ID"))
	{
		stream>>suitID;
		stream>>strSuitName;
		m_mapSuitName.insert(pair<ulong,string>(suitID,strSuitName));
		if(ReadTo(stream,"<SUIT_GOODS>"))
		{		
			tagSuitAttribute tempSuit;
			//获取tagSuitAttribute中vector<string> Suit_OriginName和uchar	wSuit_Count要存放的内容
			string tempString;
			while (true)				
			{					
				stream>>tempString;
				if (tempString == "</SUIT_GOODS>")
				{
					break;
				}
				tempSuit.wSuit_Count = (uchar)atoi(tempString.c_str());
				string tempSuitOriginName;
				stream>>tempSuitOriginName;
				tempSuit.Suit_OriginName.push_back(tempSuitOriginName);
			}
			//获取map<ulong,map<ulong,tagEffect>>中要存放的内容
			ulong SuitNum;				//套装可能的件数
			string SuitAttriName;		//套装在对应件数下激活的属性名字
			//ulong SuitAttriValue1,SuitAttriValue2;		//对应的附加属性的两个值
			while (ReadTo(stream,"NUM"))
			{
				stream>>SuitNum;			
				if (ReadTo(stream,"<ATTR>"))
				{	
					map<ulong,tagEffect> tempEffects;
					tagEffect tEffect;
					while (true)		
					{
						stream>>tempString;
						if (tempString == "</ATTR>"||tempString == "</ATTR_END>")
						{
							break;
						}
						SuitAttriName = tempString;
						stream>>tEffect.dwValue1>>tEffect.dwValue2;										//读取属性名和属性值
						ulong SuitAttriEnum;
						SuitAttriEnum = m_mapAllEffects[SuitAttriName];					//通过属性名找到对应的属性枚举值
						tempEffects.insert(pair<ulong,tagEffect>(SuitAttriEnum,tEffect));	
					}
					tempSuit.Suit_ActiveProperty[SuitNum] = tempEffects;
					if (tempString == "</ATTR_END>")
					{
						break;
					}
				}
			}
			m_SuitList.insert(pair<ulong,tagSuitAttribute>(suitID,tempSuit));
		}
//! 读取Ini配置文件数据
bool CGlobalRgnManager::LoadRgnSetupIni(const char* strFilePath)
{
	string strTemp;

	CRFile* prfile = rfOpen(strFilePath);
	if( prfile )
	{
		stringstream stream;
		prfile->ReadToStream(stream);
		rfClose(prfile);

		extern long g_lTotalMonster;
		long lM=0;

		// 读场景信息
		tagRegion stRegion;
		DWORD dwID = 0;
		DWORD dwResourceID = 0;
		long lSvrResourceID = 0;
		DWORD dwAreaId=0;
		float fExpScale = 1.0f;
		float fOccuExpScale = 1.0f;
		float fSpScale = 1.0f;
		float fMeriScale = 1.0f;
		DWORD dwWarType = RWT_Normal;
		long  nRide = 1;
		long nChangeEquip = 1;
		int nNoPk = 0;
		int nNoContribute = 0;
		string strName;
		DWORD dwIndex = 0;
		int btCountry = 0;
		long lNotify= 0;
		int nSpaceType=0;

		// 分线ID,0:表示不是分线场景,>0表示是分线场景的ID
		long lLinedIdFlag = 0;
		long lACRgnType = 0;
		int lRgnHideFlag = 0;
		//  [8/26/2009 chenxianj]
		int nReliveFlag = 0;
		long nDeadReturn = 0;
		long lStrongPointFlag=0;
        long lReJoinTeam=0;

		DWORD dupType = 0;
		while(ReadTo(stream, "#"))
		{
			string szGuid;
			stream >> dupType 
				>> dwID 
				>> strName 
				>> dwResourceID 
				>> lSvrResourceID
				>> dwAreaId 
				>> fExpScale 
				>> fOccuExpScale 
				>> fSpScale 
				>> fMeriScale 
				>> dwWarType
				>> nRide
				>> nChangeEquip
				>> nNoPk 
				>> nNoContribute 
				>> dwIndex 
				>> btCountry 
				>> lNotify
				>> nSpaceType 
				>> szGuid 
				>> lLinedIdFlag
				>> lACRgnType
				>> lRgnHideFlag
				>> nReliveFlag
				>> nDeadReturn
				>> lStrongPointFlag
                >> lReJoinTeam;
			stRegion.dwGameServerIndex = dwIndex;
			stRegion.RegionType = (eRgnType)dupType;

            if ( dwID < 1E6 || dwID >= 1E7)
            {
                Log4c::Trace(ROOT_MODULE, "RegionID is too small or too big!", dwID);
            }
			CGUID rgnGuid(szGuid.c_str());

			// 读入场景
			CWorldRegion* pRegion = new CWorldRegion;

			if(pRegion)
			{
				pRegion->SetRgnType(dupType);
				pRegion->SetAreaId(dwAreaId);
				pRegion->SetExID(rgnGuid);
				pRegion->SetID(dwID);
				pRegion->SetName(strName.c_str());
				pRegion->SetWarType((eRWT)dwWarType);
				pRegion->SetSpaceType((eRST)nSpaceType);
				pRegion->SetResourceID(dwResourceID);
				pRegion->SetSvrResourceID( lSvrResourceID );
				pRegion->SetExpScale(fExpScale);
				pRegion->SetOccuExpScale(fOccuExpScale);
				pRegion->SetSpScale(fSpScale);
				pRegion->SetMeriScale(fMeriScale);
				pRegion->SetCountry(btCountry);
				pRegion->SetNotify(lNotify);
				pRegion->SetLinedIdFlag(lLinedIdFlag);
				pRegion->SetRide(nRide==0?false:true);
				pRegion->SetChangeEquip(nChangeEquip==0?false:true);
				pRegion->SetRelive(nReliveFlag==0?false:true);
				pRegion->SetDeadReturn(nDeadReturn==0?false:true);
				if(lLinedIdFlag != 0) // 是分线场景ID
				{
					m_mapLinedRgnIdByLinedId[lLinedIdFlag].push_back(dwID);
				}
				pRegion->SetACRgnType( lACRgnType );
				pRegion->SetRgnHideFlag(lRgnHideFlag);

				pRegion->SetNoPk( nNoPk);
				pRegion->SetNoContribute( nNoContribute==0?false:true );
				pRegion->SetGsid(dwIndex);
                pRegion->SetStrongPointFlag( lStrongPointFlag>0 ? true : false );
                pRegion->SetRgnRejoinFlag( lReJoinTeam );

				if( pRegion->Load() )
				{
					stRegion.pRegion = pRegion;

					//!!!GS的NormalRgn使用模板的NormalRgn对象指针!!!
					switch((eRgnType)dupType) 
					{
					case RGN_NORMAL:// Normal Rgn
						{
							// 加入模板map
							m_mapRegionList[dwID] = stRegion;

							pRegion->SetGsid(dwIndex);

							// 加入RgnMap
							MapRgnItr rgnItr = m_mapRgn.find(rgnGuid);
							if(rgnItr == m_mapRgn.end())// 未找到
							{
								m_mapRgn[rgnGuid] = pRegion;
							}
							else
							{
								Log4c::Warn(ROOT_MODULE,FormatText("WS_RGNMGR_2", szGuid.c_str()));
							}

							// 设置类型
							pRegion->SetRgnType((long)dupType);
							pRegion->SetIsTemplateRgnFlag(true);

							Log4c::Trace(ROOT_MODULE,FormatText("WS_RGNMGR_3", dwID, strName.c_str(), g_lTotalMonster-lM));
						}
						break;
					case RGN_PERSONAL: // Personal Rgn
						{
							// 加入模板map
							m_mapPersonalRgnList[dwID] = stRegion;

							// 设置类型
							pRegion->SetRgnType((long)dupType);
							pRegion->SetIsTemplateRgnFlag(true);

							Log4c::Trace(ROOT_MODULE,FormatText("WS_RGNMGR_4", dwID, strName.c_str(), g_lTotalMonster-lM));
						}
						break;
					case RGN_PERSONAL_HOUSE: // Personal Rgn
						{
							// 加入模板map
							m_mapPersonalHouseRgnList[dwID] = stRegion;

							// 设置类型
							pRegion->SetRgnType((long)dupType);
							pRegion->SetIsTemplateRgnFlag(true);

							Log4c::Trace(ROOT_MODULE,FormatText("WS_RGNMGR_5", dwID, strName.c_str(), g_lTotalMonster-lM));
						}
						break;
					case RGN_TEAM: // Personal Rgn
						{
							// 加入模板map
							m_mapTeamRgnList[dwID] = stRegion;

							// 设置类型
							pRegion->SetRgnType((long)dupType);
							pRegion->SetIsTemplateRgnFlag(true);

							Log4c::Trace(ROOT_MODULE,FormatText("WS_RGNMGR_6", dwID, strName.c_str(), g_lTotalMonster-lM));
						}
						break;
					}

					lM = g_lTotalMonster;
				}
				else
				{
					Log4c::Warn(ROOT_MODULE,FormatText("WS_RGNMGR_7", dwID, strName.c_str()));
				}
			}
			else
			{
				Log4c::Warn(ROOT_MODULE,FormatText("WS_RGNMGR_8", dwID, strName.c_str()));
			}
		}

		Log4c::Trace(ROOT_MODULE,FormatText("WS_RGNMGR_9", g_lTotalMonster));
	}
	else
	{
bool  SkillAttribute::LoadEx(const char* filename)
{
    CRFile* prfile = rfOpen(filename);
    if(prfile == NULL)
    {
        Log4c::Error(ROOT_MODULE,"%-15s %s",__FUNCTION__,FormatText("WS_SYS_31", filename));
        return false;
    }
    stringstream stream;
    prfile->ReadToStream(stream);
    rfClose(prfile);

    while(ReadTo(stream, "#"))
    {
        tagSkillAttr stSkillAttr;
        long         Skillid;
        long         Level;

        stream >> Skillid
            >> Level
            >> stSkillAttr.TempId           ///< 读取当前等级关联tempid
            >> stSkillAttr.MinAtkDistance   ///< 最小距离
            >> stSkillAttr.MaxAtkDistance   ///< 最大距离
            >> stSkillAttr.BuffPower        ///< 攻击强度 
            >> stSkillAttr.IntonateTime     ///< 吟唱时间
            >> stSkillAttr.CoolDown         ///< 冷却时间
            >> stSkillAttr.ActTime          ///< 释放动作时间
            >> stSkillAttr.HitTime          ///< 释放和命中时间
            >> stSkillAttr.FlyDelay         ///< 飞行延迟时间
            >> stSkillAttr.LoopCount        ///< 循环时间
            >> stSkillAttr.HurtFactor       ///< 伤害系数
            >> stSkillAttr.HealFactor       ///< 治疗系数
            >> stSkillAttr.BaseHurt         ///< 固定伤害
            >> stSkillAttr.BaseHeal         ///< 固定治疗
            >> stSkillAttr.EHit             ///< 附加攻击
            >> stSkillAttr.EHeal            ///< 附加治疗
            >> stSkillAttr.EHurtValue       ///< 附加伤害值
            >> stSkillAttr.EHealValue       ///< 附加治疗值
            >> stSkillAttr.SEnergy          ///< 内力
            >> stSkillAttr.SMp              ///< 法力
            >> stSkillAttr.SHp              ///< 气血
            >> stSkillAttr.SStrength        ///< 力量
            >> stSkillAttr.SDexterity       ///< 身法
            >> stSkillAttr.SCon             ///< 根骨
            >> stSkillAttr.SIntellect       ///< 意志
            >> stSkillAttr.SSpiritualism    ///< 灵性
            >> stSkillAttr.TaoismLvl        ///< 有效道法等级
            >> stSkillAttr.OutEnergyPower   ///< 外功强度
            >> stSkillAttr.OutEnergyHurt    ///< 外功伤害
            >> stSkillAttr.EEnergyHit       ///< 内功伤害加成
            >> stSkillAttr.EEnergyHeal      ///< 内功治疗加成
            >> stSkillAttr.OutEnergyHitLvl  ///< 外功命中等级
            >> stSkillAttr.EnergyHitLvl     ///< 内功命中等级
            >> stSkillAttr.OutEnergyCriRatio///< 外功致命等级
            >> stSkillAttr.EnergyCriRatio   ///< 内功致命等级
            >> stSkillAttr.OutEnergyCri     ///< 外功致命伤害
            >> stSkillAttr.EnergyCri        ///< 内功致命伤害
            >> stSkillAttr.OutEnergySpeed   ///< 外功加速等级
            >> stSkillAttr.EnergySpeed      ///< 内功加速等级
            >> stSkillAttr.IgnoreTarget     ///< 熟练等级
            >> stSkillAttr.ArmorDef         ///< 护甲值
            >> stSkillAttr.DefLvl           ///< 防御等级
            >> stSkillAttr.ParryLvl         ///< 招架等级
            >> stSkillAttr.ToughnessLvl     ///< 韧性等级
            >> stSkillAttr.BrokenArmorLvl   ///< 破甲等级
            >> stSkillAttr.MissRatio        ///< 失误
            >> stSkillAttr.TaoismHurt       ///< 道法伤害
            >> stSkillAttr.TaoismHitLvl     ///< 道法命中等级
            >> stSkillAttr.TaoismHitRatio   ///< 道法致命等级
            >> stSkillAttr.TaoismSpeed      ///< 道法加速等级
            >> stSkillAttr.TaoismCri        ///< 道法致命伤害
            >> stSkillAttr.TaosimRiftLvl    ///< 道法穿透等级
            >> stSkillAttr.TaosimDefRatio   ///< 道法防御等级
            >> stSkillAttr.ERation          ///< 几率变量修正
            >> stSkillAttr.EArmorHp         ///< 护盾生命修正
            >> stSkillAttr.AttackSpeed      ///< 攻击速度
            >> stSkillAttr.MoveSpeed        ///< 移动速度
            >> stSkillAttr.ReadyTime        ///< 准备时间
            >> stSkillAttr.GridFlyTime      ///< 每格飞行时间 
            >> stSkillAttr.RangeTimes       ///< 作用范围目标次数
            >> stSkillAttr.RangeCount       ///< 作用范围目标个数
            >> stSkillAttr.BufId1           ///< 读取附加状 态
            >> stSkillAttr.BufLvl1
            >> stSkillAttr.BufNum1
            >> stSkillAttr.BufId2
            >> stSkillAttr.BufLvl2
            >> stSkillAttr.BufNum2
            >> stSkillAttr.BufId3
            >> stSkillAttr.BufLvl3
            >> stSkillAttr.BufNum3
            >> stSkillAttr.BufId4
            >> stSkillAttr.BufLvl4
            >> stSkillAttr.BufNum4
            >> stSkillAttr.BufId5
            >> stSkillAttr.BufLvl5
            >> stSkillAttr.BufNum5
            >> stSkillAttr.BufId6
            >> stSkillAttr.BufLvl6
            >> stSkillAttr.BufNum6;


        SkillIter itr = m_SkillAttriTable.find(Skillid);
        if( itr != m_SkillAttriTable.end() )
        {
            SkillTable::iterator litr =  itr->second.find( Level );
            if ( litr != itr->second.end() )
            {
                Log4c::Error(ROOT_MODULE,"%-15s %s",__FUNCTION__,FormatText("WS_SYS_32", filename,Skillid));
                return false;
            }
        }

        m_SkillAttriTable[ Skillid ][ Level ] = stSkillAttr;
    }
    return true;
}