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) ); }
void MQuestScenarioCatalogue::ParseSpecialScenario(MXmlElement& element) { char szTemp[256]=""; int n = 0; char szAttrValue[256]; char szAttrName[64]; char szTagName[128]; MQuestScenarioInfo* pScenarioInfo = new MQuestScenarioInfo(); pScenarioInfo->bSpecialScenario = true; int nAttrCount = element.GetAttributeCount(); for (int i = 0; i < nAttrCount; i++) { element.GetAttribute(i, szAttrName, szAttrValue); if (!_stricmp(szAttrName, MTOK_SCENARIO_ID)) { pScenarioInfo->nID = atoi(szAttrValue); } else if (!_stricmp(szAttrName, MTOK_SCENARIO_TITLE)) { strcpy_safe(pScenarioInfo->szTitle, MGetStringResManager()->GetStringFromXml(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); } } Insert(pScenarioInfo); }
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; } } }