Esempio n. 1
0
bool ObjProtoLoader::Load( GI::ObjProtoFactory *fac, void *u )
{
    CRFile *file = rfOpen( "data/goods/goodslist.dat" );
    if( !file ) return false;
    char mark[6] = { 0 };
    file->ReadData( mark, 5 );
    if( strcmp( mark, "GOODS" ) ) return false;
    long version;
    file->ReadData( &version, sizeof( version ) );
    long cnt;
    file->ReadData( &cnt, sizeof( cnt ) );
    for( long i = 0; i < cnt; ++ i )
    {
        GI::ObjectProto *proto = new GI::ObjectProto();
        if( !LoadProto( proto, file ) ) delete proto; 
        else
        {
            long index = TypeSet::ValueType::ToLong( proto->GetValue( 
                        TypeSet::KeyType( PINDEX ) ) );
            fac->AddProperty( index, proto );
        }
    }
    rfClose( file );
    return true;
}
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();
}
Esempio n. 4
0
/// 从文件加载统邮件配置
bool MailList::LoadSysMailList(const char* pFileName)
{
	Release();
	CRFile *prfile = rfOpen(pFileName);
	if(NULL == prfile)	
		return false;

	TiXmlNode *pNode = NULL;
	TiXmlDocument doc(pFileName);

	//载入技能配置文件
	doc.LoadData(prfile->GetData(), prfile->GetDatalen());
	rfClose(prfile);

	//取得第一个节点
	pNode = doc.FirstChild("Mail");	

	if (NULL == pNode)
	{
		return false;
	}

	TiXmlElement *pElem = pNode->ToElement();

	if(LoadSysMailList(pElem))
	{
		return true;	
	}
	else
	{
		return false;
	}
}
// 初始化,读XML配置文件
bool CChangeOccu::Init(const char *filename)
{
	if(filename)
	{
		m_vecSubOccu.clear();
		//=================================================================//
		CRFile *prfile = rfOpen(filename);
		if(NULL == prfile)
		{
			//输出错误信息
            Log4c::Error(ROOT_MODULE,"%-15s LoadFileError:%s",__FUNCTION__,filename);
			return false;
		}
		TiXmlNode *pNode = NULL; 		
		TiXmlDocument m_Tdoc(filename);
		//载入技能配置文件
		if( !m_Tdoc.LoadData(prfile->GetData(),prfile->GetDatalen()) )
		{
			//输出错误信息
			rfClose(prfile);
			return false;
		}
		rfClose(prfile);
		//=================================================================//
		//找到根节点,如果无节点,输出错误提示
		pNode = m_Tdoc.FirstChild("ChangeOccu");
		if (pNode==NULL)
		{
			return false;
		}
		//类型转换
		TiXmlElement* pElem = pNode->ToElement();
		// 便利子节点,设置属性
		for (TiXmlElement *pOccuElem=pElem->FirstChildElement(); pOccuElem!=NULL; 
			pOccuElem=pOccuElem->NextSiblingElement())
		{
			if(!strcmp(pOccuElem->Value(),"Occu")
				&& NULL!=pOccuElem->Attribute("name")
				&& NULL!=pOccuElem->Attribute("id")
				&& NULL!=pOccuElem->Attribute("parentid")
				&& NULL!=pOccuElem->Attribute("value")
				&& NULL!=pOccuElem->Attribute("goods")
				&& NULL!=pOccuElem->Attribute("goodsNum"))
			{
				tagChangeOccu stChangeOccu;
				stChangeOccu.strName		= pOccuElem->Attribute("name");
				stChangeOccu.strGoodsName	= pOccuElem->Attribute("goods");
				stChangeOccu.nID			= atoi(pOccuElem->Attribute("id"));
				stChangeOccu.nParentID		= atoi(pOccuElem->Attribute("parentid"));
				stChangeOccu.nValue			= atoi(pOccuElem->Attribute("value"));
				stChangeOccu.lGoodsNum		= atoi(pOccuElem->Attribute("goodsNum"));
				m_vecSubOccu.push_back(stChangeOccu);
			}
		}
		return true;
	}
	return false;
}
// 从文件读取列表
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;
}
Esempio n. 8
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;
}
Esempio n. 10
0
// 解析XML中关于复活物品的配置
bool CReLiveGoodsList::Init(const char *filename)
{
	if (NULL==filename)
	{
		return false;
	}
	char strError[128];
	//=================================================================//
	CRFile *prfile = rfOpen(filename);
	if(NULL == prfile)
	{
		//输出错误信息
		_snprintf(strError, 128, "LoadFileError:%s",filename);
		MessageBox(NULL,strError,"",MB_OK); 
		return false;
	}
	TiXmlNode *pNode = NULL; 		
	TiXmlDocument m_Tdoc(filename);
	//载入复活物品配置文件
	if( !m_Tdoc.LoadData(prfile->GetData(),prfile->GetDatalen()) )
	{
		//输出错误信息
		_snprintf(strError, 128, CStringReading::LoadString(IDS_WS_SKILL,STR_WS_SKILL_FOURTH),filename);
		MessageBox(NULL,strError,"",MB_OK); 
		rfClose(prfile);
		return false;
	}
	rfClose(prfile);
	//=================================================================//
	//找到根节点,如果无节点,输出错误提示
	pNode = m_Tdoc.FirstChild("Goods");
	if (pNode==NULL)
	{
		string strNode = "Goods";
		_snprintf(strError, 128, CStringReading::LoadString(IDS_WS_SKILL,STR_WS_SKILL_FIFTH),filename,strNode.c_str());
		MessageBox(NULL,strError,"",MB_OK); 
		return false;
	}
	TiXmlElement* pElem = pNode->ToElement();

	for (TiXmlElement *pChildElem=pElem->FirstChildElement(); pChildElem!=NULL; 
		pChildElem=pChildElem->NextSiblingElement())
	{

		if (!stricmp(pChildElem->Value(),"ReLiveGoods"))
		{
			tagReLiveGoods *ptgReliveGoods  = new tagReLiveGoods;
			ptgReliveGoods->strOrignalName  = pChildElem->Attribute("OrignalName");
			ptgReliveGoods->dwIndex			= (DWORD)atol(pChildElem->Attribute("Index"));
			ptgReliveGoods->dwNum			= (DWORD)atol( pChildElem->Attribute("GoodsNum"));
			ptgReliveGoods->dwRecoverRatio  = (DWORD)atol(pChildElem->Attribute("RecoverRatio"));
			m_lReLiveGoods.push_back(ptgReliveGoods);		
		}
		else if(!stricmp(pChildElem->Value(),"ExpGoods"))
		{
			tagExpGoods *ptgExpGoods = new tagExpGoods;
			string strOrgName		 = pChildElem->Attribute("OrignalName");
			ptgExpGoods->dwExpRatio  = atoi(pChildElem->Attribute("ExpRatio"));			
			if (pChildElem->Attribute("Script"))
			{
				ptgExpGoods->strScript   = pChildElem->Attribute("Script");
			}
			if (pChildElem->Attribute("Hint"))
			{
				ptgExpGoods->strHint	 = pChildElem->Attribute("Hint");
			}
			
			
			map<string,tagExpGoods*>::iterator it = m_mpExpGoods.find(strOrgName);
			if (it!=m_mpExpGoods.end())
			{
				SAFE_DELETE(ptgExpGoods);
			}
			else
			{
				m_mpExpGoods[strOrgName] = ptgExpGoods;
			}
			
		}
	}
	return true;
}
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;
}
// 初始化,读XML配置文件
bool COccupSkillList::Init(const char *filename)
{
	if(!filename)	return false;
	Release();
	//=================================================================//
	CRFile *prfile = rfOpen(filename);
	if(NULL == prfile)
	{
		//输出错误信息
        Log4c::Error(ROOT_MODULE,"%-15s LoadFileError:%s",__FUNCTION__,filename);
		return false;
	}
	TiXmlNode *pNode = NULL; 		
	TiXmlDocument m_Tdoc(filename);
	//载入技能配置文件
	if( !m_Tdoc.LoadData(prfile->GetData(),prfile->GetDatalen()) )
	{
		//输出错误信息
        Log4c::Error(ROOT_MODULE,"%-15s %s",__FUNCTION__,FormatText("WS_SKILL_FOURTH",filename));

		rfClose(prfile);
		return false;
	}
	rfClose(prfile);
	//=================================================================//
	//找到根节点,如果无节点,输出错误提示
	pNode = m_Tdoc.FirstChild("OccupSkillList");
	if (pNode==NULL)
	{
        Log4c::Error(ROOT_MODULE,"%-15s %s",__FUNCTION__,GetText("WS_SKILL_SEVENTH"));
		return false;
	}
	//类型转换
	TiXmlElement* pElem = pNode->ToElement();
	// 便利子节点,设置属性
	for (TiXmlElement *pChildElem=pElem->FirstChildElement(); pChildElem!=NULL; 
		pChildElem=pChildElem->NextSiblingElement())
	{
		if(!strcmp(pChildElem->Value(),"Occup")
			&& NULL!=pChildElem->Attribute("name")
			&& NULL!=pChildElem->Attribute("ID"))
		{
			COccupSkill * pOccupSkill = new COccupSkill;
			pOccupSkill->SetName(pChildElem->Attribute("name"));
			pOccupSkill->SetOccupId((long)atoi(pChildElem->Attribute("ID")));
			// 职业描述
			if(NULL!=pChildElem->Attribute("Desc"))
			{
				pOccupSkill->SetDesc(pChildElem->Attribute("Desc"));
			}
			// 读每个职业的技能列表
			if(pOccupSkill->Init(pChildElem))
				m_OccupSkillList.push_back(pOccupSkill);
			// 读取职业技能列表失败
			else
			{
				delete pOccupSkill;
				pOccupSkill = NULL;
			}
		}
	}
	m_Tdoc.Clear();
	return true;
}
Esempio n. 13
0
	bool CConfiger::LoadShopList( const char *file )
	{
		CRFile *prfile = rfOpen( file );
		if( prfile == NULL )
		{
			PutoutLog( LOG_FILE, LT_ERROR, "Load file %s failed.", file );
			return false;
		}

		TiXmlDocument doc;
		if( !doc.LoadData( prfile->GetData(), prfile->GetDatalen() ) )
		{
			PutoutLog( LOG_FILE, LT_ERROR, "Parse %s failed, invalid xml format.", file );
			rfClose( prfile );
			return false;
		}
		rfClose( prfile );
		TiXmlElement *root = doc.RootElement();
		{
			// global config
			TiXmlElement *node = root->FirstChildElement( "Global" );
			QUERY_NUM( "goods_update_interval", m_GlobalCfg.uGoodsUpdateInter, node, unsigned long );
			QUERY_NUM( "buy_count", m_GlobalCfg.lBuyCount, node, long );
			QUERY_NUM( "enable", m_GlobalCfg.lEnable, node, long );
			QUERY_NUM( "player_buy_count", m_GlobalCfg.lPlayerBuyCount, node, long );

			char strCoinGoods[64];
			QUERY_STR( "coin_goods", strCoinGoods, node );
			m_GlobalCfg.lCoinGoodsIndex = CGoodsFactory::QueryGoodsIDByOriginalName( strCoinGoods );
		}
		{
			// shop list
			TiXmlElement *shoplist_node = root->FirstChildElement( "ShopList" );
			for( TiXmlElement *shop_node = shoplist_node->FirstChildElement();
				shop_node != NULL; shop_node = shop_node->NextSiblingElement() )
			{
				long id;
				QUERY_NUM( "id", id, shop_node, long );
				if( m_ShopTable.find( id ) != m_ShopTable.end() )
				{
					// more than 1 shop with the same id, ignore it.
					PutoutLog( LOG_FILE, LT_WARNING, "More than 1 shop with the same id [%d].", id );
					continue;
				}
				Shop shop;
				QUERY_STR( "npc_orig_name", shop.npcOrigName, shop_node );
				SellGoodsListT *pSellGoodsList = new SellGoodsListT();
				shop.SellList = pSellGoodsList;
				for( TiXmlElement *goods_node = shop_node->FirstChildElement();
					goods_node != NULL; goods_node = goods_node->NextSiblingElement() )
				{
					SellGoods goods;
					char strOrigName[64];
					QUERY_STR( "orig_name", strOrigName, goods_node );
					goods.lIndex = CGoodsFactory::QueryGoodsIDByOriginalName( strOrigName );
					pSellGoodsList->push_back( goods );
				}
				m_ShopTable.insert( std::make_pair( id, shop ) );
			}
		}
		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;
}
Esempio n. 15
0
//从文件读取套装属性列表
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));
		}
