コード例 #1
0
void LOGIC_ELSE::Parse_or(char *pBuf)
{
	int index = 0, i = 0;
	char temp[1024];

	index += ParseSpace( temp, pBuf+index );
	m_bAnd = FALSE;
}
コード例 #2
0
void LOGIC_ELSE::Parse_and(char *pBuf)
{
	int index = 0, i = 0;
	char temp[1024];

	index += ParseSpace(temp, pBuf+index);

	if (!strcmp(temp, "CHECK_UNDER_WEIGHT"))
	{
		m_LogicElse = LOGIC_CHECK_UNDER_WEIGHT;
		PARSE_ARGUMENTS(1, temp, pBuf, m_LogicElseInt, i, index);
	}
	else if (!strcmp(temp, "CHECK_OVER_WEIGHT"))
	{
		m_LogicElse = LOGIC_CHECK_OVER_WEIGHT;
		PARSE_ARGUMENTS(1, temp, pBuf, m_LogicElseInt, i, index);
	}
	else if (!strcmp(temp, "CHECK_SKILL_POINT"))
	{
		m_LogicElse = LOGIC_CHECK_SKILL_POINT; // Point type | Min | Max
		PARSE_ARGUMENTS(3, temp, pBuf, m_LogicElseInt, i, index);
	}
	else if (!strcmp(temp, "CHECK_EXIST_ITEM"))
	{
		m_LogicElse = LOGIC_EXIST_ITEM; // Item ID | Item count
		PARSE_ARGUMENTS(2, temp, pBuf, m_LogicElseInt, i, index);
	}
	else if (!strcmp(temp, "CHECK_CLASS"))
	{
		m_LogicElse = LOGIC_CHECK_CLASS;
		PARSE_ARGUMENTS(6, temp, pBuf, m_LogicElseInt, i, index);
	}
	else if (!strcmp(temp, "CHECK_WEIGHT"))
	{
		m_LogicElse = LOGIC_CHECK_WEIGHT;
		PARSE_ARGUMENTS(2, temp, pBuf, m_LogicElseInt, i, index);
	}
	else if (!strcmp(temp, "RAND"))
	{
		m_LogicElse = LOGIC_RAND;
		PARSE_ARGUMENTS(1, temp, pBuf, m_LogicElseInt, i, index);
	}

	m_bAnd = TRUE;
}
コード例 #3
0
ファイル: MAP.cpp プロジェクト: tuku/snoxd-koserver
BOOL MAP::LoadRoomEvent( int zone_number )
{
	DWORD		length, count;
	CString		filename;
	CFile		pFile;
	BYTE		byte;
	char		buf[4096];
	char		first[1024];
	char		temp[1024];
	int			index = 0;
	int			t_index = 0, logic=0, exec=0;
	int			event_num = 0, nation = 0;

	CRoomEvent*	pEvent = NULL;
	filename.Format( ".\\MAP\\%d.aievt", zone_number);

	if( !pFile.Open( filename, CFile::modeRead) ) return FALSE;

	length = (DWORD)pFile.GetLength();
	CArchive in(&pFile, CArchive::load);

	count = 0;

	while(count < length)	{
		in >> byte;	count ++;

		if( (char)byte != '\r' && (char)byte != '\n' ) buf[index++] = byte;

		if(((char)byte == '\n' || count == length ) && index > 1 )	{
			buf[index] = (BYTE) 0;
			t_index = 0;

			if( buf[t_index] == ';' || buf[t_index] == '/' )	{		// 주석에 대한 처리
				index = 0;
				continue;
			}

			t_index += ParseSpace( first, buf + t_index );

			if( !strcmp( first, "ROOM" ) )	{
				logic = 0; exec = 0;
				t_index += ParseSpace( temp, buf + t_index );	event_num = atoi( temp );

				if( m_arRoomEventArray.GetData(event_num) )	{
					TRACE("Event Double !!\n" );
					goto cancel_event_load;
				}
				
				pEvent = NULL;
				pEvent = SetRoomEvent( event_num );
			}
			else if( !strcmp( first, "TYPE" ) )	{
				t_index += ParseSpace( temp, buf + t_index );	m_byRoomType = atoi( temp );
			}
			else if( !strcmp( first, "L" ) )	{
				if( !pEvent )	{
					goto cancel_event_load;
				}
			}
			else if( !strcmp( first, "E" ) )	{
				if( !pEvent )	{
					goto cancel_event_load;
				}

				t_index += ParseSpace( temp, buf + t_index );	pEvent->m_Exec[exec].sNumber = atoi( temp );
				t_index += ParseSpace( temp, buf + t_index );	pEvent->m_Exec[exec].sOption_1 = atoi( temp );
				t_index += ParseSpace( temp, buf + t_index );	pEvent->m_Exec[exec].sOption_2 = atoi( temp );
				exec++;
			}
			else if( !strcmp( first, "A" ) )	{
				if( !pEvent )	{
					goto cancel_event_load;
				}

				t_index += ParseSpace( temp, buf + t_index );	pEvent->m_Logic[logic].sNumber = atoi( temp );
				t_index += ParseSpace( temp, buf + t_index );	pEvent->m_Logic[logic].sOption_1 = atoi( temp );
				t_index += ParseSpace( temp, buf + t_index );	pEvent->m_Logic[logic].sOption_2 = atoi( temp );
				logic++;
				pEvent->m_byCheck = logic;
			}
			else if( !strcmp( first, "O" ) )	{
				if( !pEvent )	{
					goto cancel_event_load;
				}
			}
			else if( !strcmp( first, "NATION" ) )	{
				if( !pEvent )	{
					goto cancel_event_load;
				}

				t_index += ParseSpace( temp, buf + t_index );	nation = atoi( temp );
				if( nation == KARUS_ZONE )	{
					m_sKarusRoom++;
				}
				else if( nation == ELMORAD_ZONE )	{
					m_sElmoradRoom++;
				}
			}
			else if( !strcmp( first, "POS" ) )	{
				if( !pEvent )	{
					goto cancel_event_load;
				}

				t_index += ParseSpace( temp, buf + t_index );	pEvent->m_iInitMinX = atoi( temp );
				t_index += ParseSpace( temp, buf + t_index );	pEvent->m_iInitMinZ = atoi( temp );
				t_index += ParseSpace( temp, buf + t_index );	pEvent->m_iInitMaxX = atoi( temp );
				t_index += ParseSpace( temp, buf + t_index );	pEvent->m_iInitMaxZ = atoi( temp );
			}
			else if( !strcmp( first, "POSEND" ) )	{
				if( !pEvent )	{
					goto cancel_event_load;
				}

				t_index += ParseSpace( temp, buf + t_index );	pEvent->m_iEndMinX = atoi( temp );
				t_index += ParseSpace( temp, buf + t_index );	pEvent->m_iEndMinZ = atoi( temp );
				t_index += ParseSpace( temp, buf + t_index );	pEvent->m_iEndMaxX = atoi( temp );
				t_index += ParseSpace( temp, buf + t_index );	pEvent->m_iEndMaxZ = atoi( temp );
			}
			else if( !strcmp( first, "END" ) )	{
				if( !pEvent )	{
					goto cancel_event_load;
				}
			}

			index = 0;
		}
	}

	in.Close();
	pFile.Close();

	return TRUE;

cancel_event_load:
	CString str;
	str.Format( "이벤트 정보 읽기 실패(%d)(%d)", zone_number, event_num );
	AfxMessageBox( str );
	in.Close();
	pFile.Close();
//	DeleteAll();
	return FALSE;
	//return TRUE;
}
コード例 #4
0
void LOGIC_ELSE::Parse_and(char *pBuf)
{
	int index = 0, i = 0;
	char temp[1024];

	index += ParseSpace( temp, pBuf+index );

	if( !strcmp( temp, "CHECK_UNDER_WEIGHT" ) )
	{
		m_LogicElse = LOGIC_CHECK_UNDER_WEIGHT;

		index += ParseSpace( temp, pBuf+index );	m_LogicElseInt[i++] = atoi( temp );		// Weight & Empty Slot
	}
	else if( !strcmp( temp, "CHECK_OVER_WEIGHT" ) )
	{
		m_LogicElse = LOGIC_CHECK_OVER_WEIGHT;

		index += ParseSpace( temp, pBuf+index );	m_LogicElseInt[i++] = atoi( temp );		// Weight & Empty Slot
	}
	else if( !strcmp( temp, "CHECK_SKILL_POINT" ) )
	{
		m_LogicElse = LOGIC_CHECK_SKILL_POINT;

		index += ParseSpace( temp, pBuf+index );	m_LogicElseInt[i++] = atoi( temp );		// SkillPoint
		index += ParseSpace( temp, pBuf+index );	m_LogicElseInt[i++] = atoi( temp );		// Below
		index += ParseSpace( temp, pBuf+index );	m_LogicElseInt[i++] = atoi( temp );		// Above
	}
	else if( !strcmp( temp, "CHECK_EXIST_ITEM" ) )
	{
		m_LogicElse = LOGIC_EXIST_ITEM;

		index += ParseSpace( temp, pBuf+index );	m_LogicElseInt[i++] = atoi( temp );		// Item no.
		index += ParseSpace( temp, pBuf+index );	m_LogicElseInt[i++] = atoi( temp );		// Item count
	}
	else if( !strcmp( temp, "CHECK_CLASS" ) )
	{
		m_LogicElse = LOGIC_CHECK_CLASS;

		index += ParseSpace( temp, pBuf+index );	m_LogicElseInt[i++] = atoi( temp );		// Class 1
		index += ParseSpace( temp, pBuf+index );	m_LogicElseInt[i++] = atoi( temp );		// Class 2
		index += ParseSpace( temp, pBuf+index );	m_LogicElseInt[i++] = atoi( temp );		// Class 3
		index += ParseSpace( temp, pBuf+index );	m_LogicElseInt[i++] = atoi( temp );		// Class 4
		index += ParseSpace( temp, pBuf+index );	m_LogicElseInt[i++] = atoi( temp );		// Class 5
		index += ParseSpace( temp, pBuf+index );	m_LogicElseInt[i++] = atoi( temp );		// Class 6
	}
	else if( !strcmp( temp, "CHECK_WEIGHT" ) )
	{
		m_LogicElse = LOGIC_CHECK_WEIGHT;

		index += ParseSpace( temp, pBuf+index );	m_LogicElseInt[i++] = atoi( temp );		// Weight & Empty Slot
		index += ParseSpace( temp, pBuf+index );	m_LogicElseInt[i++] = atoi( temp );		// Weight & Empty Slot
	}
	else if( !strcmp( temp, "RAND") )
	{
		m_LogicElse = LOGIC_RAND;

		index += ParseSpace( temp, pBuf+index );	m_LogicElseInt[i++] = atoi( temp );		// Chances of you hitting the jackpot		
	}

	m_bAnd = TRUE;
}
コード例 #5
0
ファイル: EVENT.cpp プロジェクト: tuku/snoxd-koserver
BOOL EVENT::LoadEvent(int zone)
{
	DWORD		length, count;
	CString		filename;
	CFile		pFile;
	BYTE		byte;
	char		buf[4096];
	char		first[1024];
	char		temp[1024];
	int			index = 0;
	int			t_index = 0;
	int			event_num;

	EVENT_DATA	*newData = NULL;
	EVENT_DATA	*eventData = NULL;

	filename.Format( ".\\MAP\\%d.evt", zone);

	m_Zone = zone;

	if( !pFile.Open( filename, CFile::modeRead) ) return TRUE;

	length = (DWORD)pFile.GetLength();
	
	CArchive in(&pFile, CArchive::load);

	count = 0;

	while(count < length)
	{
		in >> byte;	count ++;

		if( (char)byte != '\r' && (char)byte != '\n' ) buf[index++] = byte;

		if(((char)byte == '\n' || count == length ) && index > 1 )
		{
			buf[index] = (BYTE) 0;

			t_index = 0;

			if( buf[t_index] == ';' || buf[t_index] == '/' )		// 주석에 대한 처리
			{
				index = 0;
				continue;
			}

			t_index += ParseSpace( first, buf + t_index );

//			if( !strcmp( first, "QUEST" ) )
			if( !strcmp( first, "EVENT" ) )
			{
				t_index += ParseSpace( temp, buf + t_index );	event_num = atoi( temp );

				if( newData )
				{
					delete newData;
					goto cancel_event_load;
				}

				if( m_arEvent.GetData(event_num) )
				{
					TRACE("Quest Double !!\n" );
					goto cancel_event_load;
				}

				eventData = new EVENT_DATA;
				eventData->m_EventNum = event_num;
				if( !m_arEvent.PutData( eventData->m_EventNum, eventData) ) {
					delete eventData;
					eventData = NULL;
				}
				newData = m_arEvent.GetData(event_num);
			}
			else if( !strcmp( first, "E" ) )
			{
				if( !newData )
				{
					goto cancel_event_load;
				}

				EXEC* newExec = new EXEC;

				newExec->Parse( buf + t_index );

				newData->m_arExec.push_back( newExec );				
			}
			else if( !strcmp( first, "A" ) )
			{
				if( !newData )
				{
					goto cancel_event_load;
				}

				LOGIC_ELSE* newLogicElse = new LOGIC_ELSE;

				newLogicElse->Parse_and( buf + t_index );

				newData->m_arLogicElse.push_back( newLogicElse );
			}
			else if( !strcmp( first, "END" ) )
			{
				if( !newData )
				{
					goto cancel_event_load;
				}

				newData = NULL;
			}

			index = 0;
		}
	}

	in.Close();
	pFile.Close();

	return TRUE;

cancel_event_load:
	CString str;
	str.Format( "QUEST INFO READ FAIL (%d)(%d)", zone, event_num );
	AfxMessageBox( str );
	in.Close();
	pFile.Close();
	DeleteAll();
	return FALSE;
}
コード例 #6
0
void LOGIC_ELSE::Parse_and(char *pBuf)
{
	int index = 0, i = 0;
	char temp[1024];

	index += ParseSpace( temp, pBuf+index );

	if( !strcmp( temp, "CHECK_UNDER_WEIGHT" ) )
	{
		m_LogicElse = LOGIC_CHECK_UNDER_WEIGHT;

		index += ParseSpace( temp, pBuf+index );	m_LogicElseInt[i++] = atoi( temp );		// Weight & Empty Slot
	}
	else if( !strcmp( temp, "CHECK_OVER_WEIGHT" ) )
	{
		m_LogicElse = LOGIC_CHECK_OVER_WEIGHT;

		index += ParseSpace( temp, pBuf+index );	m_LogicElseInt[i++] = atoi( temp );		// Weight & Empty Slot
	}
	else if( !strcmp( temp, "CHECK_SKILL_POINT" ) )
	{
		m_LogicElse = LOGIC_CHECK_SKILL_POINT;

		index += ParseSpace( temp, pBuf+index );	m_LogicElseInt[i++] = atoi( temp );		// SkillPoint
		index += ParseSpace( temp, pBuf+index );	m_LogicElseInt[i++] = atoi( temp );		// Below
		index += ParseSpace( temp, pBuf+index );	m_LogicElseInt[i++] = atoi( temp );		// Above
	}
	else if( !strcmp( temp, "CHECK_EXIST_ITEM" ) )
	{
		m_LogicElse = LOGIC_EXIST_ITEM;

		index += ParseSpace( temp, pBuf+index );	m_LogicElseInt[i++] = atoi( temp );		// Item no.
		index += ParseSpace( temp, pBuf+index );	m_LogicElseInt[i++] = atoi( temp );		// Item count
	}
	else if( !strcmp( temp, "CHECK_CLASS" ) )
	{
		m_LogicElse = LOGIC_CHECK_CLASS;

		index += ParseSpace( temp, pBuf+index );	m_LogicElseInt[i++] = atoi( temp );		// Class 1
		index += ParseSpace( temp, pBuf+index );	m_LogicElseInt[i++] = atoi( temp );		// Class 2
		index += ParseSpace( temp, pBuf+index );	m_LogicElseInt[i++] = atoi( temp );		// Class 3
		index += ParseSpace( temp, pBuf+index );	m_LogicElseInt[i++] = atoi( temp );		// Class 4
		index += ParseSpace( temp, pBuf+index );	m_LogicElseInt[i++] = atoi( temp );		// Class 5
		index += ParseSpace( temp, pBuf+index );	m_LogicElseInt[i++] = atoi( temp );		// Class 6
	}
	else if( !strcmp( temp, "CHECK_WEIGHT" ) )
	{
		m_LogicElse = LOGIC_CHECK_WEIGHT;

		index += ParseSpace( temp, pBuf+index );	m_LogicElseInt[i++] = atoi( temp );		// Weight & Empty Slot
		index += ParseSpace( temp, pBuf+index );	m_LogicElseInt[i++] = atoi( temp );		// Weight & Empty Slot
	}
// 비러머글 복권!!!
	else if( !strcmp( temp, "CHECK_EDITBOX") )
	{
		m_LogicElse = LOGIC_CHECK_EDITBOX;

		index += ParseSpace( temp, pBuf+index );	m_LogicElseInt[i++] = atoi( temp );
	}
	else if( !strcmp( temp, "RAND") )
	{
		m_LogicElse = LOGIC_RAND;

		index += ParseSpace( temp, pBuf+index );	m_LogicElseInt[i++] = atoi( temp );		// Chances of you hitting the jackpot		
	}
//
	// 현재 여기까지만 쓰입니다. 아래는 나중에 맞게 수정해서 쓰세여.


/*
	if( !strcmp( temp, "CHECK_NATION" ) )
	{
		m_LogicElse = LOGIC_CHECK_NATION;

		index += ParseSpace( temp, pBuf+index );	m_LogicElseInt[i++] = atoi( temp );		// Nation
	}
	else if( !strcmp( temp, "CHECK_LV" ) )
	{
		m_LogicElse = LOGIC_CHECK_LEVEL;

		index += ParseSpace( temp, pBuf+index );	m_LogicElseInt[i++] = atoi( temp );		// Minimum level
		index += ParseSpace( temp, pBuf+index );	m_LogicElseInt[i++] = atoi( temp );		// Maximum level
	}
	else if( !strcmp( temp, "NOEXIST_ITEM" ) )
	{
		m_LogicElse = LOGIC_NOEXIST_ITEM;

		index += ParseSpace( temp, pBuf+index );	m_LogicElseInt[i++] = atoi( temp );		// Item no.
	}
	else if( !strcmp( temp, "NOQUEST_END" ) )
	{
		m_LogicElse = LOGIC_QUEST_END;

		index += ParseSpace( temp, pBuf+index );	m_LogicElseInt[i++] = atoi( temp );		// Quest no.
	}
	else if( !strcmp( temp, "CHECK_QUEST_LOG" ) )
	{
		m_LogicElse = LOGIC_QUEST_LOG;

		index += ParseSpace( temp, pBuf+index );	m_LogicElseInt[i++] = atoi( temp );		// Quest no.
	}

	else if( !strcmp( temp, "CHECK_NOAH" ) )
	{
		m_LogicElse = LOGIC_CHECK_NOAH;

		index += ParseSpace( temp, pBuf+index );	m_LogicElseInt[i++] = atoi( temp );		// Gold
	}
*/
///////////////////////// 여기서 부턴 내가 한일 ///////////////////////////

/*
	else if( !strcmp( temp, "CHECK_CLASS" ) )
	{
		m_LogicElse = LOGIC_CHECK_CLASS;

		index += ParseSpace( temp, pBuf+index );	m_LogicElseInt[i++] = atoi( temp );		// Class 1
		index += ParseSpace( temp, pBuf+index );	m_LogicElseInt[i++] = atoi( temp );		// Class 2
		index += ParseSpace( temp, pBuf+index );	m_LogicElseInt[i++] = atoi( temp );		// Class 3
		index += ParseSpace( temp, pBuf+index );	m_LogicElseInt[i++] = atoi( temp );		// Class 4
		index += ParseSpace( temp, pBuf+index );	m_LogicElseInt[i++] = atoi( temp );		// Class 5
		index += ParseSpace( temp, pBuf+index );	m_LogicElseInt[i++] = atoi( temp );		// Class 6
	}
	else if( !strcmp( temp, "CHECK_WEIGHT" ) )
	{
		m_LogicElse = LOGIC_CHECK_WEIGHT;

		index += ParseSpace( temp, pBuf+index );	m_LogicElseInt[i++] = atoi( temp );		// Weight & Empty Slot
		index += ParseSpace( temp, pBuf+index );	m_LogicElseInt[i++] = atoi( temp );		// Weight & Empty Slot
	}
	else if( !strcmp( temp, "CHECK_SKILLPOINT" ) )
	{
		m_LogicElse = LOGIC_CHECK_SKILLPOINT;

		index += ParseSpace( temp, pBuf+index );	m_LogicElseInt[i++] = atoi( temp );		// SkillPoint
		index += ParseSpace( temp, pBuf+index );	m_LogicElseInt[i++] = atoi( temp );		// Below
		index += ParseSpace( temp, pBuf+index );	m_LogicElseInt[i++] = atoi( temp );		// Above
	}
	else if( !strcmp( temp, "EXIST_ITEM" ) )
	{
		m_LogicElse = LOGIC_EXIST_ITEM;

		index += ParseSpace( temp, pBuf+index );	m_LogicElseInt[i++] = atoi( temp );		// Item no.
		index += ParseSpace( temp, pBuf+index );	m_LogicElseInt[i++] = atoi( temp );		// Item count
	}
*/

////////////////////////////////////////////////////////////////////////////
	m_bAnd = TRUE;
}
コード例 #7
0
ファイル: LOGIC_ELSE.cpp プロジェクト: srmeier/KnightOnline
//-----------------------------------------------------------------------------
void LOGIC_ELSE::Parse_and(char* pBuf) {
    int index = 0, i = 0;
    char temp[1024];

    index += ParseSpace(temp, pBuf+index);
    memcpy(m_LogicCmd, temp, strlen(temp) + 1);

    if(!strcmp(temp, "CHECK_LV")) {
        m_LogicElse = LOGIC_CHECK_LEVEL;

        index += ParseSpace(temp, pBuf+index);
        m_LogicElseInt[i++] = atoi(temp); // minimum level
        index += ParseSpace(temp, pBuf+index);
        m_LogicElseInt[i++] = atoi(temp); // maximum level

    } else if(!strcmp(temp, "CHECK_EXIST_EVENT")) {
        m_LogicElse = LOGIC_EXIST_COM_EVENT;

        index += ParseSpace(temp, pBuf+index);
        m_LogicElseInt[i++] = atoi(temp); // event number
        index += ParseSpace(temp, pBuf+index);
        m_LogicElseInt[i++] = atoi(temp); // state (is the event at this state?)

    } else if (!strcmp(temp, "HOWMUCH_ITEM")) {
        m_LogicElse = LOGIC_HOWMUCH_ITEM;

        index += ParseSpace(temp, pBuf + index);
        m_LogicElseInt[i++] = atoi(temp); // item number
        index += ParseSpace(temp, pBuf + index);
        m_LogicElseInt[i++] = atoi(temp); // minimum amount
        index += ParseSpace(temp, pBuf + index);
        m_LogicElseInt[i++] = atoi(temp); // maximum amount

    } else if (!strcmp(temp, "CHECK_PROMOTION_ELIGIBLE")) {
        m_LogicElse = LOGIC_CHECK_PROMOTION_ELIGIBLE;

        index += ParseSpace(temp, pBuf + index);
        m_LogicElseInt[i++] = atoi(temp); // typically -1

    } else if (!strcmp(temp, "CHECK_CLASS")) {
        m_LogicElse = LOGIC_CHECK_CLASS;

        index += ParseSpace(temp, pBuf + index);
        m_LogicElseInt[i++] = atoi(temp); // class 1

        int old_index = index;
        index += ParseSpace(temp, pBuf + index);

        if (index != old_index) {
            m_LogicElseInt[i++] = atoi(temp); // class 2
            index += ParseSpace(temp, pBuf + index);
            m_LogicElseInt[i++] = atoi(temp); // class 3
            index += ParseSpace(temp, pBuf + index);
            m_LogicElseInt[i++] = atoi(temp); // class 4
            index += ParseSpace(temp, pBuf + index);
            m_LogicElseInt[i++] = atoi(temp); // class 5
            index += ParseSpace(temp, pBuf + index);
            m_LogicElseInt[i++] = atoi(temp); // class 6
        }
        else {
            m_LogicElseInt[i++] = -1;
            m_LogicElseInt[i++] = -1;
            m_LogicElseInt[i++] = -1;
            m_LogicElseInt[i++] = -1;
            m_LogicElseInt[i++] = -1;
        }

    } else if(!strcmp(temp, "CHECK_NOCLASS")) {
        m_LogicElse = LOGIC_CHECK_NOCLASS;

        index += ParseSpace(temp, pBuf + index);
        m_LogicElseInt[i++] = atoi(temp); // class 1

        int old_index = index;
        index += ParseSpace(temp, pBuf + index);

        if (index != old_index) {
            m_LogicElseInt[i++] = atoi(temp); // class 2
            index += ParseSpace(temp, pBuf + index);
            m_LogicElseInt[i++] = atoi(temp); // class 3
            index += ParseSpace(temp, pBuf + index);
            m_LogicElseInt[i++] = atoi(temp); // class 4
            index += ParseSpace(temp, pBuf + index);
            m_LogicElseInt[i++] = atoi(temp); // class 5
            index += ParseSpace(temp, pBuf + index);
            m_LogicElseInt[i++] = atoi(temp); // class 6
        }
        else {
            m_LogicElseInt[i++] = -1;
            m_LogicElseInt[i++] = -1;
            m_LogicElseInt[i++] = -1;
            m_LogicElseInt[i++] = -1;
            m_LogicElseInt[i++] = -1;
        }

    } else if (!strcmp(temp, "CHECK_NOAH")) {
        m_LogicElse = LOGIC_CHECK_NOAH;

        index += ParseSpace(temp, pBuf + index);
        m_LogicElseInt[i++] = atoi(temp);
        index += ParseSpace(temp, pBuf + index);
        m_LogicElseInt[i++] = atoi(temp);

    } else if (!strcmp(temp, "CHECK_EXIST_ITEM")) {
        m_LogicElse = LOGIC_CHECK_EXIST_ITEM;

        index += ParseSpace(temp, pBuf + index);
        m_LogicElseInt[i++] = atoi(temp);
        index += ParseSpace(temp, pBuf + index);
        m_LogicElseInt[i++] = atoi(temp);

    } else if (!strcmp(temp, "CHECK_DICE")) {
        m_LogicElse = LOGIC_CHECK_DICE;

        index += ParseSpace(temp, pBuf + index);
        m_LogicElseInt[i++] = atoi(temp);

    } else if (!strcmp(temp, "CHECK_EMPTY_SLOT")) {
        m_LogicElse = LOGIC_CHECK_EMPTY_SLOT;

        // NOTE: number of empty slots to check for
        index += ParseSpace(temp, pBuf + index);
        m_LogicElseInt[i++] = atoi(temp);

    } else {
        m_LogicElse = LOGIC_UNKNOWN;
        printf("Unknown logic command: %s\n", temp);
        //system("pause");
        //exit(-1);
    }

    m_bAnd = true;
}
コード例 #8
0
ファイル: EXEC.cpp プロジェクト: srmeier/KnightOnline
//-----------------------------------------------------------------------------
void EXEC::Parse(char* pBuf) {
	int index = 0, i = 0;
	char temp[1024];

	index += ParseSpace(temp, pBuf+index);
	memcpy(m_ExeCmd, temp, strlen(temp)+1);

	if(!strcmp(temp, "SAY")) {
		m_Exec = EXEC_SAY;

		index += ParseSpace(temp, pBuf+index); m_ExecInt[i++] = atoi(temp);
		index += ParseSpace(temp, pBuf+index); m_ExecInt[i++] = atoi(temp);
		index += ParseSpace(temp, pBuf+index); m_ExecInt[i++] = atoi(temp);
		index += ParseSpace(temp, pBuf+index); m_ExecInt[i++] = atoi(temp);
		index += ParseSpace(temp, pBuf+index); m_ExecInt[i++] = atoi(temp);
		index += ParseSpace(temp, pBuf+index); m_ExecInt[i++] = atoi(temp);
		index += ParseSpace(temp, pBuf+index); m_ExecInt[i++] = atoi(temp);
		index += ParseSpace(temp, pBuf+index); m_ExecInt[i++] = atoi(temp);
		index += ParseSpace(temp, pBuf+index); m_ExecInt[i++] = atoi(temp);
		index += ParseSpace(temp, pBuf+index); m_ExecInt[i++] = atoi(temp);

	} else if(!strcmp(temp, "SELECT_MSG")) {
		m_Exec = EXEC_SELECT_MSG;

		index += ParseSpace(temp, pBuf+index); m_ExecInt[i++] = atoi(temp);
		index += ParseSpace(temp, pBuf+index); m_ExecInt[i++] = atoi(temp);

		index += ParseSpace(temp, pBuf+index); m_ExecInt[i++] = atoi(temp); // 1
		index += ParseSpace(temp, pBuf+index); m_ExecInt[i++] = atoi(temp); // 1

		index += ParseSpace(temp, pBuf+index); m_ExecInt[i++] = atoi(temp); // 2
		index += ParseSpace(temp, pBuf+index); m_ExecInt[i++] = atoi(temp); // 2

		index += ParseSpace(temp, pBuf+index); m_ExecInt[i++] = atoi(temp); // 3
		index += ParseSpace(temp, pBuf+index); m_ExecInt[i++] = atoi(temp); // 3

		index += ParseSpace(temp, pBuf+index); m_ExecInt[i++] = atoi(temp); // 4
		index += ParseSpace(temp, pBuf+index); m_ExecInt[i++] = atoi(temp); // 4

		index += ParseSpace(temp, pBuf+index); m_ExecInt[i++] = atoi(temp); // 5
		index += ParseSpace(temp, pBuf+index); m_ExecInt[i++] = atoi(temp); // 5

		index += ParseSpace(temp, pBuf+index); m_ExecInt[i++] = atoi(temp); // 6
		index += ParseSpace(temp, pBuf+index); m_ExecInt[i++] = atoi(temp); // 6

		index += ParseSpace(temp, pBuf+index); m_ExecInt[i++] = atoi(temp); // 7
		index += ParseSpace(temp, pBuf+index); m_ExecInt[i++] = atoi(temp); // 7

		index += ParseSpace(temp, pBuf+index); m_ExecInt[i++] = atoi(temp); // 8
		index += ParseSpace(temp, pBuf+index); m_ExecInt[i++] = atoi(temp); // 8

		index += ParseSpace(temp, pBuf+index); m_ExecInt[i++] = atoi(temp); // 9
		index += ParseSpace(temp, pBuf+index); m_ExecInt[i++] = atoi(temp); // 9

		index += ParseSpace(temp, pBuf+index); m_ExecInt[i++] = atoi(temp); // 10
		index += ParseSpace(temp, pBuf+index); m_ExecInt[i++] = atoi(temp); // 10

	} else if(!strcmp(temp, "RUN_EVENT")) {
		m_Exec = EXEC_RUN_EVENT;

		index += ParseSpace(temp, pBuf+index); m_ExecInt[i++] = atoi(temp);

	} else if(!strcmp(temp, "GIVE_ITEM")) {
		m_Exec = EXEC_GIVE_ITEM;

		index += ParseSpace(temp, pBuf+index); m_ExecInt[i++] = atoi(temp); // item number
		index += ParseSpace(temp, pBuf+index); m_ExecInt[i++] = atoi(temp); // item count

	} else if(!strcmp(temp, "ROB_ITEM")) {
		m_Exec = EXEC_ROB_ITEM;

		index += ParseSpace(temp, pBuf+index); m_ExecInt[i++] = atoi(temp); // item number
		index += ParseSpace(temp, pBuf+index); m_ExecInt[i++] = atoi(temp); // item count

	} else if(!strcmp(temp, "GIVE_NOAH")) {
		m_Exec = EXEC_GIVE_NOAH;

		index += ParseSpace(temp, pBuf+index); m_ExecInt[i++] = atoi(temp); // amount

	} else if(!strcmp(temp, "SAVE_EVENT")) {
		m_Exec = EXEC_SAVE_COM_EVENT;

		index += ParseSpace(temp, pBuf+index); m_ExecInt[i++] = atoi(temp); // event number
		index += ParseSpace(temp, pBuf+index); m_ExecInt[i++] = atoi(temp); // event state

	} else if (!strcmp(temp, "EXP_CHANGE")) {
		m_Exec = EXEC_EXP_CHANGE;

		index += ParseSpace(temp, pBuf + index); m_ExecInt[i++] = atoi(temp); // amount

	} else if (!strcmp(temp, "ROB_NOAH")) {
		m_Exec = EXEC_ROB_NOAH;

		index += ParseSpace(temp, pBuf + index); m_ExecInt[i++] = atoi(temp); // amount

	} else if(!strcmp(temp, "PROMOTE_USER_NOVICE")) {
		m_Exec = EXEC_PROMOTE_USER_NOVICE;

	} else if (!strcmp(temp, "RETURN")) {
		m_Exec = EXEC_RETURN;

	} else if (!strcmp(temp, "RUN_EXCHANGE")) {
		m_Exec = EXEC_RUN_EXCHANGE;

		index += ParseSpace(temp, pBuf + index); m_ExecInt[i++] = atoi(temp); // nIndex in ITEM_EXCHANGE table

	} else if(!strcmp(temp, "ROLL_DICE")) {
		m_Exec = EXEC_ROLL_DICE;

		index += ParseSpace(temp, pBuf + index); m_ExecInt[i++] = atoi(temp);

	} else {
		m_Exec = EXEC_UNKNOWN;
		printf("Unknown execute command: %s\n", temp);
		//system("pause");
		//exit(-1);
	}
}