736 lines
22 KiB
C++
736 lines
22 KiB
C++
#include "StdAfx.h"
|
|
#include ".\excelmanager.h"
|
|
#include <complex>
|
|
|
|
|
|
//ole variant declare
|
|
COleVariant vTrue((short)TRUE), vFalse((short)FALSE), vOption((long)DISP_E_PARAMNOTFOUND, VT_ERROR);
|
|
|
|
|
|
CExcelManager::CExcelManager(void)
|
|
{
|
|
m_nNumSheet = 1;
|
|
m_nColCount = 0;
|
|
}
|
|
|
|
CExcelManager::~CExcelManager(void)
|
|
{
|
|
DeleteAllItem();
|
|
m_book.Close(vFalse, vOption, vOption);
|
|
m_app.Quit();
|
|
m_app.ReleaseDispatch();
|
|
}
|
|
|
|
BOOL CExcelManager::InitExcel(CString strName)
|
|
{
|
|
/************************************************************************/
|
|
/* app 엑셀 오프젝트 생성 */
|
|
/************************************************************************/
|
|
if(m_app.m_lpDispatch == NULL)
|
|
{
|
|
m_app.CreateDispatch("Excel.Application");
|
|
}
|
|
|
|
/************************************************************************/
|
|
/* Get WorkBooks */
|
|
/************************************************************************/
|
|
m_books = m_app.get_Workbooks();
|
|
|
|
/************************************************************************/
|
|
/* 파일오픈 / get workbook */
|
|
/************************************************************************/
|
|
if(!strName.IsEmpty()) //기존 파일을 열때
|
|
{
|
|
m_book = m_books.Open(strName, vOption, vTrue, vOption, vOption,
|
|
vOption, vOption, vOption, vOption, vOption, vOption,
|
|
vOption, vOption, vOption, vOption);
|
|
}
|
|
else //새로운 파일을 열때
|
|
{
|
|
m_book = m_books.Add(vOption); // 새파일을 열 경우
|
|
}
|
|
|
|
/************************************************************************/
|
|
/* Get WorkSheets */
|
|
/************************************************************************/
|
|
m_sheets = m_book.get_Worksheets();
|
|
|
|
/************************************************************************/
|
|
/* Get WorkSheet */
|
|
/************************************************************************/
|
|
m_nNumSheet = m_sheetInfo[m_nScriptType].GetSheetNumber();
|
|
m_sheet = m_sheets.get_Item(COleVariant((short)m_nNumSheet));
|
|
m_sheet.Activate();
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
|
|
|
|
CString CExcelManager::GetValue(CString strCell)
|
|
{
|
|
m_range = m_sheet.get_Range(COleVariant(strCell), COleVariant(strCell));
|
|
|
|
VARIANT value = m_range.get_Value2();
|
|
CString strValue;
|
|
|
|
switch(value.vt)
|
|
{
|
|
case VT_R8: //VT_R8 : 8-byte real.
|
|
{
|
|
strValue.Format("%f", value.dblVal);
|
|
break;
|
|
}
|
|
case VT_BSTR: //VT_BSTR : Binary string
|
|
{
|
|
strValue = (CString)value.bstrVal;
|
|
break;
|
|
}
|
|
case VT_EMPTY:
|
|
{
|
|
strValue = _T("");
|
|
break;
|
|
}
|
|
}
|
|
|
|
return strValue;
|
|
}
|
|
|
|
//컬럼의 넘버를 입력하면, 컬럼의 문자열을 반환한다.
|
|
//현재는 A부터 ZZ까지만 지원한다.
|
|
//컬럼은 1부터 시작한다.
|
|
//A는 아스키코드로 65이다.
|
|
//알파벳의 개수는 26개이다.
|
|
CString CExcelManager::GetXLColNumFromInt(int nCol)
|
|
{
|
|
CString str = "";
|
|
char buf[2];
|
|
int nMok = nCol / 26;
|
|
int nNa = (nCol % 26);
|
|
int nAdd = 0;
|
|
|
|
if(nMok >= 1 && nNa == 0)
|
|
{
|
|
nMok--;
|
|
nAdd = 26;
|
|
}
|
|
else
|
|
nAdd = nNa;
|
|
|
|
if(nMok == 0) //몫이 없으면(0이면) A~Z열 사이이다.
|
|
{
|
|
asctoa(nAdd + 65 - 1, buf);
|
|
str.Format("%s", buf);
|
|
}
|
|
else if(nMok >= 1) //몫이 1이상이면 AA~ZZ사이이다.
|
|
{
|
|
asctoa(nAdd + 65 - 1, buf);
|
|
str.Format("%s", buf); //뒷자리
|
|
|
|
CString str2;
|
|
asctoa(nMok + 65 - 1, buf);
|
|
str2.Format("%s", buf); //앞자리
|
|
str2 += str;
|
|
str = str2;
|
|
}
|
|
|
|
return str;
|
|
}
|
|
|
|
|
|
void CExcelManager::asctoa(int nCode, char* szBuf)
|
|
{
|
|
szBuf[0] = (char)nCode;
|
|
szBuf[1] = NULL;
|
|
}
|
|
|
|
//컬럼의 문자열에 해당하는 컬럼수를 반환한다.
|
|
int CExcelManager::GetXLColNumFromString(CString strRow)
|
|
{
|
|
int nCnt = strRow.GetLength();
|
|
int nNum[10];
|
|
int nSum = 0;
|
|
int nSu = 0;
|
|
|
|
for(int i = nCnt - 1; i >= 0 ; i--)
|
|
{
|
|
char ch = strRow.GetAt(i);
|
|
nNum[i] = (int)ch;
|
|
nNum[i] -= 64; //A가 65임에도 불구하고 64를 배는것은 아래에서 곱하기를 하기 때문에 A값이 0이 되서는 안되고,
|
|
nNum[i] = nNum[i]*(int)pow(26, nSu); //1이 되어야 하기 때문이다.
|
|
nSum += nNum[i];
|
|
nSu++;
|
|
}
|
|
|
|
return nSum;
|
|
}
|
|
|
|
|
|
|
|
vector<CString> CExcelManager::GetTitle()
|
|
{
|
|
vector<CString> vecTitle;
|
|
|
|
CString strStt = m_sheetInfo[m_nScriptType].GetSttCol();
|
|
CString strEnd = m_sheetInfo[m_nScriptType].GetEndCol();
|
|
|
|
int nSttCol = GetXLColNumFromString(m_sheetInfo[m_nScriptType].GetSttCol());
|
|
int nEndCol = GetXLColNumFromString(m_sheetInfo[m_nScriptType].GetEndCol());
|
|
|
|
int nCnt = nEndCol - nSttCol;
|
|
|
|
//행
|
|
int nRow = m_sheetInfo[m_nScriptType].GetSttRow();
|
|
int nCol = nSttCol;
|
|
|
|
while(nCol <= nEndCol)
|
|
{
|
|
CString strCell, strValue;
|
|
strCell.Format("%s%d", GetXLColNumFromInt(nCol), nRow);
|
|
strValue = GetValue(strCell);
|
|
vecTitle.push_back(strValue);
|
|
nCol++;
|
|
}
|
|
|
|
return vecTitle;
|
|
}
|
|
|
|
|
|
CString CExcelManager::GetErrorDescription(int nError)
|
|
{
|
|
CString str;
|
|
|
|
if(nError == 1)
|
|
str = "숫자가 들어가야 하는데 NULL이 들어가 있다";
|
|
else if(nError == 2)
|
|
str = "숫자가 들어가야 하는데 문자열이 들어가 있다.";
|
|
else if(nError == 3)
|
|
str = "잘못된 숫자값이 입력되었다.";
|
|
else if(nError == 4)
|
|
str = "문자가 들어가야 하는데 숫자가 입력되었다.";
|
|
else if(nError == 5)
|
|
str = "빈칸이 입력되었습니다.";
|
|
else if(nError == 6)
|
|
str = "알수없는 잘 못된 값이 들어갔습니다.";
|
|
|
|
return str;
|
|
}
|
|
|
|
|
|
BOOL CExcelManager::LoadSheetData(void)
|
|
{
|
|
COleVariant covOptional(DISP_E_PARAMNOTFOUND, VT_ERROR);
|
|
|
|
//초기화..
|
|
DeleteAllItem();
|
|
|
|
// 엑셀이 활성화 되어 있는지 체크
|
|
if (m_app.m_lpDispatch == NULL)
|
|
{
|
|
AfxMessageBox("Excel has not been started.");
|
|
return FALSE;
|
|
}
|
|
|
|
//워크시트는 Init 함수에서 얻었다.. (나중에 Init 함수랑 비교해서, 정리할것)
|
|
//시작 데이터 설정
|
|
int nSttCol = GetXLColNumFromString(m_sheetInfo[m_nScriptType].GetSttCol());
|
|
int nSttRow = m_sheetInfo[m_nScriptType].GetSttRow();
|
|
|
|
//Range 설정
|
|
m_range = m_sheet.get_Range(COleVariant(m_sheetInfo[m_nScriptType].GetSttCell()), COleVariant(m_sheetInfo[m_nScriptType].GetEndCell()));
|
|
|
|
//데이터를 얻는다.
|
|
COleSafeArray saData(m_range.get_Value(covOptional));
|
|
|
|
long nCntRow;
|
|
long nCntCol;
|
|
long nIndex[2];
|
|
BOOL bSuccess = FALSE;
|
|
int nErrorCode = 0;
|
|
|
|
//여기서 얻게 되는 row, col수는 내가 선택한 row와 col수 이다.
|
|
saData.GetUBound(1, &nCntRow);
|
|
saData.GetUBound(2, &nCntCol);
|
|
|
|
m_nColCount = nCntCol; // 현재 선택된 컬럽의 개수 설정
|
|
|
|
|
|
for(int nRow = 2; nRow <= nCntRow; nRow++) //여기서 nRow는 선택한 지점이 시작점이다.
|
|
{
|
|
CScript* pData;
|
|
|
|
if( m_nScriptType == SCRIPT_SKILL )
|
|
pData = new CSkillInfo;
|
|
else if( m_nScriptType == SCRIPT_STATE )
|
|
pData = new CStatusInfo;
|
|
else if( m_nScriptType == SCRIPT_MONSTER )
|
|
pData = new CMonster;
|
|
else if(m_nScriptType == SCRIPT_ITEM_WEAPON || m_nScriptType == SCRIPT_ITEM_ARMOR
|
|
|| m_nScriptType == SCRIPT_ITEM_ACCESSARY || m_nScriptType == SCRIPT_ITEM_WASTE )
|
|
pData = new CItem;
|
|
|
|
for(int nCol = 1; nCol <= nCntCol; nCol++) //여기서 nCol은 선택한 지점이 시작점이다.
|
|
{
|
|
nIndex[0] = nRow;
|
|
nIndex[1] = nCol;
|
|
COleVariant vData;
|
|
saData.GetElement(nIndex, vData);
|
|
bSuccess = SaveData(pData, nCol, vData, nErrorCode); //각 스크립트별로 저장됨
|
|
if(bSuccess == FALSE)
|
|
{
|
|
CString strCell;
|
|
strCell.Format("%s%d : %s \r\n", GetXLColNumFromInt(nCol + nSttCol - 1), nSttRow + nRow - 1, GetErrorDescription(nErrorCode));
|
|
m_strError += strCell;
|
|
}
|
|
}
|
|
|
|
//컬럼의 개수를 저장한다.
|
|
pData->SetColumnCount( nCntCol );
|
|
|
|
m_vecData.push_back( pData );
|
|
}
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
|
|
//행, 열, 데이터를 가지고 저장.
|
|
// nCol = 선택한 영역의 시작 열부터의 열번호
|
|
BOOL CExcelManager::SaveData(CScript* pData, int nCol,COleVariant value, int& nErrorCode)
|
|
{
|
|
BOOL bSuccess = pData->SaveData(nCol, value, nErrorCode);
|
|
return bSuccess;
|
|
}
|
|
|
|
|
|
BOOL CExcelManager::SaveText(CString& strText)
|
|
{
|
|
int nSize = (int)m_vecData.size();
|
|
|
|
strText.Empty();
|
|
|
|
for(int i = 0; i < nSize; i++)
|
|
{
|
|
CScript* pInfo = m_vecData[i];
|
|
CString str = pInfo->GetContentsAll();
|
|
strText += str;
|
|
}
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
void CExcelManager::DeleteAllItem(void)
|
|
{
|
|
int nSize = (int)m_vecData.size();
|
|
int nScriptType = GetScriptType();
|
|
|
|
for(int i = 0; i < nSize ; i++)
|
|
{
|
|
/* if(nScriptType == SCRIPT_SKILL )
|
|
{
|
|
CSkillInfo* pData = (CSkillInfo*)m_vecData[i];
|
|
}
|
|
else if(nScriptType == SCRIPT_STATE )
|
|
{
|
|
CStatusInfo* pData = (CStatusInfo*)m_vecData[i];
|
|
}
|
|
else if(nScriptType == SCRIPT_MONSTER )
|
|
{
|
|
CMonster* pData = (CMonster*)m_vecData[i];
|
|
}
|
|
else if(nScriptType == SCRIPT_ITEM_WEAPON || nScriptType == SCRIPT_ITEM_ARMOR
|
|
|| nScriptType == SCRIPT_ITEM_ACCESSARY || nScriptType == SCRIPT_ITEM_WASTE )
|
|
{
|
|
CItem* pData = (CItem*)m_vecData[i];
|
|
}*/
|
|
|
|
CScript* pData = m_vecData[i];
|
|
|
|
if(pData)
|
|
delete pData;
|
|
}
|
|
|
|
m_vecData.clear();
|
|
m_strError = "";
|
|
}
|
|
|
|
int CExcelManager::GetScriptType(void)
|
|
{
|
|
return m_nScriptType;
|
|
}
|
|
|
|
int CExcelManager::GetRowCount()
|
|
{
|
|
return (int)m_vecData.size();
|
|
}
|
|
|
|
int CExcelManager::GetColCount()
|
|
{
|
|
return m_nColCount;
|
|
}
|
|
|
|
void CExcelManager::SetSttCol(CString strSttCol)
|
|
{
|
|
m_sheetInfo[m_nScriptType].SetSttCol( strSttCol );
|
|
}
|
|
void CExcelManager::SetEndCol(CString strEndCol)
|
|
{
|
|
m_sheetInfo[m_nScriptType].SetEndCol( strEndCol );
|
|
}
|
|
void CExcelManager::SetSttRow(int nSttRow)
|
|
{
|
|
m_sheetInfo[m_nScriptType].SetSttRow( nSttRow );
|
|
}
|
|
void CExcelManager::SetEndRow(int nEndRow)
|
|
{
|
|
m_sheetInfo[m_nScriptType].SetEndRow( nEndRow );
|
|
}
|
|
|
|
CString CExcelManager::GetSttCol()
|
|
{
|
|
return m_sheetInfo[m_nScriptType].GetSttCol();
|
|
}
|
|
CString CExcelManager::GetEndCol()
|
|
{
|
|
return m_sheetInfo[m_nScriptType].GetEndCol();
|
|
}
|
|
int CExcelManager::GetSttRow()
|
|
{
|
|
return m_sheetInfo[m_nScriptType].GetSttRow();
|
|
}
|
|
int CExcelManager::GetEndRow()
|
|
{
|
|
return m_sheetInfo[m_nScriptType].GetEndRow();
|
|
}
|
|
int CExcelManager::GetSheetNo()
|
|
{
|
|
return m_sheetInfo[m_nScriptType].GetSheetNumber();
|
|
}
|
|
|
|
|
|
|
|
//SheetInfo.ini 파일로 부터 정보를 얻는다.
|
|
BOOL CExcelManager::LoadSheetInfo(void)
|
|
{
|
|
GetSkillSheetInfo();
|
|
GetStateSheetInfo();
|
|
GetMonsterSheetInfo();
|
|
GetWeaponSheetInfo();
|
|
GetArmorSheetInfo();
|
|
GetAccessarySheetInfo();
|
|
GetWasteSheetInfo();
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
BOOL CExcelManager::GetSkillSheetInfo(void)
|
|
{
|
|
const int nSize = 10;
|
|
char szFile[] = ".\\SheetInfo.ini";
|
|
char szData[nSize];
|
|
int nData = 0;
|
|
// 스킬
|
|
m_sheetInfo[SCRIPT_SKILL].SetScriptType( SCRIPT_SKILL );
|
|
GetPrivateProfileString ("SKILL", "STTCOL", "A", szData, nSize, szFile); //시작열
|
|
m_sheetInfo[SCRIPT_SKILL].SetSttCol( szData );
|
|
GetPrivateProfileString ("SKILL", "ENDCOL", "CQ", szData, nSize, szFile); //종료열
|
|
m_sheetInfo[SCRIPT_SKILL].SetEndCol( szData );
|
|
nData = GetPrivateProfileInt("SKILL", "STTROW", 8, szFile); //시작행
|
|
m_sheetInfo[SCRIPT_SKILL].SetSttRow( nData );
|
|
nData = GetPrivateProfileInt("SKILL", "ENDROW", 884, szFile); //종료행
|
|
m_sheetInfo[SCRIPT_SKILL].SetEndRow( nData );
|
|
nData = GetPrivateProfileInt("SKILL", "SHEETNO", 1, szFile); //시트번호
|
|
m_sheetInfo[SCRIPT_SKILL].SetSheetNumber( nData );
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
BOOL CExcelManager::GetStateSheetInfo(void)
|
|
{
|
|
const int nSize = 10;
|
|
char szFile[] = ".\\SheetInfo.ini";
|
|
char szData[nSize];
|
|
int nData = 0;
|
|
// 스킬
|
|
m_sheetInfo[SCRIPT_STATE].SetScriptType( SCRIPT_STATE );
|
|
GetPrivateProfileString ("STATE", "STTCOL", "A", szData, nSize, szFile); //시작열
|
|
m_sheetInfo[SCRIPT_STATE].SetSttCol( szData );
|
|
GetPrivateProfileString ("STATE", "ENDCOL", "G", szData, nSize, szFile); //종료열
|
|
m_sheetInfo[SCRIPT_STATE].SetEndCol( szData );
|
|
nData = GetPrivateProfileInt("STATE", "STTROW", 5, szFile); //시작행
|
|
m_sheetInfo[SCRIPT_STATE].SetSttRow( nData );
|
|
nData = GetPrivateProfileInt("STATE", "ENDROW", 71, szFile); //종료행
|
|
m_sheetInfo[SCRIPT_STATE].SetEndRow( nData );
|
|
nData = GetPrivateProfileInt ("STATE", "SHEETNO", 1, szFile); //시트번호
|
|
m_sheetInfo[SCRIPT_STATE].SetSheetNumber( nData );
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
|
|
BOOL CExcelManager::GetMonsterSheetInfo(void)
|
|
{
|
|
const int nSize = 10;
|
|
char szFile[] = ".\\SheetInfo.ini";
|
|
char szData[nSize];
|
|
int nData = 0;
|
|
// 스킬
|
|
m_sheetInfo[SCRIPT_MONSTER].SetScriptType( SCRIPT_MONSTER );
|
|
GetPrivateProfileString ("MONSTER", "STTCOL", "A", szData, nSize, szFile); //시작열
|
|
m_sheetInfo[SCRIPT_MONSTER].SetSttCol( szData );
|
|
GetPrivateProfileString ("MONSTER", "ENDCOL", "CZ", szData, nSize, szFile); //종료열
|
|
m_sheetInfo[SCRIPT_MONSTER].SetEndCol( szData );
|
|
nData = GetPrivateProfileInt("MONSTER", "STTROW", 11, szFile); //시작행
|
|
m_sheetInfo[SCRIPT_MONSTER].SetSttRow( nData );
|
|
nData = GetPrivateProfileInt("MONSTER", "ENDROW", 577, szFile); //종료행
|
|
m_sheetInfo[SCRIPT_MONSTER].SetEndRow( nData );
|
|
nData = GetPrivateProfileInt ("MONSTER", "SHEETNO", 2, szFile); //시트번호
|
|
m_sheetInfo[SCRIPT_MONSTER].SetSheetNumber( nData );
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
//무기
|
|
BOOL CExcelManager::GetWeaponSheetInfo(void)
|
|
{
|
|
const int nSize = 10;
|
|
char szFile[] = ".\\SheetInfo.ini";
|
|
char szData[nSize];
|
|
int nData = 0;
|
|
// 스킬
|
|
m_sheetInfo[SCRIPT_ITEM_WEAPON].SetScriptType( SCRIPT_ITEM_WEAPON );
|
|
GetPrivateProfileString ("WEAPON", "STTCOL", "B", szData, nSize, szFile); //시작열
|
|
m_sheetInfo[SCRIPT_ITEM_WEAPON].SetSttCol( szData );
|
|
GetPrivateProfileString ("WEAPON", "ENDCOL", "BA", szData, nSize, szFile); //종료열
|
|
m_sheetInfo[SCRIPT_ITEM_WEAPON].SetEndCol( szData );
|
|
nData = GetPrivateProfileInt("WEAPON", "STTROW", 7, szFile); //시작행
|
|
m_sheetInfo[SCRIPT_ITEM_WEAPON].SetSttRow( nData );
|
|
nData = GetPrivateProfileInt("WEAPON", "ENDROW", 157, szFile); //종료행
|
|
m_sheetInfo[SCRIPT_ITEM_WEAPON].SetEndRow( nData );
|
|
nData = GetPrivateProfileInt ("WEAPON", "SHEETNO", 2, szFile); //시트번호
|
|
m_sheetInfo[SCRIPT_ITEM_WEAPON].SetSheetNumber( nData );
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
//방어구
|
|
BOOL CExcelManager::GetArmorSheetInfo(void)
|
|
{
|
|
const int nSize = 10;
|
|
char szFile[] = ".\\SheetInfo.ini";
|
|
char szData[nSize];
|
|
int nData = 0;
|
|
// 스킬
|
|
m_sheetInfo[SCRIPT_ITEM_ARMOR].SetScriptType( SCRIPT_ITEM_ARMOR );
|
|
GetPrivateProfileString ("ARMOR", "STTCOL", "B", szData, nSize, szFile); //시작열
|
|
m_sheetInfo[SCRIPT_ITEM_ARMOR].SetSttCol( szData );
|
|
GetPrivateProfileString ("ARMOR", "ENDCOL", "BA", szData, nSize, szFile); //종료열
|
|
m_sheetInfo[SCRIPT_ITEM_ARMOR].SetEndCol( szData );
|
|
nData = GetPrivateProfileInt("ARMOR", "STTROW", 7, szFile); //시작행
|
|
m_sheetInfo[SCRIPT_ITEM_ARMOR].SetSttRow( nData );
|
|
nData = GetPrivateProfileInt("ARMOR", "ENDROW", 407, szFile); //종료행
|
|
m_sheetInfo[SCRIPT_ITEM_ARMOR].SetEndRow( nData );
|
|
nData = GetPrivateProfileInt ("ARMOR", "SHEETNO", 3, szFile); //시트번호
|
|
m_sheetInfo[SCRIPT_ITEM_ARMOR].SetSheetNumber( nData );
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
|
|
//악세서리
|
|
BOOL CExcelManager::GetAccessarySheetInfo(void)
|
|
{
|
|
const int nSize = 10;
|
|
char szFile[] = ".\\SheetInfo.ini";
|
|
char szData[nSize];
|
|
int nData = 0;
|
|
// 스킬
|
|
m_sheetInfo[SCRIPT_ITEM_ACCESSARY].SetScriptType( SCRIPT_ITEM_ACCESSARY );
|
|
GetPrivateProfileString ("ACCESSARY", "STTCOL", "B", szData, nSize, szFile); //시작열
|
|
m_sheetInfo[SCRIPT_ITEM_ACCESSARY].SetSttCol( szData );
|
|
GetPrivateProfileString ("ACCESSARY", "ENDCOL", "BA", szData, nSize, szFile); //종료열
|
|
m_sheetInfo[SCRIPT_ITEM_ACCESSARY].SetEndCol( szData );
|
|
nData = GetPrivateProfileInt("ACCESSARY", "STTROW", 2, szFile); //시작행
|
|
m_sheetInfo[SCRIPT_ITEM_ACCESSARY].SetSttRow( nData );
|
|
nData = GetPrivateProfileInt("ACCESSARY", "ENDROW", 27, szFile); //종료행
|
|
m_sheetInfo[SCRIPT_ITEM_ACCESSARY].SetEndRow( nData );
|
|
nData = GetPrivateProfileInt ("ACCESSARY", "SHEETNO", 4, szFile); //시트번호
|
|
m_sheetInfo[SCRIPT_ITEM_ACCESSARY].SetSheetNumber( nData );
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
|
|
//소모아이템
|
|
BOOL CExcelManager::GetWasteSheetInfo(void)
|
|
{
|
|
const int nSize = 10;
|
|
char szFile[] = ".\\SheetInfo.ini";
|
|
char szData[nSize];
|
|
int nData = 0;
|
|
// 스킬
|
|
m_sheetInfo[SCRIPT_ITEM_WASTE].SetScriptType( SCRIPT_ITEM_WASTE );
|
|
GetPrivateProfileString ("ACCESSARY", "STTCOL", "B", szData, nSize, szFile); //시작열
|
|
m_sheetInfo[SCRIPT_ITEM_WASTE].SetSttCol( szData );
|
|
GetPrivateProfileString ("ACCESSARY", "ENDCOL", "BA", szData, nSize, szFile); //종료열
|
|
m_sheetInfo[SCRIPT_ITEM_WASTE].SetEndCol( szData );
|
|
nData = GetPrivateProfileInt("ACCESSARY", "STTROW", 7, szFile); //시작행
|
|
m_sheetInfo[SCRIPT_ITEM_WASTE].SetSttRow( nData );
|
|
nData = GetPrivateProfileInt("ACCESSARY", "ENDROW", 44, szFile); //종료행
|
|
m_sheetInfo[SCRIPT_ITEM_WASTE].SetEndRow( nData );
|
|
nData = GetPrivateProfileInt ("ACCESSARY", "SHEETNO", 5, szFile); //시트번호
|
|
m_sheetInfo[SCRIPT_ITEM_WASTE].SetSheetNumber( nData );
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
BOOL CExcelManager::SaveSheetInfo( int nType, CString strSttCol, CString strEndCol, int nSttRow, int nEndRow, int nSheetNo )
|
|
{
|
|
if( nType == SCRIPT_SKILL )
|
|
SetSkillSheetInfo( strSttCol, strEndCol, nSttRow, nEndRow, nSheetNo );
|
|
else if( nType == SCRIPT_STATE )
|
|
SetStateSheetInfo( strSttCol, strEndCol, nSttRow, nEndRow, nSheetNo );
|
|
else if( nType == SCRIPT_MONSTER )
|
|
SetMonsterSheetInfo( strSttCol, strEndCol, nSttRow, nEndRow, nSheetNo );
|
|
else if( nType == SCRIPT_ITEM_WEAPON )
|
|
SetWeaponSheetInfo( strSttCol, strEndCol, nSttRow, nEndRow, nSheetNo );
|
|
else if( nType == SCRIPT_ITEM_ARMOR )
|
|
SetArmorSheetInfo( strSttCol, strEndCol, nSttRow, nEndRow, nSheetNo );
|
|
else if( nType == SCRIPT_ITEM_ACCESSARY )
|
|
SetAccessarySheetInfo( strSttCol, strEndCol, nSttRow, nEndRow, nSheetNo );
|
|
else if( nType == SCRIPT_ITEM_WASTE )
|
|
SetWasteSheetInfo( strSttCol, strEndCol, nSttRow, nEndRow, nSheetNo );
|
|
else
|
|
return FALSE;
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
BOOL CExcelManager::SetSkillSheetInfo( CString strSttCol, CString strEndCol, int nSttRow, int nEndRow, int nSheetNo )
|
|
{
|
|
char szFile[] = ".\\SheetInfo.ini";
|
|
CString strData;
|
|
// 스킬
|
|
WritePrivateProfileString( "SKILL", "STTCOL", strSttCol, szFile ); //시작열
|
|
WritePrivateProfileString( "SKILL", "ENDCOL", strEndCol, szFile ); //종료열
|
|
strData.Format("%d", nSttRow);
|
|
WritePrivateProfileString( "SKILL", "STTROW", strData, szFile); //시작행
|
|
strData.Format("%d", nEndRow);
|
|
WritePrivateProfileString( "SKILL", "ENDROW", strData, szFile ); //종료행
|
|
strData.Format("%d", nSheetNo);
|
|
WritePrivateProfileString( "SKILL", "SHEETNO", strData, szFile ); //시트번호
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
|
|
BOOL CExcelManager::SetStateSheetInfo( CString strSttCol, CString strEndCol, int nSttRow, int nEndRow, int nSheetNo )
|
|
{
|
|
char szFile[] = ".\\SheetInfo.ini";
|
|
CString strData;
|
|
// 스킬
|
|
WritePrivateProfileString( "STATE", "STTCOL", strSttCol, szFile ); //시작열
|
|
WritePrivateProfileString( "STATE", "ENDCOL", strEndCol, szFile ); //종료열
|
|
strData.Format("%d", nSttRow);
|
|
WritePrivateProfileString( "STATE", "STTROW", strData, szFile); //시작행
|
|
strData.Format("%d", nEndRow);
|
|
WritePrivateProfileString( "STATE", "ENDROW", strData, szFile ); //종료행
|
|
strData.Format("%d", nSheetNo);
|
|
WritePrivateProfileString( "STATE", "SHEETNO", strData, szFile ); //시트번호
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
BOOL CExcelManager::SetMonsterSheetInfo( CString strSttCol, CString strEndCol, int nSttRow, int nEndRow, int nSheetNo )
|
|
{
|
|
char szFile[] = ".\\SheetInfo.ini";
|
|
CString strData;
|
|
// 스킬
|
|
WritePrivateProfileString( "MONSTER", "STTCOL", strSttCol, szFile ); //시작열
|
|
WritePrivateProfileString( "MONSTER", "ENDCOL", strEndCol, szFile ); //종료열
|
|
strData.Format("%d", nSttRow);
|
|
WritePrivateProfileString( "MONSTER", "STTROW", strData, szFile); //시작행
|
|
strData.Format("%d", nEndRow);
|
|
WritePrivateProfileString( "MONSTER", "ENDROW", strData, szFile ); //종료행
|
|
strData.Format("%d", nSheetNo);
|
|
WritePrivateProfileString( "MONSTER", "SHEETNO", strData, szFile ); //시트번호
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
//무기
|
|
BOOL CExcelManager::SetWeaponSheetInfo( CString strSttCol, CString strEndCol, int nSttRow, int nEndRow, int nSheetNo )
|
|
{
|
|
char szFile[] = ".\\SheetInfo.ini";
|
|
CString strData;
|
|
// 스킬
|
|
WritePrivateProfileString( "WEAPON", "STTCOL", strSttCol, szFile ); //시작열
|
|
WritePrivateProfileString( "WEAPON", "ENDCOL", strEndCol, szFile ); //종료열
|
|
strData.Format("%d", nSttRow);
|
|
WritePrivateProfileString( "WEAPON", "STTROW", strData, szFile); //시작행
|
|
strData.Format("%d", nEndRow);
|
|
WritePrivateProfileString( "WEAPON", "ENDROW", strData, szFile ); //종료행
|
|
strData.Format("%d", nSheetNo);
|
|
WritePrivateProfileString( "WEAPON", "SHEETNO", strData, szFile ); //시트번호
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
//방어구
|
|
BOOL CExcelManager::SetArmorSheetInfo( CString strSttCol, CString strEndCol, int nSttRow, int nEndRow, int nSheetNo )
|
|
{
|
|
char szFile[] = ".\\SheetInfo.ini";
|
|
CString strData;
|
|
// 스킬
|
|
WritePrivateProfileString( "ARMOR", "STTCOL", strSttCol, szFile ); //시작열
|
|
WritePrivateProfileString( "ARMOR", "ENDCOL", strEndCol, szFile ); //종료열
|
|
strData.Format("%d", nSttRow);
|
|
WritePrivateProfileString( "ARMOR", "STTROW", strData, szFile); //시작행
|
|
strData.Format("%d", nEndRow);
|
|
WritePrivateProfileString( "ARMOR", "ENDROW", strData, szFile ); //종료행
|
|
strData.Format("%d", nSheetNo);
|
|
WritePrivateProfileString( "ARMOR", "SHEETNO", strData, szFile ); //시트번호
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
|
|
//악세서리
|
|
BOOL CExcelManager::SetAccessarySheetInfo( CString strSttCol, CString strEndCol, int nSttRow, int nEndRow, int nSheetNo )
|
|
{
|
|
char szFile[] = ".\\SheetInfo.ini";
|
|
CString strData;
|
|
// 스킬
|
|
WritePrivateProfileString( "ACCESSARY", "STTCOL", strSttCol, szFile ); //시작열
|
|
WritePrivateProfileString( "ACCESSARY", "ENDCOL", strEndCol, szFile ); //종료열
|
|
strData.Format("%d", nSttRow);
|
|
WritePrivateProfileString( "ACCESSARY", "STTROW", strData, szFile); //시작행
|
|
strData.Format("%d", nEndRow);
|
|
WritePrivateProfileString( "ACCESSARY", "ENDROW", strData, szFile ); //종료행
|
|
strData.Format("%d", nSheetNo);
|
|
WritePrivateProfileString( "ACCESSARY", "SHEETNO", strData, szFile ); //시트번호
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
|
|
//소모아이템
|
|
BOOL CExcelManager::SetWasteSheetInfo( CString strSttCol, CString strEndCol, int nSttRow, int nEndRow, int nSheetNo )
|
|
{
|
|
char szFile[] = ".\\SheetInfo.ini";
|
|
CString strData;
|
|
// 스킬
|
|
WritePrivateProfileString( "WASTE", "STTCOL", strSttCol, szFile ); //시작열
|
|
WritePrivateProfileString( "WASTE", "ENDCOL", strEndCol, szFile ); //종료열
|
|
strData.Format("%d", nSttRow);
|
|
WritePrivateProfileString( "WASTE", "STTROW", strData, szFile); //시작행
|
|
strData.Format("%d", nEndRow);
|
|
WritePrivateProfileString( "WASTE", "ENDROW", strData, szFile ); //종료행
|
|
strData.Format("%d", nSheetNo);
|
|
WritePrivateProfileString( "WASTE", "SHEETNO", strData, szFile ); //시트번호
|
|
|
|
return TRUE;
|
|
}
|