Esempio n. 16
0
// 从文件读取原始物品列表
bool CGoodsList::LoadGoodsList(const char* filename)
{
	m_mapGoodsList.clear();
	m_mapGoodsListByName.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 false;
	}

	// 文件头和版本
	char szHeader[6];
	memset(szHeader, 0, 6);
	prfile->ReadData(szHeader, 5);
	if( strcmp(szHeader, "GOODS") != 0 )
	{
		char str[256];
		sprintf(str, "file '%s' is not goodslist file!", filename);
		MessageBox(g_hWnd, str, "error", MB_OK);
		rfClose(prfile);
		return false;
	}

	long lVersion = 0;
	prfile->ReadData(&lVersion, sizeof(long));

	// 具体内容

	long lNum = 0;
	prfile->ReadData(&lNum, sizeof(long));
	for(int i=0; i<lNum; i++)
	{
		long lStrSize=0;
		tagGoods2 stGoods;

		prfile->ReadData(&stGoods.BaseProperty.dwIndex, sizeof(stGoods.BaseProperty.dwIndex));

		prfile->ReadData(&lStrSize, sizeof(long));
		char *pStrOrginName=new char[lStrSize+1];	
		prfile->ReadData(pStrOrginName, lStrSize);
		pStrOrginName[lStrSize]='\0';
		stGoods.BaseProperty.strOrginName=pStrOrginName;
		SAFE_DELETE(pStrOrginName);
		prfile->ReadData(&lStrSize, sizeof(long));
		char *pStrName=new char[lStrSize+1];

		prfile->ReadData(pStrName, lStrSize);
		pStrName[lStrSize]='\0';
		stGoods.BaseProperty.strName=pStrName;
		SAFE_DELETE(pStrName);

		prfile->ReadData(&stGoods.BaseProperty.dwIconId, sizeof(stGoods.BaseProperty.dwIconId));		//	界面图形ID
		prfile->ReadData(&stGoods.BaseProperty.dwGroundId, sizeof(stGoods.BaseProperty.dwGroundId));		//	落地后图形ID
		prfile->ReadData(&stGoods.BaseProperty.dwEquipID, sizeof(stGoods.BaseProperty.dwEquipID));		//	换装图形ID
		prfile->ReadData(&stGoods.BaseProperty.dwSound, sizeof(stGoods.BaseProperty.dwSound));		//	拾取声音
		prfile->ReadData(&stGoods.BaseProperty.dwSoundID1, sizeof(stGoods.BaseProperty.dwSoundID1));		//	挥动/弱伤害声音
		prfile->ReadData(&stGoods.BaseProperty.dwSoundID2, sizeof(stGoods.BaseProperty.dwSoundID2));		//	特殊攻击/击中声音
		prfile->ReadData(&stGoods.BaseProperty.bSoundSwitch, sizeof(stGoods.BaseProperty.bSoundSwitch));	//	攻击时是否混音
		prfile->ReadData(&stGoods.BaseProperty.dwWeaponActType, sizeof(stGoods.BaseProperty.dwWeaponActType));//	武器对应的动作类型
		prfile->ReadData(&stGoods.BaseProperty.dwType, sizeof(stGoods.BaseProperty.dwType));				// 类型
		prfile->ReadData(&stGoods.BaseProperty.dwPrice, sizeof(stGoods.BaseProperty.dwPrice));				// 金币价格
		prfile->ReadData(&stGoods.BaseProperty.dwSilverPrice, sizeof(stGoods.BaseProperty.dwSilverPrice));	// 银币价格
		//prfile->ReadData(&stGoods.BaseProperty.dwWeight, sizeof(stGoods.BaseProperty.dwWeight));

		//中文描述内容
		prfile->ReadData(&lStrSize, sizeof(long));
		char *pStrContent=new char[lStrSize+1];	
		prfile->ReadData(pStrContent, lStrSize);
		pStrContent[lStrSize]='\0';
		stGoods.BaseProperty.strContent=pStrContent;
		SAFE_DELETE(pStrContent);

		long lEffectNum = 0;
		prfile->ReadData(&lEffectNum, sizeof(long));
		ushort wType=0;
		for(int j=0;j<lEffectNum;j++)
		{
			tagEffect stEffect;

			prfile->ReadData(&wType/*&stEffect.wType*/,sizeof(ushort));
			stEffect.wType=wType+1;
			prfile->ReadData(&stEffect.bEnable,sizeof(bool));
			prfile->ReadData(&stEffect.bHide,sizeof(bool));
			prfile->ReadData(&stEffect.dwValue1,sizeof(ulong));
			prfile->ReadData(&stEffect.dwValue2,sizeof(ulong));
			//prfile->ReadData(&stEffect.wOdds,sizeof(ushort));
			stGoods.vectorEffect.push_back(stEffect);
		}		

		//////////////////读套装属性/////////////////////////
		prfile->ReadData(&lEffectNum, sizeof(long));
		for(int i=0;i<lEffectNum;i++)
		{
			tagGoodsBeControlledAttri stSuitSingleGoodsAttri;

			prfile->ReadData(&wType,sizeof(ushort));
			stSuitSingleGoodsAttri.wPropertyName = wType+1;
			prfile->ReadData(&(stSuitSingleGoodsAttri.dwValue1),sizeof(ulong));
			prfile->ReadData(&(stSuitSingleGoodsAttri.dwValue2),sizeof(ulong));
			prfile->ReadData(&(stSuitSingleGoodsAttri.wActiveNum),sizeof(ushort));

			stGoods.m_SuitProperty.push_back(stSuitSingleGoodsAttri);
		}

		////////////////属性激发的属性////////////////////
		prfile->ReadData(&lEffectNum, sizeof(long));
		for(int i=0;i<lEffectNum;i++)
		{
			tagGoodsBeControlledAttri stGoodsAktiviertAttri;

			prfile->ReadData(&wType,sizeof(ushort));
			stGoodsAktiviertAttri.wPropertyName = wType+1;
			prfile->ReadData(&(stGoodsAktiviertAttri.dwValue1),sizeof(ulong));
			prfile->ReadData(&(stGoodsAktiviertAttri.dwValue2),sizeof(ulong));
			prfile->ReadData(&(stGoodsAktiviertAttri.wActiveNum),sizeof(ushort));

			stGoods.m_AkiviertProperty.push_back(stGoodsAktiviertAttri);
		}

		//////////////////////////////////////////////////////
		m_mapGoodsList[stGoods.BaseProperty.dwIndex] = stGoods;
		/////////////测试信息////////////
		//if (stGoods.BaseProperty.dwIndex==32)
		//{
		//	char buf[256];
		//	vector<CGoodsList::tagEffect>::iterator Iter = stGoods.vectorEffect.begin();
		//	for(;Iter!=stGoods.vectorEffect.end();Iter++)
		//	{
		//		PutDebugString(ltoa(Iter->wType,buf,10));
		//		PutDebugString(ltoa(Iter->dwValue1,buf,10));
		//	}
		//}
		////////////////////////////////
		m_mapGoodsListByName[stGoods.BaseProperty.strOrginName] = &m_mapGoodsList[stGoods.BaseProperty.dwIndex];
	}

	rfClose(prfile);
	return true;
}
//! 读取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
	{
Esempio n. 18
0
long   PhaseSetup::Load()
{
      Release();
      const char* rfile = "data/PhaseSetup.xml";
      CRFile* prFile = rfOpen( rfile );
      if ( prFile == NULL )
      {
          Log4c::Error(ROOT_MODULE,"%-15s %s",__FUNCTION__, "Load PhaseSetup.xml failed ");
          return  0;
      }

      TiXmlDocument doc(rfile);
      doc.LoadData( prFile->GetData() , prFile->GetDatalen() );
      rfClose( prFile );

      TiXmlElement* pRoot = doc.RootElement();
      if ( pRoot == NULL )
          return 0;

      TiXmlElement* pBaseElem = pRoot->FirstChildElement( "Base" );
      if ( pBaseElem == NULL )
      {
          Log4c::Error(ROOT_MODULE,"%-15s %s",__FUNCTION__, "Load PhaseSetup.xml Base Node failed ");
      }
      else 
      {
          XML_QUERY_NUM( "Agonal", m_config.lAgonal, pBaseElem , long );
          XML_QUERY_NUM( "HpNum", m_config.lHpNum  , pBaseElem , long );
          XML_QUERY_NUM( "DropGoodNum",m_config.lDropGoodNum,pBaseElem,long);
          XML_QUERY_NUM( "IsOpen", m_config.lIsOpen , pBaseElem , long );
      }

      TiXmlElement* pPhaseElem = pRoot->FirstChildElement("PhaseSetup");
      if ( pPhaseElem ==  NULL )
      {
          Log4c::Error(ROOT_MODULE,"%-15s %s",__FUNCTION__, "Load PhaseSetup Node Failed!" );
      }
      else 
      {   
          long   type = 0 ;
          PhaseTable  tpTemp;
          /// PlayerOper;
          TiXmlElement* pOper = pPhaseElem->FirstChildElement("PlayerOper");
          if( pOper == NULL )
          {
                Log4c::Error(ROOT_MODULE,"%-15s %s",__FUNCTION__,"Load PlayerOper Node Failed!" );
                return 0;
          } 
          XML_QUERY_NUM( "type", type , pOper, long );
          tpTemp.clear();
          for ( TiXmlElement* pEvent = pOper->FirstChildElement("Event"); pEvent != NULL ;  pEvent = pEvent->NextSiblingElement())
          {
              const char *file = NULL;
              int  id = 0;
              XML_QUERY_NUM( "id", id, pEvent, long );
              XML_QUERY_STR( "script", file, pEvent );

              tpTemp.insert( std::pair<long,std::string>( id, file) ) ;
          }
          m_PhaseTable.insert( std::pair<long,PhaseTable>(type,tpTemp) );

          /// PhaseTimeType
          TiXmlElement* TimeType= pPhaseElem->FirstChildElement("PhaseTimeType");
          if( TimeType == NULL )
          {
              Log4c::Error(ROOT_MODULE,"%-15s %s",__FUNCTION__, "Load PhaseTimeType Node Failed!" );
              return 0;
          }
          XML_QUERY_NUM( "type", type , TimeType, long );
          tpTemp.clear();
          for ( TiXmlElement* PhaseTime = TimeType->FirstChildElement("Event"); PhaseTime != NULL ;  PhaseTime = PhaseTime->NextSiblingElement())
          {
              const char *file = NULL;
              int  id = 0;
              XML_QUERY_NUM( "id", id, PhaseTime, long );
              XML_QUERY_STR( "script", file, PhaseTime );

              tpTemp.insert( std::pair<long,std::string>( id, file) ) ;
          }
          m_PhaseTable.insert( std::pair<long,PhaseTable>(type,tpTemp) );

          /// PhaseEvent
          TiXmlElement* Event= pPhaseElem->FirstChildElement("PhaseEvent");
          if( Event == NULL )
          {
             Log4c::Error(ROOT_MODULE,"%-15s %s",__FUNCTION__, "Load PhaseEvent Node Failed!" );
              return 0;
          }
          XML_QUERY_NUM( "type", type , Event, long );
          tpTemp.clear();
          for ( TiXmlElement* Ent = Event->FirstChildElement("Event"); Ent != NULL ;  Ent = Ent->NextSiblingElement())
          {
              const char *file = NULL;
              int  id = 0;
              XML_QUERY_NUM( "id", id, Ent, long );
              XML_QUERY_STR( "script", file, Ent );

              tpTemp.insert( std::pair<long,std::string>( id, file) ) ;
          }
          m_PhaseTable.insert( std::pair<long,PhaseTable>(type,tpTemp) );
      }
      return 1;
}
Esempio n. 19
0
//! 读取配置
BOOL SpriteSystem::LoadSetup(void)
{
	BOOL bReturnValue = TRUE;
	//! ----------------------------根节点----------------------------
	TiXmlNode *pNode = NULL; 		
	
	CRFile* prFile = rfOpen("data/Sprite.xml");
	if (prFile == NULL)
	{
		return FALSE;
	}
	TiXmlDocument* m_Tdoc = new TiXmlDocument;

	if(!m_Tdoc->LoadData(prFile->GetData(),prFile->GetDatalen()))
		return FALSE;

	rfClose(prFile);
	pNode=m_Tdoc->FirstChild("Sprite");
	if (pNode==NULL) 
		return FALSE;

	TiXmlElement* pSprite = pNode->ToElement();//获取node 的指针
	if (pSprite==NULL) 
		return FALSE;

	//! ----------------------------获取配置----------------------------

	try
	{
		//! 自动补给物
		TiXmlElement* pAutoSupplyGoods = pSprite->FirstChildElement("AutoSupplyGoods");

		TiXmlElement* pGoods = pAutoSupplyGoods->FirstChildElement("Goods");
		for (; pGoods!=NULL; pGoods = pGoods->NextSiblingElement())
		{
			const char *pGoodsName = pGoods->Attribute("ItemName");
			LONG lGoodsBaseIndex = CGoodsFactory::QueryGoodsIDByOriginalName(pGoodsName);
			if (0 == lGoodsBaseIndex)
			{
				AddErrorLogText("读取自动补给配置失败:没有找到原始名为[%s]的物品!!!", pGoodsName);
				bReturnValue = FALSE;
				continue;
			}
			if (c_mapCanUseGoodsIndex.end() != c_mapCanUseGoodsIndex.find(lGoodsBaseIndex))
			{
				AddErrorLogText("读取自动补给配置失败:重复配置原始名为[%s]的物品!!!", pGoodsName);
				bReturnValue = FALSE;
				continue;
			}

			//! 物品应用范围
			DWORD dwBound = 0;
			const char *pBound = pGoods->Attribute("Bound");
			if (NULL == pBound)
			{
				AddErrorLogText("读取自动补给配置失败:原始名为[%s]的物品应用范围配置错误!!!", pGoodsName);
				bReturnValue = FALSE;
				continue;
			}
			LONG lBound = atoi(pBound);
			lBound = lBound % 10000;
			if(0 != lBound / 1000)	dwBound |= eGAB_POWER;
			lBound = lBound % 1000;
			if(0 != lBound / 100)	dwBound |= eGAB_SMP;
			lBound = lBound % 100;
			if(0 != lBound / 10)	dwBound |= eGAB_MP;
			lBound = lBound % 10;
			if(0 != lBound)			dwBound |= eGAB_HP;
			if(0 == dwBound)
			{
				AddErrorLogText("读取自动补给配置失败:原始名为[%s]的物品应用范围配置错误!!!", pGoodsName);
				bReturnValue = FALSE;
				continue;
			}
			
			c_mapCanUseGoodsIndex[lGoodsBaseIndex] = dwBound;
		}
        //加载战斗技能
        TiXmlElement* pAutoFightSkills = pSprite->FirstChildElement("AutoFightSkills");
        TiXmlElement* pFightSkills = pAutoFightSkills->FirstChildElement("Skills");
        for (; pFightSkills != NULL; pFightSkills = pFightSkills->NextSiblingElement("Skills"))
        {
            const char* pSkillID = pFightSkills->Attribute("ID");
            if (pSkillID == NULL)
            {
                AddErrorLogText("读取自动战斗技能配置失败:技能ID为[%s]配置错误!!!", pSkillID);
                bReturnValue = FALSE;
                continue;
            }
            LONG lID = atoi(pSkillID);
            if (FindExist(c_vectorCanUseFightSkill, lID))
            {
                AddErrorLogText("读取自动使用战斗技能配置失败:重复配置技能ID为[%s]!!!", pSkillID);
                bReturnValue = FALSE;
                continue;
            }
            c_vectorCanUseFightSkill.push_back(lID);
        }

        //加载辅助技能
        TiXmlElement* pAutoAssistSkills = pSprite->FirstChildElement("AutoAssistSkills");
        TiXmlElement* pAssistSkills = pAutoAssistSkills->FirstChildElement("Skills");
        for (; pAssistSkills != NULL; pAssistSkills = pAssistSkills->NextSiblingElement("Skills"))
        {
            const char* pSkillID = pAssistSkills->Attribute("ID");
            if (pSkillID == NULL)
            {
                AddErrorLogText("读取自动使用辅助技能配置失败:技能ID为[%s]配置错误!!!", pSkillID);
                bReturnValue = FALSE;
                continue;
            }
            LONG lAssistID = atoi(pSkillID);
            if (FindExist(c_vectorCanUseAssistSkill, lAssistID))
            {
                AddErrorLogText("读取自动使用辅助技能配置失败:重复配置技能ID为[%s]!!!", pSkillID);
                bReturnValue = FALSE;
                continue;
            }
            c_vectorCanUseAssistSkill.push_back(lAssistID);
        }
        //加载辅助道具
        TiXmlElement* pAutoAssistGoods = pSprite->FirstChildElement("AutoAssistGoods");
        TiXmlElement* pAssistGoods = pAutoAssistGoods->FirstChildElement("Goods");
        for (; pAssistGoods != NULL; pAssistGoods = pAssistGoods->NextSiblingElement("Goods"))
        {
            const char* pGoodsName = pAssistGoods->Attribute("ItemName");
            LONG lGoodsBaseIndex = CGoodsFactory::QueryGoodsIDByOriginalName(pGoodsName);
            if (lGoodsBaseIndex == 0)
            {
                AddErrorLogText("读取自动使用辅助道具配置失败:没有找到原始名为[%s]的物品道具!!!", pGoodsName);
                bReturnValue = FALSE;
                continue;
            }
            if (FindExist(c_vectorCanUseAssistGoods, lGoodsBaseIndex))
            {
                AddErrorLogText("读取自动使用辅助道具配置失败:重复配置原始名为[%s]的物品!!!", pGoodsName);
                bReturnValue = FALSE;
                continue;
            }
            c_vectorCanUseAssistGoods.push_back(lGoodsBaseIndex);
        }
	}
	catch (...)
	{
		AddErrorLogText("在读取小精灵配置的时候发生了错误,读取失败,可能的原因是配置不当。");
		if (NULL != m_Tdoc)
		{
			delete m_Tdoc;
			m_Tdoc = NULL;
		}
		return FALSE;
	}


	//! ----------------------------清除对象----------------------------
	delete m_Tdoc;
	m_Tdoc = NULL;
	return bReturnValue;
}