chrbasic.cpp

来自「网络游戏龙族服务器端管理工具 rmtool 源代码」· C++ 代码 · 共 1,206 行 · 第 1/3 页

CPP
1,206
字号
	else
	{
		nRet= g_pDb->ExecuteSQLByParam(wszQuery, pBinding, &pView->m_ChrLogInfo, (BYTE)nColumn, (BYTE)TOTAL_DB);
	}


	if(nRet< 0)
		return FALSE;
	else if(nRet== 0)
		MessageBox("Have no ID In Database.");

	return TRUE;
}

void CChrBasic::OnSelchangeComboNation() 
{
	CCharacterView *pView = (CCharacterView*)GetParent();

	//if(MessageBox("惫啊 函版矫 秦寸窍绰 Login 酒捞叼狼 葛电 某腐磐狼 惫啊啊 函版邓聪促. 拌加窍矫摆嚼聪鳖?","惫啊函版",MB_YESNO) == IDNO)
	if(MessageBox("Change All Your Character's Nation_Info. Continue?","Change Nation",MB_YESNO) == IDNO)
	{
		switch((int)pView->m_ChrInfo.nation.nation)
		{
		//官捞辑胶 
		case 3:	c_ComboNation.SetCurSel(0);	break;
		//磊捞戚 
		case 4:	c_ComboNation.SetCurSel(1);	break;
		//老胶
		case 6:	c_ComboNation.SetCurSel(2);	break;
		}
		return;
	}
	else
	{
//		if(pView->m_nCurDbConnection == DRAGON_DB[0])
//		{
			int nIndex;nIndex=0;
			switch(c_ComboNation.GetCurSel())
			{
			case 0:	nIndex = 3;	break;
			case 1:	nIndex = 4;	break;
			case 2: nIndex = 6; break;
			}
			
			pView->m_ChrInfo.nation.nation = nIndex;
			ChangeNation( pView->m_szAllCharName.name1, nIndex );
			ChangeNation( pView->m_szAllCharName.name2, nIndex );
			ChangeNation( pView->m_szAllCharName.name3, nIndex );
			ChangeNation( pView->m_szAllCharName.name4, nIndex );
//		}
//		else
//		{
//			MessageBox("归诀 DB俊辑绰 函版且 荐 绝嚼聪促.");
//		}

	}
}

BOOL CChrBasic::ChangeNation(char *name, int nationcode)
{
	CCharacterView *pView = (CCharacterView*)GetParent();
	char szQuery[ 0xff ];
	WCHAR wszQuery[ 0xff ];
	CCharRank nation;

	sprintf(szQuery,"select nation from chr_info where [name]='%s'",name);
	
	g_pDb->KSCToUnicode(szQuery, wszQuery);
	g_pDb->OpenRecord(wszQuery, &nation, 1, (BYTE)CON);

	nation.nation = nationcode;
	
	DWORD dwValue;
	memcpy(&dwValue, &nation, sizeof(DWORD));

	sprintf(szQuery,"update chr_info set nation = %d where [name]='%s'",dwValue, name);
	g_pDb->KSCToUnicode(szQuery, wszQuery);
	g_pDb->ExecuteSQL(wszQuery, (BYTE)CON);
	return TRUE;
}

BOOL CChrBasic::UpdateChrInfo()
{
	CCharacterView *pView = (CCharacterView*)GetParent();

	UpdateData(FALSE); // 021203 kyo
	//kyo 020904
	//扁夯栏肺 沥茄 叼厚捞抚苞 瘤陛佬绢柯 叼厚捞抚捞 促福搁 ..
	if( strcmp(g_CurDbName[ pView->m_nCurDbIndex ], g_NationAccount.szDragon_DB_DefaultName[ pView->m_nCurDbIndex ]) )
	{
		MessageBox("Don't Change In Backup DB Data!");
		return FALSE;
	}
	
	pView->m_ChrInfo.BankMoney.least = m_dwBankMoney;	//BankMoney
	pView->m_ChrInfo.exp.least = m_dwExp;				//Exp
	pView->m_ChrInfo.fame = m_dwFame;					//Fame
	pView->m_ChrInfo.hp = m_dwHp;						//Hp
	pView->m_ChrInfo.hungry = m_dwHungry;				//Hungry
	pView->m_ChrInfo.ladderscore = m_dwLadder;			//贰歹痢荐 
	pView->m_ChrInfo.LastLoan = m_dwLoan;				//Loan
	pView->m_ChrInfo.mana = m_dwMana;					//Mana
	pView->m_ChrInfo.nut1 = m_dwNkVyseus;				//NK_Vyseus 
	pView->m_ChrInfo.nut2 = m_dwNkZypern;				//NK_Zypern
	pView->m_ChrInfo.nut3 = m_dwNkYilles; 				//NK_Yilles
	pView->m_ChrInfo.reserved_point = m_dwReservedPoint;//Reserved_Point
	pView->m_ChrInfo.reset = m_dwReset;					//reset (age 鞘靛)
	
	int nIndex = c_ComboRecent.GetCurSel();
	c_ComboRecent.GetLBText(nIndex, pView->m_ChrInfo.MapName);	//MapName
	
	pView->m_ChrInfo.spell = c_ComboSpell.GetCurSel();		//spell
	pView->m_ChrInfo.class1 = c_ComboClass.GetCurSel();		//class
	
	pView->m_ChrInfo.guildname[ 0 ] = (unsigned char)m_dwDualStep;			//DualStep//020303 lsw
	
//kyo 020826
	nIndex = c_ComboDualClass.GetCurSel();					//DualClass;	
	if(nIndex == 0)
		pView->m_ChrInfo.guildname[ 1 ] = 0;		
	else
		pView->m_ChrInfo.guildname[ 1 ] = (BYTE)(nIndex - 1);		

	pView->m_ChrInfo.guildname[ 2 ] = (BYTE)(atoi(m_ComboLvStep));	//ExpStep
	
	pView->m_ChrInfo.lev = atoi(m_ComboLevel);				//level
	
	//Ability
	pView->m_ChrInfo.str = atoi(m_ComboStr);
	pView->m_ChrInfo.dex = atoi(m_ComboDex);
	pView->m_ChrInfo.con = atoi(m_ComboCon);
	pView->m_ChrInfo.wis = atoi(m_ComboWis);
	pView->m_ChrInfo.int1 = atoi(m_ComboInt);
	pView->m_ChrInfo.movep = atoi(m_ComboMovp);
	pView->m_ChrInfo.char1 = atoi(m_ComboChar);
	pView->m_ChrInfo.endu = atoi(m_ComboEndu);
	pView->m_ChrInfo.moral = atoi(m_ComboMoral);
	pView->m_ChrInfo.luck = atoi(m_ComboLuck);
	pView->m_ChrInfo.wsps = atoi(m_ComboWsps);


	int		nColumn = 31;		//颇扼固磐 肮荐 瘤沥 
	DWORD	dwParamOffset = 0;	//颇扼固磐 Binding 沥焊 备炼眉俊辑 阿 颇扼固磐 Value甸狼 Offset

	DBBINDING* pBinding = g_pDb->CreateParamInfo((BYTE)nColumn);	if(!pBinding) { MessageBox("Failed CreateParamInfo");	return FALSE;	}

	pBinding[0].obValue = dwParamOffset;	
	pBinding[0].cbMaxLen = sizeof(pView->m_ChrInfo.login_id);
	pBinding[0].wType = DBTYPE_STR;
	dwParamOffset += sizeof(pView->m_ChrInfo.login_id);

	pBinding[1].obValue = dwParamOffset;
	pBinding[1].cbMaxLen = sizeof(pView->m_ChrInfo.class1 );
	pBinding[1].wType = DBTYPE_I4;
	dwParamOffset += sizeof(pView->m_ChrInfo.class1);

	pBinding[2].obValue = dwParamOffset;
	pBinding[2].cbMaxLen = sizeof(pView->m_ChrInfo.spell);
	pBinding[2].wType = DBTYPE_I4;
	dwParamOffset += sizeof(pView->m_ChrInfo.spell);

	pBinding[3].obValue = dwParamOffset;
	pBinding[3].cbMaxLen = sizeof(pView->m_ChrInfo.reset);
	pBinding[3].wType = DBTYPE_I4;
	dwParamOffset += sizeof(pView->m_ChrInfo.reset);

	pBinding[4].obValue = dwParamOffset;
	pBinding[4].cbMaxLen = sizeof(pView->m_ChrInfo.lev);
	pBinding[4].wType = DBTYPE_I4;
	dwParamOffset += sizeof(pView->m_ChrInfo.lev);

	pBinding[5].obValue = dwParamOffset;
	pBinding[5].cbMaxLen = sizeof(pView->m_ChrInfo.exp);
	pBinding[5].wType = DBTYPE_NUMERIC;
	dwParamOffset += sizeof(pView->m_ChrInfo.exp);

	pBinding[6].obValue = dwParamOffset;
	pBinding[6].cbMaxLen = sizeof(pView->m_ChrInfo.guildname );
	pBinding[6].wType = DBTYPE_STR;
	dwParamOffset += sizeof(pView->m_ChrInfo.guildname );

	pBinding[7].obValue = dwParamOffset;
	pBinding[7].cbMaxLen = sizeof(pView->m_ChrInfo.nut1 );
	pBinding[7].wType = DBTYPE_I4;
	dwParamOffset += sizeof(pView->m_ChrInfo.nut1 );

	pBinding[8].obValue = dwParamOffset;
	pBinding[8].cbMaxLen = sizeof(pView->m_ChrInfo.nut2 );
	pBinding[8].wType = DBTYPE_I4;
	dwParamOffset += sizeof(pView->m_ChrInfo.nut2);

	pBinding[9].obValue = dwParamOffset;
	pBinding[9].cbMaxLen = sizeof(pView->m_ChrInfo.nut3);
	pBinding[9].wType = DBTYPE_I4;
	dwParamOffset += sizeof(pView->m_ChrInfo.nut3);

	pBinding[10].obValue = dwParamOffset;
	pBinding[10].cbMaxLen = sizeof(pView->m_ChrInfo.mana);
	pBinding[10].wType = DBTYPE_I4;
	dwParamOffset += sizeof(pView->m_ChrInfo.mana);

	pBinding[11].obValue = dwParamOffset;
	pBinding[11].cbMaxLen = sizeof(pView->m_ChrInfo.hp);
	pBinding[11].wType = DBTYPE_I4;
	dwParamOffset += sizeof(pView->m_ChrInfo.hp);

	pBinding[12].obValue = dwParamOffset;
	pBinding[12].cbMaxLen = sizeof(pView->m_ChrInfo.hungry );
	pBinding[12].wType = DBTYPE_I4;
	dwParamOffset += sizeof(pView->m_ChrInfo.hungry );

	pBinding[13].obValue = dwParamOffset;
	pBinding[13].cbMaxLen = sizeof(pView->m_ChrInfo.str);
	pBinding[13].wType = DBTYPE_I4;
	dwParamOffset += sizeof(pView->m_ChrInfo.str);

	pBinding[14].obValue = dwParamOffset;
	pBinding[14].cbMaxLen = sizeof(pView->m_ChrInfo.con );
	pBinding[14].wType = DBTYPE_I4;
	dwParamOffset += sizeof(pView->m_ChrInfo.con );

	pBinding[15].obValue = dwParamOffset;
	pBinding[15].cbMaxLen = sizeof(pView->m_ChrInfo.dex );
	pBinding[15].wType = DBTYPE_I4;
	dwParamOffset += sizeof(pView->m_ChrInfo.dex );

	pBinding[16].obValue = dwParamOffset;
	pBinding[16].cbMaxLen = sizeof(pView->m_ChrInfo.wis );
	pBinding[16].wType = DBTYPE_I4;
	dwParamOffset += sizeof(pView->m_ChrInfo.wis );

	pBinding[17].obValue = dwParamOffset;
	pBinding[17].cbMaxLen = sizeof(pView->m_ChrInfo.int1 );
	pBinding[17].wType = DBTYPE_I4;
	dwParamOffset += sizeof(pView->m_ChrInfo.int1 );

	pBinding[18].obValue = dwParamOffset;
	pBinding[18].cbMaxLen = sizeof(pView->m_ChrInfo.movep );
	pBinding[18].wType = DBTYPE_I4;
	dwParamOffset += sizeof(pView->m_ChrInfo.movep );

	pBinding[19].obValue = dwParamOffset;
	pBinding[19].cbMaxLen = sizeof(pView->m_ChrInfo.char1 );
	pBinding[19].wType = DBTYPE_I4;
	dwParamOffset += sizeof(pView->m_ChrInfo.char1 );

	pBinding[20].obValue = dwParamOffset;
	pBinding[20].cbMaxLen = sizeof(pView->m_ChrInfo.endu );
	pBinding[20].wType = DBTYPE_I4;
	dwParamOffset += sizeof(pView->m_ChrInfo.endu );

	pBinding[21].obValue = dwParamOffset;
	pBinding[21].cbMaxLen = sizeof(pView->m_ChrInfo.moral );
	pBinding[21].wType = DBTYPE_I4;
	dwParamOffset += sizeof(pView->m_ChrInfo.moral );

	pBinding[22].obValue = dwParamOffset;
	pBinding[22].cbMaxLen = sizeof(pView->m_ChrInfo.luck );
	pBinding[22].wType = DBTYPE_I4;
	dwParamOffset += sizeof(pView->m_ChrInfo.luck );

	pBinding[23].obValue = dwParamOffset;
	pBinding[23].cbMaxLen = sizeof(pView->m_ChrInfo.wsps );
	pBinding[23].wType = DBTYPE_I4;
	dwParamOffset += sizeof(pView->m_ChrInfo.wsps );

	pBinding[24].obValue = dwParamOffset;
	pBinding[24].cbMaxLen = sizeof(pView->m_ChrInfo.reserved_point );
	pBinding[24].wType = DBTYPE_I4;
	dwParamOffset += sizeof(pView->m_ChrInfo.reserved_point );

	pBinding[25].obValue = dwParamOffset;
	pBinding[25].cbMaxLen = sizeof(pView->m_ChrInfo.nation );
	pBinding[25].wType = DBTYPE_I4;
	dwParamOffset += sizeof(pView->m_ChrInfo.nation );

	pBinding[26].obValue = dwParamOffset;
	pBinding[26].cbMaxLen = sizeof(pView->m_ChrInfo.ladderscore );
	pBinding[26].wType = DBTYPE_I4;
	dwParamOffset += sizeof(pView->m_ChrInfo.ladderscore );

	pBinding[27].obValue = dwParamOffset;
	pBinding[27].cbMaxLen = sizeof(pView->m_ChrInfo.BankMoney );
	pBinding[27].wType = DBTYPE_NUMERIC;
	dwParamOffset += sizeof(pView->m_ChrInfo.BankMoney );

	pBinding[28].obValue = dwParamOffset;
	pBinding[28].cbMaxLen = sizeof(pView->m_ChrInfo.MapName );
	pBinding[28].wType = DBTYPE_STR;
	dwParamOffset += sizeof(pView->m_ChrInfo.MapName );
	
	pBinding[29].obValue = dwParamOffset;
	pBinding[29].cbMaxLen = sizeof(pView->m_ChrInfo.LastLoan );
	pBinding[29].wType = DBTYPE_I4;
	dwParamOffset += sizeof(pView->m_ChrInfo.LastLoan );

	pBinding[30].obValue = dwParamOffset;
	pBinding[30].cbMaxLen = sizeof(pView->m_ChrInfo.fame );
	pBinding[30].wType = DBTYPE_I4;
	dwParamOffset += sizeof(pView->m_ChrInfo.fame );


//--------------------------------------------------------------------------------------

	char szQuery[ 1024 ];
	WCHAR wszQuery[ 1024 ];
	
	sprintf(szQuery, "Update chr_info set login_id=?, class=?, spell=?, age=?, lev=?, [exp]=?,"
					"guildname=?, nut1=?, nut2=?, nut3=?, mana=?, hp=?, hungry=?, [str]=?,con=?,"
					"dex=?,wis=?, [int]=?,movep=?, [char]=?,endu=?,moral=?, luck=?, wsps=?,"
					"reserved_point=?, nation=?, ladderscore=?, Bankmoney=?, MapName=?,"
					"LastLoan=?, Fame=? where [name]='%s'",pView->m_szCurCharName);
	
	
	g_pDb->KSCToUnicode(szQuery,wszQuery);

	pView->ConvertSave((char*)pView->m_ChrInfo.guildname, sizeof(pView->m_ChrInfo.guildname));

	int affected = g_pDb->ExecuteSQLByParam(wszQuery, pBinding, &pView->m_ChrInfo, (BYTE)nColumn,(BYTE)CON);

	pView->ConvertLoad((char*)pView->m_ChrInfo.guildname, sizeof(pView->m_ChrInfo.guildname));
	
	if(affected < 0)
		return FALSE;
	else if(affected == 0)
		MessageBox("Have no Charater In Database.");

	return TRUE;
}

void CChrBasic::SetItemName(ItemAttr *work)
{
	work;
}

int GetItemIndex(int item_no, int &type, int &index)
{
	type = item_no / 1000;
	index = item_no % 1000;
	return 1;
}

BOOL CChrBasic::PreTranslateMessage(MSG* pMsg) 
{
	// TODO: Add your specialized code here and/or call the base class
	if(m_hWnd == NULL)
	{
		//int k;k=0;
		return 0;
	}
	return CDialog::PreTranslateMessage(pMsg);
}

void CChrBasic::SelectClear( )
{
	c_ComboDualClass.SetCurSel( 0 );
}

void CChrBasic::OnMoveExp() 
{
	// TODO: Add your control notification handler code here
	m_dwExp = m_dwMaxExp ;
	SetDlgItemInt( IDC_EXP, m_dwExp);	
}

void CChrBasic::OnChangePassword() 
{
	// TODO: If this is a RICHEDIT control, the control will not
	// send this notification unless you override the CDialog::OnInitDialog()
	// function and call CRichEditCtrl().SetEventMask()
	// with the ENM_CHANGE flag ORed into the mask.
	
	// TODO: Add your control notification handler code here

	//捞 窃荐甫... 角青登瘤 臼绰促. 
	if( RIGHT( MASK_ADMINISTRATOR ) )
		if( m_szPassword.GetLength() > 0 )
			AfxMessageBox( m_szPassword );
	
}

void CChrBasic::OnCalcAbility() 
{
	UpdateData( TRUE );
	int nChar = atoi( m_ComboChar.GetBuffer(0) );
	int nCon = atoi( m_ComboCon.GetBuffer(0) );
	int nDex = atoi( m_ComboDex.GetBuffer(0) );
	int nEndu = atoi( m_ComboEndu.GetBuffer(0) );
	int nInt = atoi( m_ComboInt.GetBuffer(0) );
	int nLuck = atoi( m_ComboLuck.GetBuffer(0) );
	int nMoral = atoi( m_ComboMoral.GetBuffer(0) );
	int nStr = atoi( m_ComboStr.GetBuffer(0) );
	int nWis = atoi( m_ComboWis.GetBuffer(0) );
	int nWsps = atoi( m_ComboWsps.GetBuffer(0) );
	int nMovp = atoi( m_ComboMovp.GetBuffer(0) );
	int nResvPoint = m_dwReservedPoint;
	int nAll = nChar+nCon+nDex+nEndu+nInt+nLuck+nMoral+nStr+nWis+nWsps+nMovp+nResvPoint;
//UpdateData( TRUE);
	m_szAllAbility.Format( "%d" , nAll );
	UpdateData( FALSE);
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?