void ZConfiguration::ParseLocaleSelectableLanguages(MXmlElement& selectableLangsElem)
{
	char szTag[256];
	char szLanguageID[256];
	char szLanguageName[256];
	MXmlElement elem;
	int numChild = selectableLangsElem.GetChildNodeCount();

	for (int i=0; i<numChild; ++i)
	{
		elem = selectableLangsElem.GetChildNode(i);
		elem.GetTagName(szTag);
		if (strcmp(szTag, ZTOK_LOCALE_LANGUAGE) == 0)
		{
			bool bID	= elem.GetAttribute(szLanguageID, "id");
			bool bName	= elem.GetAttribute(szLanguageName, "name");
			_ASSERT(bID && bName);

			ZCONFIG_SELECTABLE_LANGUAGE langSelectable;
			langSelectable.strLanguage = szLanguageID;
			langSelectable.strLanguageName = szLanguageName;
			m_Locale.vecSelectableLanguage.push_back(langSelectable);
		}
	}
}
bool ZGameTypeList::ParseMaxPlayers( ZGameTypeConfig* pConfig, MXmlElement& element)
{
	int nValue;
	char szStr[ 16];
	bool selected = false;
	element.GetAttribute( &nValue,   "player");
	element.GetAttribute( szStr,     "str");
	element.GetAttribute( &selected, "default");

	ZGameTypeConfigData* pCfgData = new ZGameTypeConfigData;
	pCfgData->m_nValue = nValue;
	strcpy( pCfgData->m_szString, szStr);
	pConfig->m_MaxPlayers.push_back( pCfgData);

	return selected;		// Is default?
}
void MMatchEventFactoryManager::ParseGameType( MXmlElement& chrElement, vector< EventGameType >& vGameType )
{
	EventGameType GameType;
	char szAttrName[ 128 ];
	char szAttrValue[ 256 ];
	const int nAttrCnt = chrElement.GetAttributeCount();
	for( int i = 0; i < nAttrCnt; ++i )
	{
		chrElement.GetAttribute( i, szAttrName, szAttrValue );

		if( 0 == stricmp(EL_ORDER, szAttrName) )
		{
			GameType.dwOrder = static_cast< DWORD >( atol(szAttrValue) );
			continue;
		}

		if( 0 == stricmp(EL_TYPE, szAttrName) )
		{
			GameType.GameType = static_cast< MMATCH_GAMETYPE >( atoi(szAttrValue) );
			continue;
		}
	}

	vGameType.push_back( GameType );
}
void MQuestScenarioCatalogue::ParseRewardItem(MXmlElement& element, MQuestScenarioInfo* pScenarioInfo)
{
	char szAttrValue[256], szAttrName[64];

	int nIndex = pScenarioInfo->nRewardItemCount;
	pScenarioInfo->nRewardItemCount++;

	int nAttrCount = element.GetAttributeCount();
	for (int i = 0; i < nAttrCount; i++)
	{
		element.GetAttribute(i, szAttrName, szAttrValue);
		if (!_stricmp(szAttrName, MTOK_SCENARIO_TYPE))
		{
			
		}
		else if (!_stricmp(szAttrName, MTOK_SCENARIO_ITEMID))
		{
			pScenarioInfo->nRewardItemID[nIndex] = atoi(szAttrValue);
		}
		else if (!_stricmp(szAttrName, MTOK_SCENARIO_RATE))
		{
			pScenarioInfo->fRewardItemRate[nIndex] = (float)atof(szAttrValue);
		}
	}

}
bool ZGameTypeList::ParseLimitTime( ZGameTypeConfig* pConfig, MXmlElement& element)
{
	int nValue;
	char szStr[ 256];
	bool selected = false;
	element.GetAttribute( &nValue,   "sec");
	element.GetAttribute( szStr,     "str");
	element.GetAttribute( &selected, "default");

	ZGameTypeConfigData* pCfgData = new ZGameTypeConfigData;
	pCfgData->m_nValue = nValue;
	
	strcpy( pCfgData->m_szString, ZGetStringResManager()->GetStringFromXml(szStr));
	pConfig->m_LimitTime.push_back( pCfgData);

	return selected;		// Is default?
}
void MChannelRuleMgr::ParseRule(MXmlElement* pElement)
{
	// Get Rule Node
	int nID = 0;
	pElement->GetAttribute(&nID, MTOK_CHANNELRULE_ATTR_ID);
	char szName[128]="";
	pElement->GetAttribute(szName, MTOK_CHANNELRULE_ATTR_NAME);	

	MChannelRule* pRule = new MChannelRule;
	pRule->Init(nID, szName);

	// Get Map Nodes
	MXmlElement childElement;
	char szTagName[256]=""; char szAttr[256]="";

	int nCount = pElement->GetChildNodeCount();
	for (int i=0; i<nCount; i++) {
		childElement = pElement->GetChildNode(i);

		childElement.GetTagName(szTagName);
		if (szTagName[0] == '#') continue;

		if (!_stricmp(szTagName, MTOK_CHANNELMAP))
		{
			if (childElement.GetAttribute(szAttr, MTOK_CHANNELRULE_ATTR_NAME))
			{
				pRule->AddMap(szAttr);
			}
		}
		else if (!_stricmp(szTagName, MTOK_CHANNELRULE_GAMETYPE))
		{
			int nAttr = -1;
			if (childElement.GetAttribute(&nAttr, MTOK_CHANNELRULE_ATTR_ID))
			{
				pRule->AddGameType(nAttr);
			}
		}
	}

	AddRule(pRule);
}
void MMatchEventFactoryManager::ParseEventPartTime( MXmlElement& chrElement, vector<EventPartTime>& EventPartTimeVec )
{
	EventPartTime ept;

	char szAttrName[ 128 ];
	char szAttrValue[ 256 ];
	const int nAttrCnt = chrElement.GetAttributeCount();
	for( int i = 0; i < nAttrCnt; ++i )
	{
		chrElement.GetAttribute( i, szAttrName, szAttrValue );

		/*
		if( 0 == stricmp(EL_ORDER, szAttrName) )
		{
			continue;
		}
		*/

		if( 0 == stricmp(EL_START_HOUR, szAttrName) )
		{
			ept.btStartHour = static_cast< BYTE >( atoi(szAttrValue) );
			continue;
		}

		if( 0 == stricmp(EL_END_HOUR, szAttrName) )
		{
			ept.btEndHour = static_cast< BYTE >( atoi(szAttrValue) );
			continue;
		}
	}

#ifdef _DEBUG
	// 중복되는 범위가 있는지 검사.
	vector< EventPartTime >::iterator it, end;
	end = EventPartTimeVec.end();
	for( it = EventPartTimeVec.begin(); it != end; ++it )
	{
		if( (it->btStartHour <= ept.btStartHour) && (ept.btStartHour <= it->btEndHour) )
		{
			ASSERT( 0 );
		}
		
		if( (it->btStartHour <= ept.btEndHour) && (ept.btEndHour <= it->btEndHour) )
		{
			ASSERT( 0 );
		}
	}
#endif

	EventPartTimeVec.push_back( ept );
}
void MQuestScenarioCatalogue::ParseSacriItem(MXmlElement& element, MQuestScenarioInfo* pScenarioInfo)
{
	char szAttrValue[256], szAttrName[64];

	int nIndex = pScenarioInfo->nResSacriItemCount;
	pScenarioInfo->nResSacriItemCount++;

	int nAttrCount = element.GetAttributeCount();
	for (int i = 0; i < nAttrCount; i++)
	{
		element.GetAttribute(i, szAttrName, szAttrValue);
		if (!_stricmp(szAttrName, MTOK_SCENARIO_ITEMID))
		{
			pScenarioInfo->nResSacriItemID[nIndex] = atoi(szAttrValue);
		}
	}
}
void MMatchEventFactoryManager::ParseStartEndTime( MXmlElement& chrElement, SYSTEMTIME& stTime )
{
	memset( &stTime, 0, sizeof(stTime) );

	char szAttrName[ 128 ];
	char szAttrValue[ 256 ];
	const int nAttrCnt = chrElement.GetAttributeCount();
	for( int i = 0; i < nAttrCnt; ++i )
	{
		chrElement.GetAttribute( i, szAttrName, szAttrValue );

		if( 0 == stricmp(EL_YEAR, szAttrName) )
		{
			stTime.wYear =  static_cast< WORD >( atoi(szAttrValue) );
			continue;
		}

		if( 0 == stricmp(EL_MONTH, szAttrName) )
		{
			stTime.wMonth = static_cast< WORD >( atoi(szAttrValue) );
			continue;
		}

		if( 0 == stricmp(EL_DAY, szAttrName) )
		{
			stTime.wDay = static_cast< WORD >( atoi(szAttrValue) );
			continue;
		}

		if( 0 == stricmp(EL_HOUR, szAttrName) )
		{
			stTime.wHour = static_cast< WORD >( atoi(szAttrValue) );
			continue;
		}
	}
}
Exemple #10
0
ZRoomListBox* ZIDLResource::GetRoomListBox( MXmlElement& element )
{
	MXmlElement childElement;
	char szBuf[4096];
	char szAttr[4096];
	
	MWidget* pParentWidget = GetParentWidget(element);
	ZRoomListBox* pWidget = new ZRoomListBox("", pParentWidget, pParentWidget);
	InsertWidget(element, pWidget);

	int iCount = element.GetChildNodeCount();

	for (int i = 0; i < iCount; i++)
	{
		memset(szBuf, 0, sizeof(szBuf));
		childElement = element.GetChildNode(i);
		childElement.GetTagName(szBuf);

		if(GetCommonWidgetProperty(pWidget, childElement, szBuf)) continue;
		else	if( strcmp(szBuf, "BITMAP") == 0)
		{
			childElement.GetAttribute(szAttr, "type" );
			if( strcmp(szAttr,"frame") == 0)
			{
				pWidget->SetFrameImage( GetBitmap(childElement));				
			}
			else if( strcmp(szAttr, "back") == 0 )
			{
				childElement.GetContents(szAttr);

				MBitmap* pBitmap =GetBitmap(childElement);
				if( pBitmap != 0 )
					pWidget->SetBannerImage( szAttr, pBitmap);
			}
 			else if( stricmp( szAttr,"icon" )==0 )
			{
				int mode;
				childElement.GetAttribute(&mode, "mode");
				childElement.GetContents(szAttr);
				MBitmap* pBitmap = GetBitmap(childElement);
				if( pBitmap != 0 )
					pWidget->SetIconImage( (MMATCH_GAMETYPE)mode, pBitmap );
			}
		}
		else if ( strcmp(szBuf, "SIZE") == 0 )
		{
			childElement.GetAttribute(szAttr, "type" );
			if( strcmp(szAttr,"width") == 0)
			{
				float w;
				childElement.GetContents( &w );
				pWidget->SetWidth( w );
			}
			if( strcmp(szAttr,"height") == 0)
			{
				float h;
				childElement.GetContents( &h );
				pWidget->SetHeight( h );
			}
		}
	}
	return pWidget;
}
void MQuestScenarioCatalogue::ParseJaco(MXmlElement& element, MQuestScenarioInfoMaps* pMap)
{


	MQuestScenarioInfoMapJaco jaco;
	jaco.nNPCID = NPC_NONE;
	jaco.fRate = 0.0f;

	char szAttrValue[256], szAttrName[64], szTagName[128];

	int nAttrCount = element.GetAttributeCount();
	for (int i = 0; i < nAttrCount; i++)
	{
		element.GetAttribute(i, szAttrName, szAttrValue);

		if (!_stricmp(szAttrName, MTOK_SCENARIO_COUNT))
		{
			pMap->nJacoCount = atoi(szAttrValue);
		}
		else if (!_stricmp(szAttrName, MTOK_SCENARIO_TICK))
		{
			pMap->nJacoSpawnTickTime = atoi(szAttrValue) * 1000;
		}
		else if (!_stricmp(szAttrName, MTOK_SCENARIO_MIN_NPC))
		{
			pMap->nJacoMinNPCCount = atoi(szAttrValue);
		}
		else if (!_stricmp(szAttrName, MTOK_SCENARIO_MAX_NPC))
		{
			pMap->nJacoMaxNPCCount = atoi(szAttrValue);
		}
	}

	int nChildCount = element.GetChildNodeCount();

	MXmlElement chrElement;
	for (int k = 0; k < nChildCount; k++)
	{
		chrElement = element.GetChildNode(k);
		chrElement.GetTagName(szTagName);
		if (szTagName[0] == '#') continue;

		if (!_stricmp(szTagName, MTOK_SCENARIO_NPC))
		{
			int nAttrCount = chrElement.GetAttributeCount();

			MQuestScenarioInfoMapJaco jaco;
			jaco.nNPCID = NPC_NONE;
			jaco.fRate = 0.0f;

			for (int m = 0; m < nAttrCount; m++)
			{
				chrElement.GetAttribute(m, szAttrName, szAttrValue);

				if (!_stricmp(szAttrName, MTOK_SCENARIO_NPCID))
				{
					jaco.nNPCID = (MQUEST_NPC)atoi(szAttrValue);
				}
				else if (!_stricmp(szAttrName, MTOK_SCENARIO_RATE))
				{
					jaco.fRate = (float)atof(szAttrValue);			
				}
			}

			pMap->vecJacoArray.push_back(jaco);
		}
	}
}
void MQuestScenarioCatalogue::ParseStandardScenario(MXmlElement& element)
{
	char szTemp[256]="";
	int n = 0;
	char szAttrValue[256];
	char szAttrName[64];
	char szTagName[128];

	MQuestScenarioInfo* pScenarioInfo = new MQuestScenarioInfo();
	pScenarioInfo->bSpecialScenario = false;

	int nAttrCount = element.GetAttributeCount();
	for (int i = 0; i < nAttrCount; i++)
	{
		element.GetAttribute(i, szAttrName, szAttrValue);
		if (!_stricmp(szAttrName, MTOK_SCENARIO_TITLE))
		{
			strcpy_safe(pScenarioInfo->szTitle, szAttrValue);
		}
		else if (!_stricmp(szAttrName, MTOK_SCENARIO_QL))
		{
			pScenarioInfo->nQL = atoi(szAttrValue);
		}
		else if (!_stricmp(szAttrName, MTOK_SCENARIO_DC))
		{
			pScenarioInfo->fDC = (float)atof(szAttrValue);
		}
		else if (!_stricmp(szAttrName, MTOK_SCENARIO_MAPSET))
		{
			pScenarioInfo->nMapSet = QuestMapNameToID(szAttrValue);
		}
		else if (!_stricmp(szAttrName, MTOK_SCENARIO_XP))
		{
			pScenarioInfo->nXPReward = atoi(szAttrValue);
		}
		else if (!_stricmp(szAttrName, MTOK_SCENARIO_BP))
		{
			pScenarioInfo->nBPReward = atoi(szAttrValue);
		}
		else if (!_stricmp(szAttrName, MTOK_SCENARIO_SECTOR_XP))
		{
			pScenarioInfo->nSectorXP = atoi(szAttrValue);
		}
		else if (!_stricmp(szAttrName, MTOK_SCENARIO_SECTOR_BP))
		{
			pScenarioInfo->nSectorBP = atoi(szAttrValue);
		}
	}

	int iChildCount = element.GetChildNodeCount();

	MXmlElement chrElement;
	for (int i = 0; i < iChildCount; i++)
	{
		chrElement = element.GetChildNode(i);
		chrElement.GetTagName(szTagName);
		if (szTagName[0] == '#') continue;

		if (!_stricmp(szTagName, MTOK_SCENARIO_SACRI_ITEM))
		{
			ParseSacriItem(chrElement, pScenarioInfo);
		}
		else if (!_stricmp(szTagName, MTOK_SCENARIO_REWARD_ITEM))
		{
			ParseRewardItem(chrElement, pScenarioInfo);
		}
		else if (!_stricmp(szTagName, MTOK_SCENARIO_MAP))
		{
			ParseMap(chrElement, pScenarioInfo);
		}

	}

	pScenarioInfo->nID = CalcStandardScenarioID(pScenarioInfo->nMapSet, pScenarioInfo->nQL);
	Insert(pScenarioInfo);
}
bool ZConfiguration::LoadConfig(const char* szFileName)
{
	MXmlDocument	xmlConfig;
	MXmlElement		parentElement, serverElement, bindsElement;
	MXmlElement		childElement;

	mlog( "Load Config from file : %s", szFileName );

	xmlConfig.Create();
	if (!xmlConfig.LoadFromFile(szFileName)) 
	{
		mlog( "- FAIL\n");
		xmlConfig.Destroy();
		return false;
	}
	mlog( "- SUCCESS\n");

	parentElement = xmlConfig.GetDocumentElement();
	int iCount = parentElement.GetChildNodeCount();

	if (!parentElement.IsEmpty())
	{
		if (parentElement.FindChildNode( ZTOK_SERVER, &serverElement))
		{
			serverElement.GetChildContents( m_szServerIP,	ZTOK_IP);
			serverElement.GetChildContents( &m_nServerPort,	ZTOK_PORT);
		}
		if (parentElement.FindChildNode(ZTOK_VIDEO, &childElement))
		{
			childElement.GetChildContents(&m_Video.nWidth, ZTOK_VIDEO_WIDTH);
			childElement.GetChildContents(&m_Video.nHeight, ZTOK_VIDEO_HEIGHT);
			childElement.GetChildContents(&m_Video.nColorBits, ZTOK_VIDEO_COLORBITS);
			childElement.GetChildContents(&m_Video.bFullScreen, ZTOK_VIDEO_FULLSCREEN);
			childElement.GetChildContents(&m_Video.nGamma, ZTOK_VIDEO_GAMMA);
			childElement.GetChildContents(&m_Video.bReflection,	ZTOK_VIDEO_REFLECTION );
			childElement.GetChildContents(&m_Video.bLightMap, ZTOK_VIDEO_LIGHTMAP );
			childElement.GetChildContents(&m_Video.bDynamicLight, ZTOK_VIDEO_DYNAMICLIGHT );
			childElement.GetChildContents(&m_Video.bShader, ZTOK_VIDEO_SHADER );
			childElement.GetChildContents(&m_Video.nCharTexLevel, ZTOK_VIDEO_CHARTEXLEVEL );
			childElement.GetChildContents(&m_Video.nMapTexLevel, ZTOK_VIDEO_MAPTEXLEVEL );
			RBspObject::SetTextureRenderOnOff(m_Video.nMapTexLevel != 7);
			childElement.GetChildContents(&m_Video.nEffectLevel, ZTOK_VIDEO_EFFECTLEVEL );
			childElement.GetChildContents(&m_Video.nTextureFormat, ZTOK_VIDEO_TEXTUREFORMAT );
			childElement.GetChildContents(&m_Video.bTerrible, "NHARDWARETNL");
			childElement.GetChildContents(&m_MovingPicture.iResolution, ZTOK_MOVINGPICTURE_RESOLUTION );
			childElement.GetChildContents(&m_MovingPicture.iFileSize, ZTOK_MOVINGPICTURE_FILESIZE );
		}
		if (parentElement.FindChildNode(ZTOK_AUDIO, &childElement))
		{
			childElement.GetChildContents(&m_Audio.bBGMEnabled, ZTOK_AUDIO_BGM_ENABLED);
			childElement.GetChildContents(&m_Audio.fBGMVolume, ZTOK_AUDIO_BGM_VOLUME);
			childElement.GetChildContents(&m_Audio.fEffectVolume, ZTOK_AUDIO_EFFECT_VOLUME);
			childElement.GetChildContents(&m_Audio.bBGMMute, ZTOK_AUDIO_BGM_MUTE);
			childElement.GetChildContents(&m_Audio.bEffectMute, ZTOK_AUDIO_EFFECT_MUTE);
			childElement.GetChildContents(&m_Audio.b8BitSound, ZTOK_AUDIO_8BITSOUND);
			childElement.GetChildContents(&m_Audio.bInverse, ZTOK_AUDIO_INVERSE);
			childElement.GetChildContents(&m_Audio.bHWMixing, ZTOK_AUDIO_HWMIXING);
			childElement.GetChildContents(&m_Audio.bHitSound, ZTOK_AUDIO_HITSOUND);
			childElement.GetChildContents(&m_Audio.bNarrationSound, ZTOK_AUDIO_NARRATIONSOUND);
			childElement.GetChildContents( &m_Audio.bCustomMusic, ZTOK_AUDIO_CUSTOMMUSIC );
			//childElement.GetChildContents(&m_Audio.b3DSound, ZTOK_AUDIO_3D_SOUND);
			m_Audio.b3DSound = true;
		}
		if (parentElement.FindChildNode(ZTOK_MOUSE, &childElement))
		{
			childElement.GetChildContents(&m_Mouse.fSensitivity, ZTOK_MOUSE_SENSITIVITY);
			childElement.GetChildContents(&m_Mouse.bInvert, ZTOK_MOUSE_INVERT);
		}
		if (parentElement.FindChildNode(ZTOK_JOYSTICK, &childElement))
		{
			childElement.GetChildContents(&m_Joystick.fSensitivity, ZTOK_JOYSTICK_SENSITIVITY);
			childElement.GetChildContents(&m_Joystick.bInvert, ZTOK_JOYSTICK_INVERT);
		}
		if (parentElement.FindChildNode(ZTOK_KEYBOARD, &childElement))
		{
			for(int i=0; i<ZACTION_COUNT; i++){
				char szItemName[256];
				strcpy(szItemName, m_Keyboard.ActionKeys[i].szName);
				_strupr(szItemName);

				MXmlNode keyNode;
				if (childElement.FindChildNode(szItemName, &keyNode))
				{
					MXmlElement actionKeyElement = keyNode;

					const int ID_UNDEFINED = -2;
					int nKey;
					actionKeyElement.GetAttribute(&nKey,"alt",ID_UNDEFINED); // "alt"에 값이 없다면 ID_UNDEFINED 를 세팅
					if(nKey!=ID_UNDEFINED) // "alt"에 값이 없다면 스킵
						m_Keyboard.ActionKeys[i].nVirtualKeyAlt = nKey;
					actionKeyElement.GetContents(&m_Keyboard.ActionKeys[i].nVirtualKey);
				}
			}
		}

		if( parentElement.FindChildNode(ZTOK_MACRO, &childElement) )
		{
			//char buf[8][256];

			//childElement.GetChildContents(buf[0], ZTOK_MACRO_F1, 255);
			//childElement.GetChildContents(buf[1], ZTOK_MACRO_F2, 255);
			//childElement.GetChildContents(buf[2], ZTOK_MACRO_F3, 255);
			//childElement.GetChildContents(buf[3], ZTOK_MACRO_F4, 255);
			//childElement.GetChildContents(buf[4], ZTOK_MACRO_F5, 255);
			//childElement.GetChildContents(buf[5], ZTOK_MACRO_F6, 255);
			//childElement.GetChildContents(buf[6], ZTOK_MACRO_F7, 255);
			//childElement.GetChildContents(buf[7], ZTOK_MACRO_F8, 255);

			//for (int i = 0; i < 8; i++)
			//{
			//	strcpy(m_Macro.szMacro[i], ZGetStringResManager()->GetStringFromXml(buf[i]));
			//}

			// 여기선 읽기만 함. 
			// string.xml을 읽은 후 다시 컨버팅 함.
			// config.xml에 있는 lcale정보로 string.xml의 국가를 결정하기 때문에 이 부분은 바로 처리할 수 없음.
			childElement.GetChildContents(m_Macro.szMacro[0], ZTOK_MACRO_F1, 255);
			childElement.GetChildContents(m_Macro.szMacro[1], ZTOK_MACRO_F2, 255);
			childElement.GetChildContents(m_Macro.szMacro[2], ZTOK_MACRO_F3, 255);
			childElement.GetChildContents(m_Macro.szMacro[3], ZTOK_MACRO_F4, 255);
			childElement.GetChildContents(m_Macro.szMacro[4], ZTOK_MACRO_F5, 255);
			childElement.GetChildContents(m_Macro.szMacro[5], ZTOK_MACRO_F6, 255);
			childElement.GetChildContents(m_Macro.szMacro[6], ZTOK_MACRO_F7, 255);
			childElement.GetChildContents(m_Macro.szMacro[7], ZTOK_MACRO_F8, 255);
		}

		if (parentElement.FindChildNode(ZTOK_ETC, &childElement))
		{
			childElement.GetChildContents(&m_Etc.nNetworkPort1, ZTOK_ETC_NETWORKPORT1);
			childElement.GetChildContents(&m_Etc.nNetworkPort2, ZTOK_ETC_NETWORKPORT2);
			childElement.GetChildContents(&m_Etc.bBoost, ZTOK_ETC_BOOST);
			childElement.GetChildContents(&m_Etc.bRejectNormalChat, ZTOK_ETC_REJECT_NORMALCHAT);
			childElement.GetChildContents(&m_Etc.bRejectTeamChat, ZTOK_ETC_REJECT_TEAMCHAT);
			childElement.GetChildContents(&m_Etc.bRejectClanChat, ZTOK_ETC_REJECT_CLANCHAT);
			childElement.GetChildContents(&m_Etc.bRejectWhisper, ZTOK_ETC_REJECT_WHISPER);
			childElement.GetChildContents(&m_Etc.bRejectInvite, ZTOK_ETC_REJECT_INVITE);
			childElement.GetChildContents(&m_Etc.nCrossHair, ZTOK_ETC_CROSSHAIR);
			childElement.GetChildContents(&m_Etc.nFrameLimit_perSecond, ZTOK_ETC_FRAMELIMIT_PERSECOND);

			//m_Etc.szLanguage[0] = 0;

#ifdef _MULTILANGUAGE
	#ifdef LOCALE_NHNUSA
			SetSelectedLanguageIndex( g_LanguageSettingForNHNUSA.GetLanguageSetting());
	#else
			// 기본적으로는 게임내부 옵션에서 선택한 언어를 config에 저장했던 것을 로딩
			childElement.GetChildContents( m_Etc.szLanguage, ZTOK_ETC_LANGUAGE, 32);
	#endif
#endif //_MULTILANGUAGE

		}

		ValidateSelectedLanguage();

		/*
		if (parentElement.FindChildNode(ZTOK_BINDS, &bindsElement))
		{
			for(int i=0;i<bindsElement.GetChildNodeCount();i++)
			{
				char tagname[256];
				MXmlElement bind=bindsElement.GetChildNode(i);
				bind.GetTagName(tagname);
				if(strcmp(tagname,ZTOK_BIND)==0)
				{
					char key[256],command[256];
					int ctrl,alt,shift;

					bind.GetAttribute(key,ZTOK_KEY);
					bind.GetAttribute(&ctrl,ZTOK_KEY_CTRL);
					bind.GetAttribute(&alt,ZTOK_KEY_ALT);
					bind.GetAttribute(&shift,ZTOK_KEY_SHIFT);
					bind.GetContents(command);

					ZHOTKEY *photkey=new ZHOTKEY;
					photkey->nModifier=0;

					if(ctrl) photkey->nModifier|=MOD_CONTROL;
					if(alt) photkey->nModifier|=MOD_ALT;
					if(shift) photkey->nModifier|=MOD_SHIFT;

					photkey->nVirtKey=GetVirtKey(key);

					photkey->command=string(command);

					int nHotkeyID=MRegisterHotKey(photkey->nModifier,photkey->nVirtKey);
					m_HotKeys.insert(ZHOTKEYS::value_type(nHotkeyID,photkey));
				}
			}
		}
		*/
	}

	//if( m_Video.bTerrible )
	//{
	//	//m_Video.nCharTexLevel = 2;
	//	//m_Video.nMapTexLevel = 2;
	//	//m_Video.nEffectLevel = 2;
	//	//m_Video.bDynamicLight = false;
	//	//m_Video.bReflection = false;
	//}
	//else 
	//{
	//	m_Video.bLightMap = false; // 최하위 버전이 아닐 경우 라이트 맵을 끄지 못한다
	//}

	xmlConfig.Destroy();

	return true;
}
Exemple #14
0
void ZCmdXmlParser::ParseCmd(MXmlElement* pElement)
{
	char szTemp[256]="";
	int n = 0;
	char szAttrValue[256];
	char szAttrName[64];
	char szTagName[128];

	_CmdStr* pCmdStr = new _CmdStr;

	int nID = 0;

	// 속성값 --------------------
	int nAttrCount = pElement->GetAttributeCount();
	for (int i = 0; i < nAttrCount; i++)
	{
		pElement->GetAttribute(i, szAttrName, szAttrValue);
		if (!stricmp(szAttrName, ZCMD_TOK_ATTR_ID))
		{
			nID =  atoi(szAttrValue);
		}
		else if (!stricmp(szAttrName, ZCMD_TOK_ATTR_NAME))
		{
			strcpy(pCmdStr->szName, ZGetStringResManager()->GetStringFromXml(szAttrValue));
		}
		else if (!stricmp(szAttrName, ZCMD_TOK_ATTR_USAGE))
		{
			strcpy(pCmdStr->szUsage, ZGetStringResManager()->GetStringFromXml(szAttrValue));
		}
		else if (!stricmp(szAttrName, ZCMD_TOK_ATTR_HELP))
		{
			strcpy(pCmdStr->szHelp, ZGetStringResManager()->GetStringFromXml(szAttrValue));
		}
	}

	int iChildCount = pElement->GetChildNodeCount();
	MXmlElement chrElement;
	for (int i = 0; i < iChildCount; i++)
	{
		chrElement = pElement->GetChildNode(i);
		chrElement.GetTagName(szTagName);
		if (szTagName[0] == '#') continue;

		// ALIAS 태그 --------------------
		if (!stricmp(szTagName, ZCMD_TOK_ALIAS))
		{
			int nAttrCount = chrElement.GetAttributeCount();
			for (int i = 0; i < nAttrCount; i++)
			{
				chrElement.GetAttribute(i, szAttrName, szAttrValue);
				if (!stricmp(szAttrName, ZCMD_TOK_ATTR_NAME))
				{
					string str = ZGetStringResManager()->GetStringFromXml(szAttrValue);
					if (str.size() > 0)
					{
						pCmdStr->vecAliases.push_back(str);
					}
				}
			}
		}
	}

	if (nID != 0)
	{
		m_CmdMap.insert(map<int, _CmdStr*>::value_type(nID, pCmdStr));
	}
	else
	{
		delete pCmdStr;
	}
}
void MMatchEventFactoryManager::ParseEvent( MXmlElement& chrElement )
{
	char szAttrName[ 128 ];
	char szAttrValue[ 256 ];
	
	DWORD						dwEventListID = 0;
	DWORD						dwEventID = 0;
	string						strEventName;
	string						strAnnounce;
	EVENT_TYPE					EventType;
	DWORD						dwElapsedTime = 0;
	DWORD						dwPercent = 0;
	DWORD						dwRate = 0;
	vector< EventServerType >	vServerType;
	vector< EventGameType >		vGameType;
	SYSTEMTIME					Start, End;
	float						fXPBonusRatio = 0.0f;
	float						fBPBonusRatio = 0.0f;
	vector< EventPartTime >		EventPartTimeVec;

	memset( &Start, 0, sizeof(SYSTEMTIME) );
	memset( &End, 0, sizeof(SYSTEMTIME) );

	const int nAttrCnt = chrElement.GetAttributeCount();
	for( int i = 0; i < nAttrCnt; ++i )
	{
		chrElement.GetAttribute( i, szAttrName, szAttrValue );

		if( 0 == stricmp(EL_EVENT_LIST_ID, szAttrName) )
		{
			dwEventListID = static_cast< DWORD >( atoi(szAttrValue) );
			ASSERT( 0 < dwEventListID );
			continue;
		}

		if( 0 == stricmp(EL_EVENTID, szAttrName) )
		{
			dwEventID = static_cast< DWORD >( atol(szAttrValue) );
			if( NULL == MMatchEventDescManager::GetInstance().Find(dwEventID) )
			{
				ASSERT( 0 && "Event.xml에 없는 Event ID입니다." );
				mlog( "MMatchEventFactoryManager::ParseEvent - Event.xml에 없는 Event ID(%u)입니다.\n",
					dwEventID );
				return;
			}
			continue;
		}

		if( 0 == stricmp(EL_NAME, szAttrName) )
		{
			strEventName = MGetStringResManager()->GetString( string(szAttrValue) );
			continue;
		}

		if( 0 == stricmp(EL_EVENTTYPE, szAttrName) )
		{
			EventType = static_cast< EVENT_TYPE >( atoi(szAttrValue) );
			continue;
		}

		if( 0 == stricmp(EL_ELAPSEDTIME, szAttrName) )
		{
			dwElapsedTime = static_cast< DWORD >( atoi(szAttrValue) );
			continue;
		}

		if( 0 == stricmp(EL_PERCENT, szAttrName) )
		{
			dwPercent = static_cast< DWORD >( atol(szAttrValue) );
			continue;
		}

		if( 0 == stricmp(EL_RATE, szAttrName) )
		{
			dwRate = static_cast< DWORD >( atol(szAttrValue) );
			continue;
		}

		if( 0 == stricmp(EL_ANNOUNCE, szAttrName) )
		{
			strAnnounce = MGetStringResManager()->GetString( string(szAttrValue) );
			continue;
		}

		if( 0 == stricmp(EL_XPBONUS_RATIO, szAttrName) )
		{
			fXPBonusRatio = static_cast<float>( atoi(szAttrValue) ) / 100.0f;
			continue;
		}

		if( 0 == stricmp(EL_BPBONUS_RATIO, szAttrName) )
		{
			fBPBonusRatio = static_cast<float>( atoi(szAttrValue) ) / 100.0f;
			continue;
		}
	}

	MXmlElement chrNode;
	char szTag[ 128 ];
	const int nChrNodeCnt = chrElement.GetChildNodeCount();

	EventPartTimeVec.clear();
	
	for( int j = 0; j < nChrNodeCnt; ++j )
	{
		chrNode = chrElement.GetChildNode( j );
		chrNode.GetTagName( szTag );

		if (szTag[0] == '#') continue;

		if( 0 == stricmp(EL_SERVERTYPE, szTag) )
		{
			ParseServerType( chrNode, vServerType );
			continue;
		}

		if( 0 == stricmp(EL_GAMETYPE, szTag) )
		{
			ParseGameType( chrNode, vGameType );
			continue;
		}

		if( 0 == stricmp(EL_STARTTIME, szTag) )
		{
			ParseStartEndTime( chrNode, Start );
			continue;
		}

		if( 0 == stricmp(EL_ENDTIME, szTag) )
		{
			ParseStartEndTime( chrNode, End );
			continue;
		}

		if( 0 == stricmp(EL_PART_TIME, szTag) )
		{
			ParseEventPartTime(chrNode, EventPartTimeVec );
			continue;
		}
	}

	// check start end time.
	if( !CheckUsableEventTimeByEndTime(End) )
	{
#ifdef _DEBUG
		mlog( "Time out Event(%u:%u.%u.%u.%u~%u.%u.%u.%u)\n", 
			dwEventID,
			Start.wYear, Start.wMonth, Start.wDay, Start.wHour,
			End.wYear, End.wMonth, End.wDay, End.wHour );
#endif
		return;
	}
	
	// check server type.
	vector< EventServerType >::iterator itSvrTyp, endSvrTyp;
	bool bUseEvent = false;
	endSvrTyp = vServerType.end();
	for( itSvrTyp = vServerType.begin(); itSvrTyp != endSvrTyp; ++itSvrTyp )
	{
		// 모든 서버에 적용.
		if( MSM_ALL == itSvrTyp->ServerType )
		{
			bUseEvent = true;
			continue;
		}

		// 현제 서버 타입에만 적용.
		if( MGetServerConfig()->GetServerMode() == itSvrTyp->ServerType )
		{
			bUseEvent = true;
			continue;
		}
	}

	ASSERT( (0 < Start.wYear) && (0 < Start.wMonth) && (0 < Start.wDay) && (0 <= Start.wHour) &&
			(0 < End.wYear) && (0 < End.wMonth) && (0 < End.wDay) && (0 <= End.wHour) );

	// check game type.
	if( bUseEvent )
	{
		EventData ed;
		vector< EventGameType >::iterator itGmTyp, endGmTyp;
		endGmTyp = vGameType.end();
		for( itGmTyp = vGameType.begin(); itGmTyp != endGmTyp; ++itGmTyp )
		{
			// insert event.

			ed.dwEventListID	= dwEventListID;
			ed.dwEventID		= dwEventID;
			ed.EventType		= EventType;
			ed.dwGameType			= itGmTyp->GameType;
			ed.ServerType		= MGetServerConfig()->GetServerMode();
			ed.dwElapsedTime	= dwElapsedTime;
			ed.dwPercent		= dwPercent;
			ed.dwRate			= dwRate;
			ed.Start			= Start;
			ed.End				= End;
			ed.strName			= strEventName;
			ed.strAnnounce		= strAnnounce;
			ed.fXPBonusRatio	= fXPBonusRatio;
			ed.fBPBonusRatio	= fBPBonusRatio;

			ed.EventPartTimeVec.swap( EventPartTimeVec );

			InsertEvent( ed );

			++m_LoadEventSize;
		}		
	}
}
Exemple #16
0
bool MSpawnManager::ReadSpawnData(char* pszSpawnFile)
{
	MXmlDocument	aXml;
	aXml.Create();
	if (!aXml.LoadFromFile(pszSpawnFile)) {
		aXml.Destroy();
		return false;
	}

	char szBuf[65535];
	ZeroMemory(szBuf, 65535);

	MXmlElement aRoot;
	aRoot = aXml.GetDocumentElement();
	
	int nTotalRead = 0;

	int nSpawnCount = aRoot.GetChildNodeCount();
	for (int i=0; i<nSpawnCount; i++)
	{
		MXmlElement aSpawn = aRoot.GetChildNode(i);
		aSpawn.GetTagName(szBuf);
		if (szBuf[0] == '#') continue;

		if (!stricmp(szBuf, MTOK_SPAWNDATA)) {
			char szSpawnName[128];	ZeroMemory(szSpawnName, 128);
			if (!aSpawn.GetAttribute(szSpawnName, "name")) continue;

			int nObjectID = 0;
			int nMaxCount = 0;
			int nRespawnTime = 0;

			int nFieldCount = aSpawn.GetChildNodeCount();
			for (int j=0; j<nFieldCount; j++) {
				MXmlElement aField = aSpawn.GetChildNode(j);
				aField.GetTagName(szBuf);
				if (szBuf[0] == '#') continue;

				if (!stricmp(szBuf, MTOK_OBJECTID))
					aField.GetContents(&nObjectID);
				else if (!stricmp(szBuf, MTOK_MAXCOUNT))
					aField.GetContents(&nMaxCount);
				else if (!stricmp(szBuf, MTOK_RESPAWNTIME))
					aField.GetContents(&nRespawnTime);
			}

			MSpawnData* pSpawnData = FindSpawnByName(szSpawnName);
			if (pSpawnData) {
				pSpawnData->SetObjID(nObjectID);
				pSpawnData->SetMaxCount(nMaxCount);
				pSpawnData->SetRespawnTime(nRespawnTime);
				nTotalRead++;
			} else {
				LOG("SpawnData '%s' has no SpawnPosition. (%s)", szSpawnName, pszSpawnFile);
			}
		}
	}

	aXml.Destroy();

	LOG("Read %d spawn data in file '%s'", nTotalRead, pszSpawnFile);

	return true;
}
Exemple #17
0
void MQuestItemDescManager::ParseQuestItem( MXmlElement& element )
{
	MQuestItemDesc* pNewQuestItemDesc = new MQuestItemDesc;
	if( 0 == pNewQuestItemDesc )
		return;
	memset( pNewQuestItemDesc, 0, sizeof(MQuestItemDesc) );

	char szAttrName[ 256 ];
	char szAttrValue[ 1024 ];

	int nCount = element.GetAttributeCount();
	for( int i = 0; i < nCount; ++i )
	{
		element.GetAttribute( i, szAttrName, szAttrValue );
		if( 0 == strcmp(MQICTOK_ID, szAttrName) )
		{
			pNewQuestItemDesc->m_nItemID = atoi( szAttrValue );
		}
		else if( 0 == strcmp(MQICTOK_NAME, szAttrName) )
		{
			strcpy( pNewQuestItemDesc->m_szQuestItemName, MGetStringResManager()->GetStringFromXml(szAttrValue) );
		}
		else if( 0 == strcmp(MQICTOK_TYPE, szAttrName) )
		{
			if( 0 == strcmp(szAttrValue, "page") )				pNewQuestItemDesc->m_nType = MMQIT_PAGE;
			else if( 0 == strcmp(szAttrValue, "skull") )		pNewQuestItemDesc->m_nType = MMQIT_SKULL;
			else if( 0 == strcmp(szAttrValue, "fresh") )		pNewQuestItemDesc->m_nType = MMQIT_FRESH;
			else if( 0 == strcmp(szAttrValue, "ring") )			pNewQuestItemDesc->m_nType = MMQIT_RING;
			else if( 0 == strcmp(szAttrValue, "necklace") )		pNewQuestItemDesc->m_nType = MMQIT_NECKLACE;
			else if( 0 == strcmp(szAttrValue, "doll") )			pNewQuestItemDesc->m_nType = MMQIT_DOLL;
			else if( 0 == strcmp(szAttrValue, "book") )			pNewQuestItemDesc->m_nType = MMQIT_BOOK;
			else if( 0 == strcmp(szAttrValue, "object") )		pNewQuestItemDesc->m_nType = MMQIT_OBJECT;
			else if( 0 == strcmp(szAttrValue, "sword") )		pNewQuestItemDesc->m_nType = MMQIT_SWORD;
			else if( 0 == stricmp(szAttrValue, "monbible") )	pNewQuestItemDesc->m_nType = MMQIT_MONBIBLE;
		}
		else if( 0 == strcmp(MQICTOK_DESC, szAttrName) )
		{
			strcpy( pNewQuestItemDesc->m_szDesc, MGetStringResManager()->GetStringFromXml(szAttrValue) );
		}
		else if( 0 == strcmp(MQICTOK_UNIQUE, szAttrName) )
		{
			pNewQuestItemDesc->m_bUnique = (atoi( szAttrValue ) == 0) ? false : true;
		}
		else if( 0 == strcmp(MQICTOK_PRICE, szAttrName) )
		{
			pNewQuestItemDesc->m_nPrice = atoi( szAttrValue );
		}
		else if( 0 == strcmp(MQICTOK_SECRIFICE, szAttrName) )
		{
			pNewQuestItemDesc->m_bSecrifice = (atoi( szAttrValue ) == 0) ? false : true;
		}
		else if( 0 == strcmp(MQICTOK_PARAM, szAttrName) )
		{
			pNewQuestItemDesc->m_nParam = atoi( szAttrValue );
		}

	}

	_ASSERT( find(pNewQuestItemDesc->m_nItemID) == end() );
	insert( value_type(pNewQuestItemDesc->m_nItemID, pNewQuestItemDesc) );

	// Monster bible타입의 퀘스트 아이템은 Param값을 page로 사용함.
	if( MMQIT_MONBIBLE == pNewQuestItemDesc->m_nType )
		m_MonsterBibleMgr.insert( map<int, MQuestItemDesc*>::value_type(pNewQuestItemDesc->m_nParam, pNewQuestItemDesc) );
}
Exemple #18
0
//////////////////////////////////////////////////////////////////////////
//	InitEnv
//////////////////////////////////////////////////////////////////////////
void ZEmblemList::InitEnv( char* pFileName_ )
{
	MXmlDocument	Data;
	Data.Create();

	MZFile mzf;
	if( !mzf.Open( pFileName_, g_pFileSystem ))
	{
		return;
	}
	char* buffer;
	buffer	= new char[mzf.GetLength() + 1];
	mzf.Read( buffer, mzf.GetLength() );
	buffer[mzf.GetLength()] = 0;

	if( !Data.LoadFromMemory(buffer) )
	{
		delete buffer;
		return;
	}
	delete buffer;
	mzf.Close();

	MXmlElement root, child;
	char TagName[256];
	char Attribute[256];
	root = Data.GetDocumentElement();
	int iCount = root.GetChildNodeCount();	

	for( int i = 0 ; i < iCount; ++i )
	{
		child		= root.GetChildNode(i);
		child.GetTagName( TagName );
		if( TagName[0] == '#' )
		{
			continue;
		}
		child.GetAttribute( Attribute, "NAME" );
		mEmblemMapItor	= mEmblemMap.find( Attribute );
		if( mEmblemMapItor	!= mEmblemMap.end() )
		{
			ZClothEmblem* p		= mEmblemMapItor->second;
			
			if( child.GetAttribute( Attribute, "DIRECTION" ))
			{
				D3DXMATRIX RotMat;
				rvector dir = rvector( 0,1,0 );
				int theta;
				sscanf( Attribute, "%d", &theta );
				D3DXMatrixRotationAxis( &RotMat, &rvector(0,0,1), ((float)theta*D3DX_PI/180) );
				dir = dir*RotMat;
				//p->SetBaseWind( dir );
				p->GetWndGenerator()->SetWindDirection( dir );
			}

			if( child.GetAttribute( Attribute, "POWER" ))
			{
				float power;
				sscanf( Attribute, "%f", &power );
				p->GetWndGenerator()->SetWindPower( power );
			}
			
			MXmlElement dummy;
			int iDummyNum = child.GetChildNodeCount();
			for( int j = 0 ; j < iDummyNum; ++j )
			{
				dummy = child.GetChildNode( j );
				dummy.GetTagName( TagName );
				if( TagName[0] == '#' )
				{
					continue;
				}
				if( stricmp( TagName, "RESTRICTION" ) == 0 )
				{
					sRestriction* rest = new sRestriction;
					int iValue = 0;
					float fValue = 0.f;
					if( dummy.GetAttribute( Attribute, "AXIS" ))
					{
						sscanf( Attribute, "%d", &iValue );
						rest->axis	=(RESTRICTION_AXIS)iValue;
					}				
					if( dummy.GetAttribute( Attribute, "POSITION") )
					{
						sscanf( Attribute, "%f", &fValue );
						rest->position = fValue;
					}
					if( dummy.GetAttribute(Attribute, "COMPARE") )
					{
						sscanf( Attribute, "%d", &iValue );
						rest->compare =(RESTRICTION_COMPARE)iValue;
					}
					p->AddRestriction( rest );
				}
				else if( stricmp( TagName, "WINDTYPE" ) == 0 )
				{
					int iValue = 0;
					if( dummy.GetAttribute( Attribute, "TYPE" ) )
					{
						sscanf( Attribute, "%d", &iValue );
						p->GetWndGenerator()->SetWindType( (WIND_TYPE) iValue );
					}
					if( dummy.GetAttribute( Attribute, "DELAY" ))
					{
						sscanf( Attribute, "%d", &iValue );
						p->GetWndGenerator()->SetDelayTime( iValue );
					}
				}
			}
		}
	}

	for( list<ZClothEmblem*>::iterator iter = begin(); iter != end(); ++iter )
	{
		// 처음 몇 프레임을 계산하고 시작한다..
		for( int i = 0 ; i < 100; ++i )
			(*iter)->update();
	}
}
void MQuestScenarioCatalogue::ParseMap(MXmlElement& element, MQuestScenarioInfo* pScenarioInfo)
{
	char szTagName[128], szAttrValue[256], szAttrName[64];
	int nAttrCount = element.GetAttributeCount();

	int nDiceNum=0;
	for (int i = 0; i < nAttrCount; i++)
	{
		element.GetAttribute(i, szAttrName, szAttrValue);
		if (!_stricmp(szAttrName, MTOK_SCENARIO_DICE))
		{
			nDiceNum = atoi(szAttrValue);
		}
		else if (!_stricmp(szAttrName, MTOK_SCENARIO_KEY_SECTOR))
		{
			pScenarioInfo->Maps[nDiceNum-1].nKeySectorID = atoi(szAttrValue);
		}
		else if (!_stricmp(szAttrName, MTOK_SCENARIO_KEY_NPC))
		{
			pScenarioInfo->Maps[nDiceNum-1].nKeyNPCID = atoi(szAttrValue);

			MMatchQuest* pQuest = MMatchServer::GetInstance()->GetQuest();
			if (pQuest) 
			{
				if (!pQuest->GetNPCInfo(MQUEST_NPC(pScenarioInfo->Maps[nDiceNum-1].nKeyNPCID)))
				{
					pScenarioInfo->Maps[nDiceNum-1].nKeyNPCID = 0;
					_ASSERT(0);	// ÇØ´ç npc°¡ ¾ø´Ù.
				}
			}
		}
		else if (!_stricmp(szAttrName, MTOK_SCENARIO_BOSS))
		{
			if (!_stricmp(szAttrValue, "true")) pScenarioInfo->Maps[nDiceNum-1].bKeyNPCIsBoss = true;
			else pScenarioInfo->Maps[nDiceNum-1].bKeyNPCIsBoss = false;
		}

	}

	int nDiceChildCount = element.GetChildNodeCount();

	if ((nDiceNum <= 0) || (nDiceNum > SCENARIO_STANDARD_DICE_SIDES))
	{
		nDiceNum = 1;
		// ÁÖ»çÀ§ ´«ÀÌ À߸øÀԷµǾî ÀÖ´Ù.
		_ASSERT(0);
	}
	MXmlElement chrElement;
	for (int k = 0; k < nDiceChildCount; k++)
	{
		chrElement = element.GetChildNode(k);
		chrElement.GetTagName(szTagName);
		if (szTagName[0] == '#') continue;

		if (!_stricmp(szTagName, MTOK_SCENARIO_NPCSET_ARRAY))
		{
			ParseNPCSetArray(chrElement, pScenarioInfo->Maps[nDiceNum-1].vecNPCSetArray);
		}
		else if (!_stricmp(szTagName, MTOK_SCENARIO_JACO))
		{
			ParseJaco(chrElement, &pScenarioInfo->Maps[nDiceNum-1]);
		}
	}
}
Exemple #20
0
ZPlayerListBox* ZIDLResource::GetPlayerListBox( MXmlElement& element )
{
	MXmlElement childElement;
	char szBuf[4096];
	char szAttr[4096];

	MWidget* pParentWidget = GetParentWidget(element);
	ZPlayerListBox* pWidget = new ZPlayerListBox("", pParentWidget, pParentWidget);
	pWidget->SetListener(pWidget);
	InsertWidget(element, pWidget);

	int iCount = element.GetChildNodeCount();

	bool bMode1 = false;

	for (int i = 0; i < iCount; i++)
	{
		memset(szBuf, 0, sizeof(szBuf));
		childElement = element.GetChildNode(i);
		childElement.GetTagName(szBuf);

		if(GetCommonWidgetProperty(pWidget, childElement, szBuf)) continue;
		/*
		else	if( strcmp(szBuf, "BITMAP") == 0)
		{
			childElement.GetAttribute(szAttr, "type" );
			if( strcmp(szAttr,"slot") == 0)
			{
				childElement.GetContents(szAttr);
				MBitmap* pBitmap =GetBitmap(childElement);
				pWidget->SetBitmap(pBitmap);
			}
		}*/
		else if( strcmp(szBuf, "SIZE" ) == 0 )
		{
			childElement.GetAttribute(szAttr, "type");
			if( strcmp(szAttr,"width") == 0 )
			{
				float temp;
				childElement.GetContents(&temp);
				pWidget->SetWidth( temp );
			}
			else if( strcmp(szAttr,"height") == 0 )
			{
				float temp;
				childElement.GetContents(&temp);
				pWidget->SetHeight( temp );
			}
		}
		else if(strcmp(szBuf, "MODE1" ) == 0 ) {
			bMode1 = true;
		}
	}

	if(bMode1==false)
		pWidget->InitUI(ZPlayerListBox::PLAYERLISTMODE_CHANNEL);
	else
		pWidget->InitUI(ZPlayerListBox::PLAYERLISTMODE_STAGE);

	return pWidget;
}
Exemple #21
0
bool MSpawnManager::ReadSpawnPosition(char* pszMapFile)
{
	MXmlDocument	aXml;
	aXml.Create();
	if (!aXml.LoadFromFile(pszMapFile)) {
		aXml.Destroy();
		return false;
	}

	char szBuf[65535];
	ZeroMemory(szBuf, 65535);

	MXmlElement aRoot;
	aRoot = aXml.GetDocumentElement();

	int nTotalRead = 0;

	int nSpawnListCount = aRoot.GetChildNodeCount();

	for (int i=0; i<nSpawnListCount; i++)
	{
		MXmlElement aSpawnList = aRoot.GetChildNode(i);
		aSpawnList.GetTagName(szBuf);
		if (szBuf[0] == '#') continue;

		if (!stricmp(szBuf, MTOK_SPAWNPOSITIONLIST)) {
			int nSpawnCount = aSpawnList.GetChildNodeCount();
			for (int j=0; j<nSpawnCount; j++) {
				MXmlElement aSpawn = aSpawnList.GetChildNode(j);
				aSpawn.GetTagName(szBuf);
				if (szBuf[0] == '#') continue;

				if (!strcmp(szBuf, MTOK_SPAWNPOSITION))
				{
					char szSpawnName[128];	ZeroMemory(szSpawnName, 128);
					rvector Pos;

					if (!aSpawn.GetAttribute(szSpawnName, MTOK_NAME)) continue;
            
					int nFieldCount = aSpawn.GetChildNodeCount();
					for (int k=0; k<nFieldCount; k++) {
						MXmlElement aField = aSpawn.GetChildNode(k);
						aField.GetTagName(szBuf);
						if (szBuf[0] == '#') continue;

						if (!stricmp(szBuf, MTOK_POSITION)) {
							aField.GetContents(szBuf);
							sscanf(szBuf, "%f %f %f", &Pos.x, &Pos.y, &Pos.z);
						}
					}

					MSpawnData* pSpawnData = FindSpawnByName(szSpawnName);
					if (pSpawnData) {
						LOG("Duplicated spawn name '%s' found in '%s' file", szSpawnName, pszMapFile);
					} else {
						AddSpawnData(szSpawnName, Pos);
						nTotalRead++;
					}
				}
			}
		}	// SPAWNLIST
	}

	aXml.Destroy();

	LOG("Read %d spawn position in map '%s'", nTotalRead, pszMapFile);

	return true;
}
void MMatchEventFactoryManager::ParseLocale( MXmlElement& chrElement )
{
	EventData ed;
	char szAttrName[ 128 ];
	char szAttrValue[ 256 ];
	const int nAttrCnt = chrElement.GetAttributeCount();
	for( int i = 0; i < nAttrCnt; ++i )
	{
		chrElement.GetAttribute( i, szAttrName, szAttrValue );
		
		if( 0 == stricmp(EL_COUNTRY, szAttrName) )
		{
			/*  // MBaseLocale.h // 
			enum MCountry
			{
				MC_KOREA			= 82,		// 한국
				MC_US				= 1,		// 미국(인터네셔날)
				MC_JAPAN			= 81,		// 일본
			};
			*/

			string strCountry;
			switch( MGetLocale()->GetCountry() )
			{
			case MC_KOREA :
				{
					strCountry = "kor";
				}
				break;

			case MC_US :
				{
					strCountry = "us";
				}
				break;

			case MC_JAPAN :
				{
					strCountry = "jpn";
				}
				break;

			case MC_BRAZIL :
				{
					strCountry = "brz";
				}
				break;

			case MC_INDIA :
				{
					strCountry = "ind";
				}
				break;

			default :
				{
					ASSERT( 0 );
				}
				break;
			}

			// 현제 서버랑 같은 국가 타입만 파싱함. 
            // if( 0 == stricmp(strCountry.c_str(), szAttrValue) )
			// 국가코드 구분 안함. 이미 국가별로 나눠줘 있음.
			if( true )
			{
				MXmlElement chrNode;
				char szTag[ 128 ];
				const int nChrCnt = chrElement.GetChildNodeCount();
				for( int j = 0; j < nChrCnt; ++j )
				{
					chrNode = chrElement.GetChildNode( j );
					chrNode.GetTagName( szTag );

					if( 0 == stricmp(EL_EVENT, szTag) )
					{
						ParseEvent( chrNode );
					}
				}
			}
		}
	}
}