⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dlgmain1.cpp

📁 网络游戏魔域源代码 测试可以完整变异
💻 CPP
📖 第 1 页 / 共 5 页
字号:
		}

		WritePrivateProfileString ( strAppName, "TalkListRecord", strRecord, m_strOwnerIni ) ;
	}
	else
		WritePrivateProfileString ( strAppName, "TalkListRecord", "", m_strOwnerIni ) ;
	// End write the talklistrecord to the ini file

	int ChannelOpen[5];
	ChannelOpen[0] = (int)m_DlgSetup.m_DlgSChat.m_ChkBan.GetCheckValue();		
	ChannelOpen[1] = (int)m_DlgSetup.m_DlgSChat.m_ChkFriend.GetCheckValue();		
	ChannelOpen[2] = (int)m_DlgSetup.m_DlgSChat.m_ChkPub.GetCheckValue();		
	ChannelOpen[3] = (int)m_DlgSetup.m_DlgSChat.m_ChkSec.GetCheckValue();		
	ChannelOpen[4] = (int)m_DlgSetup.m_DlgSChat.m_ChkTeam.GetCheckValue();
	
	sprintf(strInt,"%d|%d|%d|%d|%d",ChannelOpen[0],ChannelOpen[1],ChannelOpen[2],ChannelOpen[3],ChannelOpen[4]);

	WritePrivateProfileString(strAppName,"TalkChannelRecord",strInt,m_strOwnerIni);
	/*	char strInt[8] ;
	int nValue = m_DlgSetup.m_SetupSliMusic.GetSliderValue () ;

	// write record
	itoa ( nValue, strInt, 10 ) ;
	WritePrivateProfileString( strAppName, "MusicRecord", strInt, m_strOwnerIni ) ;

	nValue = m_DlgSetup.m_SetupSliEffect.GetSliderValue () ;
	// write record
	itoa ( nValue, strInt, 10 ) ;
	WritePrivateProfileString( strAppName, "EffectRecord", strInt, m_strOwnerIni ) ;

	// write the Faction word record
	nValue = 0;
	char strText [256] ;
	strcpy ( strText, g_objHero.GetSyndicateAnnounce () ) ;
	if ( strcmp ( strText, "NULL" ) && strText[0] != '\0' )
	{
		for ( i = 0; i < strlen ( strText ); i++ )
			nValue += abs ( strText[i] ) ;
		itoa ( nValue, strInt, 10 ) ;
		WritePrivateProfileString ( strAppName, "FacWordRecord", strInt, m_strOwnerIni ) ;
	}

	// write the shift record
	itoa ( m_DlgSetup.m_SetupChkNameopen.GetCheckValue (), strInt, 10 ) ;
	WritePrivateProfileString ( strAppName, "ShiftRecord", strInt, m_strOwnerIni ) ;


	// write the interface mode record
	itoa ( m_DlgSetup.m_nInterface, strInt, 10 ) ;
	WritePrivateProfileString ( "Interface", "InterfaceRecord", strInt, g_strSetupIni ) ;*/

	m_bReacord = true;
}

void CDlgMain::SetRecord( const char* strIniFile )
{
	if ( strIniFile != NULL )
		strcpy ( m_strOwnerIni, strIniFile ) ;
	else
		return ;

	char strAppName[32] ;
	sprintf ( strAppName, "%sRecord", g_objHero.GetName () ) ;

	// begin test the account name
	char* pstrTemp = strchr ( strAppName, '[' ) ;
	if ( pstrTemp != NULL )
	{
		strncpy ( pstrTemp, "(", 1 ) ;
		pstrTemp = NULL ;
	}
	pstrTemp = strchr ( strAppName, ']' ) ;
	if ( pstrTemp != NULL )
	{
		strncpy ( pstrTemp, ")", 1 ) ;
		pstrTemp = NULL ;
	}
	// end test the account name
	
	// the user already have record read the record and set
	int nReturn = GetPrivateProfileInt ( strAppName, "RecordAmount", -1, m_strOwnerIni ) ;
	if ( nReturn != -1 )
	{
		// set the music and effect
		int nMusic = GetPrivateProfileInt ( strAppName, "MusicRecord", -1, m_strOwnerIni ) ;
		if ( nMusic != -1 )
		{
			m_DlgSetup.m_DlgMusic.m_SliderMusic.SetSliderValue ( nMusic /10) ;
			if (nMusic%10 == 1)
			{
				m_DlgSetup.m_DlgMusic.m_MusicChk.SetCheckValue(1);
				m_DlgSetup.m_DlgMusic.m_SliderMusic.EnableWindow();
				m_DlgSetup.m_DlgMusic.m_MusicLeftBtn.EnableWindow ();
				m_DlgSetup.m_DlgMusic.m_MusicRightBtn.EnableWindow ();				
				DXSetMusicVolume ( nMusic/10 ) ;
				g_objHero.SetMusicVolume(nMusic/10);				
			}
			else 
			{
				m_DlgSetup.m_DlgMusic.m_MusicChk.SetCheckValue(0);
				m_DlgSetup.m_DlgMusic.m_SliderMusic.EnableWindow(false);
				m_DlgSetup.m_DlgMusic.m_MusicLeftBtn.EnableWindow (false);
				m_DlgSetup.m_DlgMusic.m_MusicRightBtn.EnableWindow (false);				
				DXSetMusicVolume ( 0 ) ;
				g_objHero.SetMusicVolume(0);				
			}
		}
		else
		{
			m_DlgSetup.m_DlgMusic.m_SliderMusic.EnableWindow();
			m_DlgSetup.m_DlgMusic.m_MusicLeftBtn.EnableWindow ();
			m_DlgSetup.m_DlgMusic.m_MusicRightBtn.EnableWindow ();				
			m_DlgSetup.m_DlgMusic.m_SliderMusic.SetSliderValue ( 75 ) ;
			m_DlgSetup.m_DlgMusic.m_MusicChk.SetCheckValue(1);
			DXSetMusicVolume ( 75) ;
			g_objHero.SetMusicVolume(75);
		}
		nMusic = GetPrivateProfileInt ( strAppName, "EffectRecord", -1, m_strOwnerIni ) ;
		if ( nMusic != -1 )
		{
			m_DlgSetup.m_DlgMusic.m_SliderSound.SetSliderValue ( nMusic/10 ) ;
			if (nMusic%10 == 1)
			{
				m_DlgSetup.m_DlgMusic.m_SoundChk.SetCheckValue(1);
				m_DlgSetup.m_DlgMusic.m_SliderSound.EnableWindow();
				m_DlgSetup.m_DlgMusic.m_SoundLeftBtn.EnableWindow ();
				m_DlgSetup.m_DlgMusic.m_SoundRightBtn.EnableWindow ();
				DXSetSoundVolume ( nMusic/10 ) ;
			}
			else 
			{
				m_DlgSetup.m_DlgMusic.m_SoundChk.SetCheckValue(0);
				m_DlgSetup.m_DlgMusic.m_SliderSound.EnableWindow(false);
				m_DlgSetup.m_DlgMusic.m_SoundLeftBtn.EnableWindow (false);
				m_DlgSetup.m_DlgMusic.m_SoundRightBtn.EnableWindow (false);
				DXSetSoundVolume ( 0 ) ;
			}
		}
		else
		{
			m_DlgSetup.m_DlgMusic.m_SliderSound.EnableWindow();
			m_DlgSetup.m_DlgMusic.m_SoundLeftBtn.EnableWindow ();
			m_DlgSetup.m_DlgMusic.m_SoundRightBtn.EnableWindow ();				
			m_DlgSetup.m_DlgMusic.m_SliderSound.SetSliderValue ( 75 ) ;
			m_DlgSetup.m_DlgMusic.m_SoundChk.SetCheckValue(1);
			DXSetSoundVolume ( 75 ) ;
		}
		m_DlgSetup.m_DlgMusic.SetSliderStatic();
		
		// set the shadow record
		nReturn = GetPrivateProfileInt ( strAppName, "ShadowRecord", -1, m_strOwnerIni ) ;
		if ( nReturn != -1 )
		{
			CRole::s_nShadowType = nReturn ;
			if (nReturn == CRole::SHADOW_REAL) 
				m_DlgSetup.m_DlgGraph.m_ChkShadow.SetCheckValue(1);
			else if(nReturn == CRole::SHADOW_NONE)
				m_DlgSetup.m_DlgGraph.m_ChkShadow.SetCheckValue(0);
		}

		nReturn = GetPrivateProfileInt ( strAppName, "ShiftRecord", -1, m_strOwnerIni ) ;
		if ( nReturn != -1 )
		{
			CDlgMain::GetParent()->PostMessage( WM_MY_MESSAGE, ON_SETUP_SHIFT, nReturn) ;
			if (nReturn)
			{
				m_DlgSetup.m_DlgGraph.m_ChkRoleName.SetCheckValue(1);
			}
			else 
				m_DlgSetup.m_DlgGraph.m_ChkRoleName.SetCheckValue(0);			
		}
		else
			m_DlgSetup.m_DlgGraph.m_ChkRoleName.SetCheckValue(0);

		// set the chat color recrod
		char strColor[16] ;
		GetPrivateProfileString ( strAppName, "ChatColorRecord", "99999",strColor,16, m_strOwnerIni ) ;
		if ( strlen(strColor) >0 )
		{			
			int nTemp = 0;
			char strTemp[16]="";
			// Temp code
			nTemp = strColor[0] - 48;
			if (nTemp < 0 || nTemp >9)
				nTemp = 9;
			m_DlgSetup.m_DlgSChat.m_nColorLog [0] = nTemp ;
			g_objGameMsg.SetChannelColor ( _TXTATR_TALK, m_DlgSetup.m_DlgSChat.m_dwColor [nTemp] ) ;
			sprintf ( strTemp, "Image36%d", nTemp ) ;
			m_DlgSetup.m_DlgSChat.m_ImgPub.InsertImage ( strTemp ) ;

			nTemp = strColor[1] - 48;
			if (nTemp < 0 || nTemp >9)
				nTemp = 9;
			m_DlgSetup.m_DlgSChat.m_nColorLog [1] = nTemp ;
			g_objGameMsg.SetChannelColor ( _TXTATR_FRIEND, m_DlgSetup.m_DlgSChat.m_dwColor [nTemp] ) ;
			sprintf ( strTemp, "Image36%d", nTemp ) ;
			m_DlgSetup.m_DlgSChat.m_ImgFriend.InsertImage ( strTemp ) ;

			nTemp = strColor[2] - 48;
			if (nTemp < 0 || nTemp >9)
				nTemp = 9;
			m_DlgSetup.m_DlgSChat.m_nColorLog [2] = nTemp ;
			g_objGameMsg.SetChannelColor ( _TXTATR_SYNDICATE, m_DlgSetup.m_DlgSChat.m_dwColor [nTemp] ) ;
			sprintf ( strTemp, "Image36%d", nTemp ) ;
			m_DlgSetup.m_DlgSChat.m_ImgBan.InsertImage ( strTemp ) ;
			
			nTemp = strColor[3] - 48;
			if (nTemp < 0 || nTemp >9)
				nTemp = 9;
			m_DlgSetup.m_DlgSChat.m_nColorLog [3] = nTemp ;
			g_objGameMsg.SetChannelColor ( _TXTATR_TEAM, m_DlgSetup.m_DlgSChat.m_dwColor [nTemp] ) ;
			sprintf ( strTemp, "Image36%d", nTemp ) ;
			m_DlgSetup.m_DlgSChat.m_ImgTeam.InsertImage ( strTemp ) ;

			nTemp = strColor[4] - 48;
			if (nTemp < 0 || nTemp >9)
				nTemp = 9;
			m_DlgSetup.m_DlgSChat.m_nColorLog [4] = nTemp ;
			g_objGameMsg.SetChannelColor ( _TXTATR_PRIVATE, m_DlgSetup.m_DlgSChat.m_dwColor [nTemp] ) ;
			sprintf ( strTemp, "Image36%d", nTemp ) ;
			m_DlgSetup.m_DlgSChat.m_ImgSec.InsertImage ( strTemp ) ;
			
		}
		else
		{
			g_objGameMsg.SetChannelColor ( _TXTATR_TALK, m_DlgSetup.m_DlgSChat.m_dwColor [3] ) ;
			g_objGameMsg.SetChannelColor ( _TXTATR_FRIEND, m_DlgSetup.m_DlgSChat.m_dwColor [3] ) ;
			g_objGameMsg.SetChannelColor ( _TXTATR_SYNDICATE, m_DlgSetup.m_DlgSChat.m_dwColor [3] ) ;
			g_objGameMsg.SetChannelColor ( _TXTATR_TEAM, m_DlgSetup.m_DlgSChat.m_dwColor [3] ) ;
			g_objGameMsg.SetChannelColor ( _TXTATR_PRIVATE, m_DlgSetup.m_DlgSChat.m_dwColor [3] ) ;
		}
			
		/*
		// set the interface mode record
		nMode = GetPrivateProfileInt ( "Interface", "InterfaceRecord", -1, g_strSetupIni ) ;
		if ( nMode != -1 )
		{
			m_DlgSetup.m_nInterface = nMode ;
			char strTemp[32] ;
			sprintf ( strTemp, "Button101%d", nMode + 1 ) ;
			m_DlgSetup.m_SetupBtnMode.ChangeImage ( strTemp ) ;
			m_DlgSetup.OnSetupBtnMode () ;
		}*/

		// Set the pk mode
		g_objHero.SetPkMode ( PKMODE_MONSTERONLY ) ;
		
		// set the check record
		int nItemTypeID ;
		char strKeyName[16] ;
		// Set the Skill HotKey 
		for (int n = 1; n<= 8;n++)
		{
			sprintf(strKeyName,"SkillHotKeyF%d",n);
			m_DlgQuery.m_DlgSkill.m_DlgSkillHotKey.m_HotKeyIdType[n-1] = GetPrivateProfileInt( strAppName, strKeyName, -1, m_strOwnerIni) ;	
		}
		// set the quick item record
		m_DlgTalk.m_GoodBox.RemoveIcon(0,0,true);
		for ( int i = 1; i <= GRID_ICONQUICK_NUM; i++ )
		{
			sprintf ( strKeyName, "QItem%dRecord", i ) ;
			nItemTypeID = GetPrivateProfileInt ( strAppName, strKeyName, -1, m_strOwnerIni ) ;
			if ( nItemTypeID != -1 )
			{
				switch ( nItemTypeID % 10 )
				{
				case ICON_TYPE_QUSE:
					{
						bool bLoad = false;
						for ( int j = 0; j < g_objHero.GetItemAmount (); j++ )
						{
							CItem* pItem = g_objHero.GetItemByIndex ( j ) ;
							if ( pItem != NULL )
							{
								if ( pItem->GetTypeID () == nItemTypeID / 10 )
								{
									m_DlgTalk.m_GoodBox.InsertIcon( 1, i, nItemTypeID / 10, 0, ICON_TYPE_QUSE ) ;
									bLoad = true;
									break ;
								}
							}
						}
						if (!bLoad)
						{
							for ( int j = 0; j < g_objHero.GetItemAmount (PACKAGE_SOUL); j++ )
							{
								CItem* pItem = g_objHero.GetItemByIndex ( j,PACKAGE_SOUL ) ;
								if ( pItem != NULL )
								{
									if ( pItem->GetTypeID () == nItemTypeID / 10 )
									{
										m_DlgTalk.m_GoodBox.InsertIcon( 1, i, nItemTypeID / 10, 0, ICON_TYPE_QUSE ) ;
										bLoad = true;
										break ;
									}
								}
							}
						}
					}
					break ;
				}
			}
		}
		
		char strBlackName[7*17];
		GetPrivateProfileString ( strAppName, "BlackNameRecord", "", strBlackName, 7*17, m_strOwnerIni ) ;
		if (strBlackName[0]!=NULL)
		{
			char* pTemp ;
			char* pLast ;
			char strTemp[16] ;
			int nAmount = 0 ;
			pTemp = strchr ( strBlackName, '|' ) ; 
			strncpy ( strTemp, strBlackName, pTemp - strBlackName ) ;
			strTemp[pTemp - strBlackName] = NULL ;
			nAmount = atoi ( strTemp ) ;
			if (nAmount >0)
				g_objGameMsg.DestroyBlackName();
			for(int i=0;i<nAmount;i++)
			{
				pLast = pTemp + 1 ;
				pTemp = strchr ( pTemp + 1, '|' ) ;
				strncpy ( strTemp, pLast, pTemp - pLast ) ;
				strTemp[pTemp - pLast] = NULL ;
				g_objGameMsg.AddBlackName(strTemp);
			}
		}

		// set the talk list record
		char strRecord[17*18] ;
		GetPrivateProfileString ( strAppName, "TalkListRecord", "", strRecord, 17 * 18, m_strOwnerIni ) ;
		if ( strRecord[0] != NULL && m_DlgTalk.m_DlgListBox.m_ListBox.GetCount () == 0 )
		{
			char* pTemp ;
			char* pLast ;
			char strTemp[16] ;
			int nAmount = 0 ;
			pTemp = strchr ( strRecord, '|' ) ; 
			strncpy ( strTemp, strRecord, pTemp - strRecord ) ;
			strTemp[pTemp - strRecord] = NULL ;
			nAmount = atoi ( strTemp ) ;
			for ( int i = 0; i < __min(16, nAmount); i++ )
			{
				pLast = pTemp + 1 ;
				pTemp = strchr ( pTemp + 1, '|' ) ;
				strncpy ( strTemp, pLast, pTemp - pLast ) ;
				strTemp[pTemp - pLast] = NULL ;
				strcpy ( m_DlgTalk.m_strTargetName[m_DlgTalk.m_nTargetAmount++], strTemp ) ;					
				m_DlgTalk.m_DlgListBox.m_ListBox.AddString ( strTemp ) ;
			}
		}

		char strChannel[16];
		GetPrivateProfileString (strAppName,"TalkChannelRecord","",strChannel,16,m_strOwnerIni);
		if (strlen(strChannel)>0)
		{
			int bChannel[5]={0};
			int bReult = sscanf(strChannel,"%d|%d|%d|%d|%d",&bChannel[0],&bChannel[1],&bChannel[2],&bChannel[3],&bChannel[4]);

			m_DlgSetup.m_DlgSChat.m_ChkBan.SetCheckValue(bChannel[0]);
			g_objGameMsg.SetChannelStatus(_TXTATR_SYNDICATE,bChannel[0]);
			
			m_DlgSetup.m_DlgSChat.m_ChkFriend.SetCheckValue(bChannel[1]);
			g_objGameMsg.SetChannelStatus(_TXTATR_FRIEND,bChannel[1]);
			
			m_DlgSetup.m_DlgSChat.m_ChkPub.SetCheckValue(bChannel[2]);
			g_objGameMsg.SetChannelStatus(_TXTATR_TALK,bChannel[2]);

			m_DlgSetup.m_DlgSChat.m_ChkSec.SetCheckValue(bChannel[3]);
			g_objGameMsg.SetPrivateChannelStatusExceptFriend(bChannel[3]);

			m_DlgSetup.m_DlgSChat.m_ChkTeam.SetCheckValue(bChannel[4]);
			g_objGameMsg.SetChannelStatus(_TXTATR_TEAM,bChannel[4]);
		}

	}
	// the user has not record, write a empty record to the .ini file
	else
	{
		char strDir[128] ;
		strcpy( strDir, m_strOwnerIni ) ;
		char *pStrLast = strchr( m_strOwnerIni, '/' ) ;
		pStrLast = strchr( pStrLast + 1, '/' ) ;
		strDir[pStrLast - m_strOwnerIni] = '\0' ;
		::CreateDirectory( strDir, NULL ) ;

		strcpy( strDir, m_strOwnerIni ) ;
		pStrLast = strrchr( m_strOwnerIni, '/' ) ;
		strDir[pStrLast - m_strOwnerIni] = '\0' ;
		::CreateDirectory( strDir, NULL ) ;

		::WritePrivateProfileStruct( strAppName,
									 NULL,
									 NULL,
								     0,
								     m_strOwnerIni ) ;
		::WritePrivateProfileSection ( strAppName,
									   " RecordAmount=1\0 MusicRecord=\0 EffectRecord=\0 PkModeRecord=\0 RunModeRecord=\0 MapModeRecord=\0 TalkModeRecord=\0 QItem1Record=\0 QItem2Record=\0 QItem3Record=\0 QItem4Record=\0 QItem5Record=\0 QItem6Record=\0 QItem7Record=\0 QItem8Record=\0 QItem9Record=\0 QItem10Record=\0 SkillHotKeyF1=\0 SkillHotKeyF2=\0 SkillHotKeyF3=\0 SkillHotKeyF4=\0 SkillHotKeyF5=\0 SkillHotKeyF6=\0 SkillHotKeyF7=\0 SkillHotKeyF8=\0 TalkListRecord=\0 ShadowRecord=\0 LineRecord=\0 LogRecord=\0 FacWordRecord=\0 ShiftRecord=\0 ChatColorRecord=\0 ChatChannelRecord=\0",
									   m_strOwnerIni ) ;
		
		//设置默认声音大小
		m_DlgSetup.m_DlgMusic.m_SliderSound.SetSliderValue ( 75 ) ;
		m_DlgSetup.m_DlgMusic.m_SliderSound.EnableWindow();
		m_DlgSetup.m_DlgMusic.m_SoundLeftBtn.EnableWindow ();
		m_DlgSetup.m_DlgMusic.m_SoundRightBtn.EnableWindow ();				
		m_DlgSetup.m_DlgMusic.m_SoundChk.SetCheckValue(1);
		DXSetSoundVolume ( 75 ) ;
		m_DlgSetup.m_DlgMusic.m_SliderMusic.SetSliderValue ( 75 ) ;
		m_DlgSetup.m_DlgMusic.m_SliderMusic.EnableWindow();
		m_DlgSetup.m_DlgMusic.m_MusicLeftBtn.EnableWindow ();
		m_DlgSetup.m_DlgMusic.m_MusicRightBtn.EnableWindow ();				
		m_DlgSetup.m_DlgMusic.m_MusicChk.SetCheckValue(1);
		DXSetMusicVolume ( 75 ) ;
		g_objHero.SetMusicVolume(75);
		m_DlgSetup.m_DlgMusic.SetSliderStatic();
		
		g_objHero.SetPkMode ( PKMODE_MONSTERONLY ) ;
	}
}

void CDlgMain::OnXpFull()
{
	if (m_DlgXp.m_btBoothType)
		return;
	int nAmount = g_objHero.GetXpSkillAmount() ;
	if ( nAmount > 0 )
	{
		g_objGameMsg.AddMsg((char*)g_objGameDataSet.GetStr(10342));//您的XP技能已经满了,可以使用XP技能了。
		m_DlgXp.MoveWindow ( _SCR_WIDTH - nAmount * 50 - 55,
			_SCR_HEIGHT - 115,
			nAmount * 50,
			50 ) ;
		m_DlgXp.InitXpDialog ( ) ;
	}	
}

void CDlgMain::PlayXp()
{
	m_bXpAct = true ;
	m_dwLastXpTime = 0 ;
}

void CDlgMain::HeroDie()
{
	m_DlgMonster.ResetMonsterDlg();
	CRect rect;
	m_DlgXp.GetWindowRect(rect);
	m_DlgXp.MoveWindow ( _SCR_WIDTH  - 100,
						 _SCR_HEIGHT - 100,
						 rect.Width(),
						 rect.Height() ) ;	
	m_DlgXp.SetReborn (true) ;
}

void CDlgMain::HeroReborn()
{
	m_DlgXp.SetReborn (false) ;
}

void CDlgMain::OpenImprove(int nType)
{
	if (!m_DlgImprove.m_bShow) 
	{
		CloseCurDlg(1);
		m_uCurMDlgID = DLG_IMPROVE;
		m_DlgImprove.SetImproveType(nType);
		m_DlgImprove.EnableWindow(true);
			
		if(!m_DlgMpcGoods.m_bShow)

⌨️ 快捷键说明

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