📄 chrtacquest.cpp
字号:
void CChrTacQuest::OnMove8()
{
// TODO: Add your control notification handler code here
m_dwExp8 = m_dwExpMax8;
UpdateData(FALSE);
}
void CChrTacQuest::OnMove9()
{
// TODO: Add your control notification handler code here
m_dwExp9 = m_dwExpMax9;
UpdateData(FALSE);
}
void CChrTacQuest::OnMove10()
{
// TODO: Add your control notification handler code here
m_dwExp10 = m_dwExpMax10;
UpdateData(FALSE);
}
void CChrTacQuest::OnMove11()
{
// TODO: Add your control notification handler code here
m_dwExp11 = m_dwExpMax11;
UpdateData(FALSE);
}
void CChrTacQuest::OnMove12()
{
// TODO: Add your control notification handler code here
m_dwExp12 = m_dwExpMax12;
UpdateData(FALSE);
}
void CChrTacQuest::OnClickQuest(NMHDR* pNMHDR, LRESULT* pResult)
{
pNMHDR;
// TODO: Add your control notification handler code here
int nItem;
POSITION pos = c_Quest.GetFirstSelectedItemPosition();
if (pos == NULL)
MessageBox("No items were selected!");
else
{
while (pos)
{
//急琶等 亲格甸阑 备茄促.
nItem = c_Quest.GetNextSelectedItem(pos);
m_nQuestNo = atoi(c_Quest.GetItemText(nItem,0));
m_nQuestValue = atoi(c_Quest.GetItemText(nItem,1));
UpdateData(FALSE);
c_QuestValue.SetFocus();
c_QuestValue.SetSel(0, -1); //葛滴 急琶登霸
//眠啊等 酒捞袍篮 颇鄂臂揪肺 窍捞扼捞飘 矫虐绊
//c_Quest.SetHotItem(i);
}
}
*pResult = 0;
}
void CChrTacQuest::OnOk()
{
// TODO: Add your control notification handler code here
if( !RIGHT(MASK_24) ) return;
if( MessageBox( "Do you want to UPDATE Quest", "UPDATE", MB_YESNO ) != IDYES) return;
UpdateData(TRUE);
CCharacterView* pView = (CCharacterView*)GetParent();
pView->m_ChrInfoEtc.script_var[ m_nQuestNo ] = m_nQuestValue;
HWND hList = ::GetDlgItem(m_hWnd,IDC_QUEST);
LV_FINDINFO fi;
fi.flags = LVFI_PARAM;
fi.lParam = m_nQuestNo;
int nItem = ListView_FindItem( hList, -1,&fi);
char temp[0xff];
LVITEM item;
item.iItem = nItem;//atoi(c_Quest.GetItemText(m_nQuest,0));
item.mask = LVIF_TEXT;
item.iSubItem = 1;
item.pszText = _itoa(m_nQuestValue, temp, 10);
c_Quest.SetItem(&item);
//眠啊等 酒捞袍篮 颇鄂臂揪肺 窍捞扼捞飘 矫虐绊
//c_Quest.SetHotItem(nItem);
}
void CChrTacQuest::OnSave()
{
// TODO: Add your control notification handler code here
if( !RIGHT(MASK_19) ) return;
if( MessageBox( "Do you want to Save Tactic", "Tactic", MB_YESNO ) != IDYES) return;
CCharacterView* pView = (CCharacterView*)GetParent();
if( strcmp(g_CurDbName[ pView->m_nCurDbIndex ], g_NationAccount.szDragon_DB_DefaultName[pView->m_nCurDbIndex]) )
//if( strcmp(g_CurDbName[ pView->m_nCurDbIndex ], DEFAULT_GAME_DB) )
{
MessageBox("Don't Change In Backup DB Data!");
return;
}
UpdateData();
DWORD *pExp = &m_dwExp0;
int *pStep = &m_nStep0;
for(int i=0; i<13 ; i++)
{
pView->m_ChrInfoEtc.tac_skillexp[ i ] = *(pExp + i); //Tactic 版氰摹 诀单捞飘
pView->m_ChrInfo.guildname[ 3 + i ] = (BYTE)(*(pStep + i)); //Tactic 饭骇 诀单捞飘
}
//Update 巩
char szQuery[ 1024 ];
WCHAR wszQuery[ 1024 ];
int ret;
DBBINDING* pBinding;
switch(g_iNation)
{
case NATION_JAPAN:
{
chr_info_etc_for_updateUNI NewData;
wchar_t wGuildname[20];
memcpy(&NewData, &pView->m_ChrInfoEtc, sizeof(pView->m_ChrInfoEtc));
memset(&wGuildname, 0, sizeof( wGuildname) );
pView->ConvertSave((char*)pView->m_ChrInfo.guildname, sizeof(pView->m_ChrInfo.guildname));
//::WideCharToMultiByte(CP_ACP, 0, pView->m_ChrInfo.guildname, -1, wGuildname, 100, NULL, NULL);
//wsprintf( wGuildname, "%s", pView->m_ChrInfo.guildname);
g_pDb->KSCToUnicode( pView->m_ChrInfo.guildname, wGuildname);
pView->ConvertLoad((char*)pView->m_ChrInfo.guildname, sizeof(pView->m_ChrInfo.guildname));
memcpy(NewData.guildname , wGuildname, sizeof(wGuildname));
sprintf(szQuery, "Update chr_info set tac_skillexp=?, script_var=?, skill=?, skill_exp=?, guildname=? "
"where [name]='%s'",pView->m_szCurCharName);
int nColumn = 5;
DWORD dwParamOffset = 0;
pBinding = g_pDb->CreateParamInfo( (BYTE)nColumn, (BYTE)CON); if(!pBinding) { MessageBox("Failed CreateParamInfo"); return; }
pBinding[0].obValue = dwParamOffset;
pBinding[0].cbMaxLen = sizeof(NewData.tac_skillexp);
pBinding[0].wType = DBTYPE_BYTES;
dwParamOffset += sizeof(NewData.tac_skillexp);
pBinding[1].obValue = dwParamOffset;
pBinding[1].cbMaxLen = sizeof(NewData.script_var);
pBinding[1].wType = DBTYPE_BYTES;
dwParamOffset += sizeof(NewData.script_var);
pBinding[2].obValue = dwParamOffset;
pBinding[2].cbMaxLen = sizeof(NewData.skill);
pBinding[2].wType = DBTYPE_BYTES;
dwParamOffset += sizeof(NewData.skill);
pBinding[3].obValue = dwParamOffset;
pBinding[3].cbMaxLen = sizeof(NewData.skillexp);
pBinding[3].wType = DBTYPE_BYTES;
dwParamOffset += sizeof(NewData.skillexp);
pBinding[4].obValue = dwParamOffset;
pBinding[4].cbMaxLen = sizeof(NewData.guildname);
pBinding[4].wType = DBTYPE_BYTES;
dwParamOffset += sizeof(NewData.guildname);
//pView->ConvertSave((char*)NewData.guildname, sizeof(NewData.guildname));
g_pDb->KSCToUnicode(szQuery,wszQuery);
ret = g_pDb->ExecuteSQLByParam(wszQuery, pBinding, &NewData, (BYTE)nColumn, (BYTE)CON);
break;
}
default:
{
chr_info_etc_for_update NewData;
wchar_t wGuildname[20];
memcpy(&NewData, &pView->m_ChrInfoEtc, sizeof(pView->m_ChrInfoEtc));
memcpy(NewData.guildname , pView->m_ChrInfo.guildname, sizeof(pView->m_ChrInfo.guildname));
sprintf(szQuery, "Update chr_info set tac_skillexp=?, script_var=?, skill=?, skill_exp=?, guildname=? "
"where [name]='%s'",pView->m_szCurCharName);
int nColumn = 5;
DWORD dwParamOffset = 0;
pBinding = g_pDb->CreateParamInfo( (BYTE)nColumn, (BYTE)CON); if(!pBinding) { MessageBox("Failed CreateParamInfo"); return; }
pBinding[0].obValue = dwParamOffset;
pBinding[0].cbMaxLen = sizeof(NewData.tac_skillexp);
pBinding[0].wType = DBTYPE_BYTES;
dwParamOffset += sizeof(NewData.tac_skillexp);
pBinding[1].obValue = dwParamOffset;
pBinding[1].cbMaxLen = sizeof(NewData.script_var);
pBinding[1].wType = DBTYPE_BYTES;
dwParamOffset += sizeof(NewData.script_var);
pBinding[2].obValue = dwParamOffset;
pBinding[2].cbMaxLen = sizeof(NewData.skill);
pBinding[2].wType = DBTYPE_BYTES;
dwParamOffset += sizeof(NewData.skill);
pBinding[3].obValue = dwParamOffset;
pBinding[3].cbMaxLen = sizeof(NewData.skillexp);
pBinding[3].wType = DBTYPE_BYTES;
dwParamOffset += sizeof(NewData.skillexp);
pBinding[4].obValue = dwParamOffset;
pBinding[4].cbMaxLen = sizeof(NewData.guildname);
pBinding[4].wType = DBTYPE_BYTES;
dwParamOffset += sizeof(NewData.guildname);
pView->ConvertSave((char*)NewData.guildname, sizeof(NewData.guildname));
g_pDb->KSCToUnicode(szQuery,wszQuery);
ret = g_pDb->ExecuteSQLByParam(wszQuery, pBinding, &NewData, (BYTE)nColumn, (BYTE)CON);
}
}
if(!ret)
{
MessageBox("Have no User!");
return;
}
else if(ret < 0)
{
MessageBox("fail to update chr_info_binary!");
return;
}
g_pDb->ReleaseParamInfo(pBinding, (BYTE)CON);
//for Extensionlog
WriteLog();
//
#ifdef RM_LOG_MODE
CString str; str.Format("CChrTacQuest :: Saved tactic/quest info(%s)",pView->m_szCurCharName);
m_pApp->LogChar(pView->m_nCurServerSet, str);
#endif
}
void CChrTacQuest::WriteLog()
{//for Extensionlog
CCharacterView* pView = (CCharacterView*)GetParent();
if( pView->m_pcLogMgr != NULL )
{
pView->m_pcLogMgr->CheckChrInfoEtc_TaticQuest( pView->m_ChrInfoEtc);
pView->m_pcLogMgr->SetChrInfo_TaticQuest( pView->m_ChrInfoEtc );
}
}
bool CChrTacQuest::GetGuildNameByChName( const char* szName, char *szGuildName )
{
CCharacterView* m_pView = (CCharacterView*)GetParent();
char str[ 1024 ];
WCHAR query[ 1024 ];
int ret = 0;
sprintf(str," select guildname from chr_info where name='%s'", szName);
g_pDb->KSCToUnicode(str,query);
ret = g_pDb->OpenRecord(query, szGuildName, 1, (BYTE)DRAGON_DB[ m_pView->m_nCurDbIndex ]);
if(ret < 0) return FALSE;
else if(!ret)
{
MessageBox("Have no User!");
return false;
}
}
bool CChrTacQuest::GetTacticExpByName( const char* szName, DWORD *tacticExp )
{
CCharacterView* m_pView = (CCharacterView*)GetParent();
char str[ 1024 ];
WCHAR query[ 1024 ];
int ret = 0;
sprintf(str,"select tac_skillEXP from chr_info where name='%s'", szName);
g_pDb->KSCToUnicode(str,query);
ret = g_pDb->OpenRecord(query, tacticExp, 1, (BYTE)DRAGON_DB[ m_pView->m_nCurDbIndex ]);
if(ret < 0) return FALSE;
else if(!ret)
{
MessageBox("Have no User!");
return false;
}
}
int CChrTacQuest::GetTacLevelByChName( const char* szName, const int nTactic)
{
char szGuildName[20];
DWORD tac_skillexp[13];
if( !GetGuildNameByChName( szName, szGuildName ) ) return 0;
if( !GetTacticExpByName( szName, tac_skillexp ) ) return 0;
int nStep,nExp;
DWORD dwMaxExp, dwLevel;
nStep = szGuildName[ 3 + nTactic ];
nExp = tac_skillexp[ nTactic ];
GetLevelFromTacticExp( nExp, nStep, dwMaxExp, dwLevel);
return (++dwLevel); //角力 饭闺篮 捞芭焊促 窍唱 农促.
}
typedef struct OVER_TAC
{
char szName[20];
char szId[20];
} t_over_tactic;
void CChrTacQuest::FindOverTacLevel(const int nTac, const int nLevel)
{
CCharacterView* m_pView = (CCharacterView*)GetParent();
UpdateData(false);
char szQuery[ 0xff ];
WCHAR wszQuery[ 0xff ];
sprintf(szQuery,"EXEC UP_GET_OVER_TACTIC_LEVEL %d, %d", nLevel, nTac);
g_pDb->KSCToUnicode(szQuery, wszQuery);
char tmp[CHARACTER_NAME_SIZE];
t_over_tactic tOver;
int ret = g_pDb->OpenRecord(wszQuery, &tOver, 1, (BYTE)DRAGON_DB[ m_pView->m_nCurDbIndex ]);
if(ret < 0)
MessageBox("Query failed on UP_RM_LOGIN_INFO!");
MessageBoxPrintf( MB_OK, "name = %s, ID = %s", tOver.szName, tOver.szId );
return;
}
void CChrTacQuest::OnButton1()
{
// TODO: Add your control notification handler code here
FindOverTacLevel(0,160);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -