Code: Select all
//0.3-> hotkeys by Cleroth
void CGame::ReadSettings()
{
m_sMagicShortCut = -1;
m_sRecentShortCut = -1;
for( int i=0; i<13; i++ ) m_sShortCut[i] = -1;
HKEY key;
DWORD dwDisp;
UINT Result;
DWORD Size = sizeof(LONG);
if( RegCreateKeyEx( HKEY_CURRENT_USER, "Software\\Siementech\\Helbreath\\Settings", 0, NULL, REG_OPTION_NON_VOLATILE,
KEY_ALL_ACCESS, NULL, &key, &dwDisp ) != ERROR_SUCCESS ) return;
if( RegQueryValueEx(key, "Magic", 0, NULL, (LPBYTE)&Result, &Size) != ERROR_SUCCESS )
{
RegCloseKey(key);
return;
}
if( Result > 0 && Result < 101 ) m_sMagicShortCut = Result - 1;
else m_sMagicShortCut = -1;
if( RegQueryValueEx(key, "ShortCut0", 0, NULL, (LPBYTE)&Result, &Size) != ERROR_SUCCESS )
{
RegCloseKey(key);
return;
}
if( Result > 0 && Result < 201 ) m_sShortCut[0] = Result - 1;
else m_sShortCut[0] = -1;
if( RegQueryValueEx(key, "ShortCut1", 0, NULL, (LPBYTE)&Result, &Size) != ERROR_SUCCESS )
{
RegCloseKey(key);
return;
}
if( Result > 0 && Result < 201 ) m_sShortCut[1] = Result - 1;
else m_sShortCut[1] = -1;
if( RegQueryValueEx(key, "ShortCut2", 0, NULL, (LPBYTE)&Result, &Size) != ERROR_SUCCESS )
{
RegCloseKey(key);
return;
}
if( Result > 0 && Result < 201 ) m_sShortCut[2] = Result - 1;
else m_sShortCut[2] = -1;
if( RegQueryValueEx(key, "ShortCut3", 0, NULL, (LPBYTE)&Result, &Size) != ERROR_SUCCESS )
{
RegCloseKey(key);
return;
}
if( Result > 0 && Result < 201 ) m_sShortCut[3] = Result - 1;
else m_sShortCut[3] = -1;
if( RegQueryValueEx(key, "ShortCut4", 0, NULL, (LPBYTE)&Result, &Size) != ERROR_SUCCESS )
{
RegCloseKey(key);
return;
}
if( Result > 0 && Result < 201 ) m_sShortCut[4] = Result - 1;
else m_sShortCut[4] = -1;
if( RegQueryValueEx(key, "ShortCut5", 0, NULL, (LPBYTE)&Result, &Size) != ERROR_SUCCESS )
{
RegCloseKey(key);
return;
}
if( Result > 0 && Result < 201 ) m_sShortCut[5] = Result - 1;
else m_sShortCut[5] = -1;
if( RegQueryValueEx(key, "ShortCut6", 0, NULL, (LPBYTE)&Result, &Size) != ERROR_SUCCESS )
{
RegCloseKey(key);
return;
}
if( Result > 0 && Result < 201 ) m_sShortCut[6] = Result - 1;
else m_sShortCut[6] = -1;
if( RegQueryValueEx(key, "ShortCut7", 0, NULL, (LPBYTE)&Result, &Size) != ERROR_SUCCESS )
{
RegCloseKey(key);
return;
}
if( Result > 0 && Result < 201 ) m_sShortCut[7] = Result - 1;
else m_sShortCut[7] = -1;
if( RegQueryValueEx(key, "ShortCut8", 0, NULL, (LPBYTE)&Result, &Size) != ERROR_SUCCESS )
{
RegCloseKey(key);
return;
}
if( Result > 0 && Result < 201 ) m_sShortCut[8] = Result - 1;
else m_sShortCut[8] = -1;
if( RegQueryValueEx(key, "ShortCut9", 0, NULL, (LPBYTE)&Result, &Size) != ERROR_SUCCESS )
{
RegCloseKey(key);
return;
}
if( Result > 0 && Result < 201 ) m_sShortCut[9] = Result - 1;
else m_sShortCut[9] = -1;
if( RegQueryValueEx(key, "ShortCut10", 0, NULL, (LPBYTE)&Result, &Size) != ERROR_SUCCESS )
{
RegCloseKey(key);
return;
}
if( Result > 0 && Result < 201 ) m_sShortCut[10] = Result - 1;
else m_sShortCut[10] = -1;
if( RegQueryValueEx(key, "ShortCut11", 0, NULL, (LPBYTE)&Result, &Size) != ERROR_SUCCESS )
{
RegCloseKey(key);
return;
}
if( Result > 0 && Result < 201 ) m_sShortCut[11] = Result - 1;
else m_sShortCut[11] = -1;
if( RegQueryValueEx(key, "ShortCut12", 0, NULL, (LPBYTE)&Result, &Size) != ERROR_SUCCESS )
{
RegCloseKey(key);
return;
}
if( Result > 0 && Result < 201 ) m_sShortCut[12] = Result - 1;
else m_sShortCut[12] = -1;
RegCloseKey(key);
}
Code: Select all
void CGame::WriteSettings()
{
HKEY key;
DWORD dwDisp;
UINT nData;
if( RegCreateKeyEx( HKEY_CURRENT_USER, "Software\\Siementech\\Helbreath\\Settings", 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &key, &dwDisp ) != ERROR_SUCCESS ) return;
if( m_sMagicShortCut >= 0 && m_sMagicShortCut < 100 ) nData = m_sMagicShortCut + 1;
else nData = 0;
if( RegSetValueEx(key, "Magic", 0, REG_DWORD, (LPBYTE)&nData, sizeof(UINT) ) != ERROR_SUCCESS )
{
RegCloseKey(key);
return;
}
if( m_sShortCut[0] >= 0 && m_sShortCut[0] < 200 ) nData = m_sShortCut[0] + 1;
else nData = 0;
if( RegSetValueEx(key, "ShortCut0", 0, REG_DWORD, (LPBYTE)&nData, sizeof(UINT) ) != ERROR_SUCCESS )
{
RegCloseKey(key);
return;
}
if( m_sShortCut[1] >= 0 && m_sShortCut[1] < 200 ) nData = m_sShortCut[1] + 1;
else nData = 0;
if( RegSetValueEx(key, "ShortCut1", 0, REG_DWORD, (LPBYTE)&nData, sizeof(UINT) ) != ERROR_SUCCESS )
{
RegCloseKey(key);
return;
}
if( m_sShortCut[2] >= 0 && m_sShortCut[2] < 200 ) nData = m_sShortCut[2] + 1;
else nData = 0;
if( RegSetValueEx(key, "ShortCut2", 0, REG_DWORD, (LPBYTE)&nData, sizeof(UINT) ) != ERROR_SUCCESS )
{
RegCloseKey(key);
return;
}
if( m_sShortCut[3] >= 0 && m_sShortCut[3] < 200 ) nData = m_sShortCut[3] + 1;
else nData = 0;
if( RegSetValueEx(key, "ShortCut3", 0, REG_DWORD, (LPBYTE)&nData, sizeof(UINT) ) != ERROR_SUCCESS )
{
RegCloseKey(key);
return;
}
if( m_sShortCut[4] >= 0 && m_sShortCut[4] < 200 ) nData = m_sShortCut[4] + 1;
else nData = 0;
if( RegSetValueEx(key, "ShortCut4", 0, REG_DWORD, (LPBYTE)&nData, sizeof(UINT) ) != ERROR_SUCCESS )
{
RegCloseKey(key);
return;
}
if( m_sShortCut[5] >= 0 && m_sShortCut[5] < 200 ) nData = m_sShortCut[5] + 1;
else nData = 0;
if( RegSetValueEx(key, "ShortCut5", 0, REG_DWORD, (LPBYTE)&nData, sizeof(UINT) ) != ERROR_SUCCESS )
{
RegCloseKey(key);
return;
}
if( m_sShortCut[6] >= 0 && m_sShortCut[6] < 200 ) nData = m_sShortCut[6] + 1;
else nData = 0;
if( RegSetValueEx(key, "ShortCut6", 0, REG_DWORD, (LPBYTE)&nData, sizeof(UINT) ) != ERROR_SUCCESS )
{
RegCloseKey(key);
return;
}
if( m_sShortCut[7] >= 0 && m_sShortCut[7] < 200 ) nData = m_sShortCut[7] + 1;
else nData = 0;
if( RegSetValueEx(key, "ShortCut7", 0, REG_DWORD, (LPBYTE)&nData, sizeof(UINT) ) != ERROR_SUCCESS )
{
RegCloseKey(key);
return;
}
if( m_sShortCut[8] >= 0 && m_sShortCut[8] < 200 ) nData = m_sShortCut[8] + 1;
else nData = 0;
if( RegSetValueEx(key, "ShortCut8", 0, REG_DWORD, (LPBYTE)&nData, sizeof(UINT) ) != ERROR_SUCCESS )
{
RegCloseKey(key);
return;
}
if( m_sShortCut[9] >= 0 && m_sShortCut[9] < 200 ) nData = m_sShortCut[9] + 1;
else nData = 0;
if( RegSetValueEx(key, "ShortCut9", 0, REG_DWORD, (LPBYTE)&nData, sizeof(UINT) ) != ERROR_SUCCESS )
{
RegCloseKey(key);
return;
}
if( m_sShortCut[10] >= 0 && m_sShortCut[10] < 200 ) nData = m_sShortCut[10] + 1;
else nData = 0;
if( RegSetValueEx(key, "ShortCut10", 0, REG_DWORD, (LPBYTE)&nData, sizeof(UINT) ) != ERROR_SUCCESS )
{
RegCloseKey(key);
return;
}
if( m_sShortCut[11] >= 0 && m_sShortCut[11] < 200 ) nData = m_sShortCut[11] + 1;
else nData = 0;
if( RegSetValueEx(key, "ShortCut11", 0, REG_DWORD, (LPBYTE)&nData, sizeof(UINT) ) != ERROR_SUCCESS )
{
RegCloseKey(key);
return;
}
if( m_sShortCut[12] >= 0 && m_sShortCut[12] < 200 ) nData = m_sShortCut[12] + 1;
else nData = 0;
if( RegSetValueEx(key, "ShortCut12", 0, REG_DWORD, (LPBYTE)&nData, sizeof(UINT) ) != ERROR_SUCCESS )
{
RegCloseKey(key);
return;
}
RegCloseKey(key);
}
Code: Select all
//0.3-> hotkeys by Cleroth
void CGame::LoadHotkeys(char * cFile){
char cTmp[120];
int * iKey;
char iKey2[20];
iKey = new int;
ZeroMemory(iKey2, sizeof(iKey2));
for(*iKey='A';*iKey <= 90;*iKey+=1){
GetPrivateProfileString("HOTKEYS",(char*)iKey,NULL,cTmp,120,cFile);
memcpy( cConfigHotkeys[(*iKey)], cTmp, strlen(cTmp));
}
for(*iKey=VK_F1;*iKey <= VK_F12;*iKey+=1){
switch(*iKey){
case VK_F1:
memcpy(iKey2,"F1",2);
break;
case VK_F2:
memcpy(iKey2,"F2",2);
break;
case VK_F3:
memcpy(iKey2,"F3",2);
break;
case VK_F4:
memcpy(iKey2,"F4",2);
break;
case VK_F5:
memcpy(iKey2,"F5",2);
break;
case VK_F6:
memcpy(iKey2,"F6",2);
break;
case VK_F7:
memcpy(iKey2,"F7",2);
break;
case VK_F8:
memcpy(iKey2,"F8",2);
break;
case VK_F9:
memcpy(iKey2,"F9",2);
break;
case VK_F10:
memcpy(iKey2,"F10",3);
break;
case VK_F11:
memcpy(iKey2,"F11",3);
break;
case VK_F12:
memcpy(iKey2,"F12",3);
break;
}
GetPrivateProfileString("HOTKEYS",iKey2,NULL,cTmp,120,cFile);
memcpy( cConfigHotkeys[(*iKey)], cTmp, strlen(cTmp));
}
GetPrivateProfileString("HOTKEYS","Insert",NULL,cTmp,120,cFile);
memcpy( cConfigHotkeys[VK_INSERT], cTmp, strlen(cTmp));
GetPrivateProfileString("HOTKEYS","Delete",NULL,cTmp,120,cFile);
memcpy( cConfigHotkeys[VK_DELETE], cTmp, strlen(cTmp));
GetPrivateProfileString("HOTKEYS","Home",NULL,cTmp,120,cFile);
memcpy( cConfigHotkeys[VK_HOME], cTmp, strlen(cTmp));
GetPrivateProfileString("HOTKEYS","End",NULL,cTmp,120,cFile);
memcpy( cConfigHotkeys[VK_END], cTmp, strlen(cTmp));
GetPrivateProfileString("HOTKEYS","PageUp",NULL,cTmp,120,cFile);
memcpy( cConfigHotkeys[VK_PRIOR], cTmp, strlen(cTmp));
GetPrivateProfileString("HOTKEYS","PageDown",NULL,cTmp,120,cFile);
memcpy( cConfigHotkeys[VK_NEXT], cTmp, strlen(cTmp));
}
Code: Select all
//0.3-> hotkeys by Cleroth
void CGame::HandleScript(WORD wKey){
int i=0;
DWORD dwTime = timeGetTime();
if(wKey >= 65 && wKey <= 90)
if( m_bCtrlPressed == FALSE )
return;
if( cConfigHotkeys[wKey][0] == '/'){
if( m_cGameMode == DEF_GAMEMODE_ONMAINGAME ) {
ZeroMemory(m_cChatMsg, sizeof(m_cChatMsg) );
strcpy(m_cChatMsg, cConfigHotkeys[wKey]);
strcat(m_cChatMsg," ");
StartInputString(10, 414, sizeof(m_cChatMsg), m_cChatMsg);
}
return;
}
if(memcmp( cConfigHotkeys[wKey], "autoattack",10) == 0){
if (m_cGameMode == DEF_GAMEMODE_ONMAINGAME && (!m_bInputStatus) )
{
if( m_bForceAttack )
{
m_bForceAttack = FALSE;
AddEventList( DEF_MSG_FORCEATTACK_OFF, 10 );
}
else
{
m_bForceAttack = TRUE;
AddEventList( DEF_MSG_FORCEATTACK_ON, 10 );
}
}
return;
}
if(memcmp( cConfigHotkeys[wKey], "detail",6) == 0){
if (m_cGameMode == DEF_GAMEMODE_ONMAINGAME && (!m_bInputStatus) ) {
m_cDetailLevel++;
if( m_cDetailLevel > 2 ) m_cDetailLevel = 0;
switch( m_cDetailLevel )
{
case 0:
AddEventList( NOTIFY_MSG_DETAIL_LEVEL_LOW, 10 );
break;
case 1:
AddEventList( NOTIFY_MSG_DETAIL_LEVEL_MEDIUM, 10 );
break;
case 2:
AddEventList( NOTIFY_MSG_DETAIL_LEVEL_HIGH, 10 );
break;
}
}
return;
}
if(memcmp( cConfigHotkeys[wKey], "map",3) == 0){
if( m_cGameMode == DEF_GAMEMODE_ONMAINGAME )
{
if( m_bCtrlPressed )
{
if( m_bIsDialogEnabled[9] == TRUE ) DisableDialogBox(9);
else EnableDialogBox(9, 0, 0, 0, NULL);
}
}
return;
}
if(memcmp( cConfigHotkeys[wKey], "walkrun",7) == 0){
if (m_cGameMode == DEF_GAMEMODE_ONMAINGAME && (!m_bInputStatus) )
{
if( m_bRunningMode ) {
m_bRunningMode = FALSE;
AddEventList( NOTIFY_MSG_CONVERT_WALKING_MODE, 10 );
}
else {
m_bRunningMode = TRUE;
AddEventList( NOTIFY_MSG_CONVERT_RUNNING_MODE, 10 );
}
}
return;
}
if(memcmp( cConfigHotkeys[wKey], "music",5) == 0){
if (m_cGameMode == DEF_GAMEMODE_ONMAINGAME && (!m_bInputStatus) )
{
if (m_bMusicStat == TRUE) {
// Music Off
m_bMusicStat = FALSE;
if (m_bSoundFlag) {
if (m_pBGM != NULL) {
m_pBGM->bStop();
delete m_pBGM;
m_pBGM = NULL;
}
}
AddEventList( NOTIFY_MSG_MUSIC_OFF, 10 );
return;
}
else if( m_bSoundStat == TRUE ) {
m_pESound[38]->bStop();
m_bSoundStat = FALSE;
AddEventList( NOTIFY_MSG_SOUND_OFF, 10 );
return;
}
else {
// Music On
if( m_bSoundFlag ) {
m_bMusicStat = TRUE;
AddEventList( NOTIFY_MSG_MUSIC_ON, 10 );
}
if( m_bSoundFlag ) {
m_bSoundStat = TRUE;
AddEventList( NOTIFY_MSG_SOUND_ON, 10 );
}
StartBGM();
}
}
return;
}
if(memcmp( cConfigHotkeys[wKey], "to",2) == 0){
if (m_cGameMode == DEF_GAMEMODE_ONMAINGAME && (!m_bInputStatus) )
{
char tempid[100], cLB, cRB;
short sX, sY, msX, msY, msZ;
sX = m_stDialogBoxInfo[10].sX;
sY = m_stDialogBoxInfo[10].sY;
ZeroMemory( tempid, sizeof( tempid ) );
m_DInput.UpdateMouseState(&msX, &msY, &msZ, &cLB, &cRB);
if( m_bIsDialogEnabled[10] == TRUE && (msX >= sX + 20) && (msX <= sX + 360) && (msY >= sY + 35) && (msY <= sY + 139) )
{
CStrTok *pStrTok;
char * token, cBuff[64];
char seps[] = ":";
int i = (139-msY+sY)/13;
if( m_pChatScrollList[i + m_stDialogBoxInfo[10].sView] == NULL ) return;
if( m_pChatScrollList[i + m_stDialogBoxInfo[10].sView]->m_pMsg[0] == ' ' ) i++;
strcpy(cBuff, m_pChatScrollList[i + m_stDialogBoxInfo[10].sView]->m_pMsg);
pStrTok = new class CStrTok(cBuff, seps);
token = pStrTok->pGet();
wsprintf( tempid, "/to %s", token );
bSendCommand(MSGID_COMMAND_CHATMSG, NULL, NULL, NULL, NULL, NULL, tempid);
delete pStrTok;
}
else if( _tmp_sOwnerType < 7 && (strlen(_tmp_cName)>0) && (m_iIlusionOwnerH==NULL) && ((m_bIsCrusadeMode == FALSE) || _iGetFOE
(_tmp_iStatus) >= 0))
{
wsprintf( tempid, "/to %s", _tmp_cName );
bSendCommand(MSGID_COMMAND_CHATMSG, NULL, NULL, NULL, NULL, NULL, tempid);
}
else
{
EndInputString();
wsprintf( m_cChatMsg, "/to " );
StartInputString(10, 414, sizeof(m_cChatMsg), m_cChatMsg);
}
}
return;
}
if(memcmp( cConfigHotkeys[wKey], "spell",5) == 0){
char * cTemp;
cTemp = cConfigHotkeys[wKey];
cTemp += 5;
UseShortCut( atoi(cTemp) );
return;
}
if(memcmp( cConfigHotkeys[wKey], "lastspell",9) == 0){
if(m_cGameMode != DEF_GAMEMODE_ONMAINGAME) return;
UseMagic(m_sMagicShortCut);
return;
}
if(memcmp( cConfigHotkeys[wKey], "help",4) == 0){
if (m_bInputStatus) return;
if (m_bIsDialogEnabled[35] == FALSE)
EnableDialogBox(35, NULL, NULL, NULL);
else
{
DisableDialogBox(35);
DisableDialogBox(18);
}
}
if(memcmp( cConfigHotkeys[wKey], "charinfo",8) == 0){
if (m_bIsDialogEnabled[1] == FALSE)
EnableDialogBox(1, NULL, NULL, NULL);
else DisableDialogBox(1);
return;
}
if(memcmp( cConfigHotkeys[wKey], "inventory",9) == 0){
if (m_bIsDialogEnabled[2] == FALSE)
EnableDialogBox(2, NULL, NULL, NULL);
else DisableDialogBox(2);
return;
}
if(memcmp( cConfigHotkeys[wKey], "magiccircle",11) == 0){
if (m_bIsDialogEnabled[3] == FALSE)
EnableDialogBox(3, NULL, NULL, NULL);
else DisableDialogBox(3);
return;
}
if(memcmp( cConfigHotkeys[wKey], "skillinfo",9) == 0){
if (m_bIsDialogEnabled[15] == FALSE)
EnableDialogBox(15, NULL, NULL, NULL);
else DisableDialogBox(15);
return;
}
if(memcmp( cConfigHotkeys[wKey], "history",7) == 0){
if (m_bIsDialogEnabled[10] == FALSE)
EnableDialogBox(10, NULL, NULL, NULL);
else DisableDialogBox(10);
return;
}
if(memcmp( cConfigHotkeys[wKey], "dialogtrans",11) == 0){
m_bDialogTrans = !m_bDialogTrans;
return;
}
if(memcmp( cConfigHotkeys[wKey], "hppotion",8) == 0){
if (m_iHP <= 0) return;
if (m_bItemUsingStatus == TRUE) {
AddEventList(USE_RED_POTION1, 10);
return;
}
if (m_bIsDialogEnabled[27] == TRUE) {
AddEventList(USE_RED_POTION2, 10);
return;
}
for (i = 0; i < DEF_MAXITEMS; i++)
if ( (m_pItemList[i] != NULL) && (m_bIsItemDisabled[i] != TRUE) &&
(m_pItemList[i]->m_sSprite == 6) && (m_pItemList[i]->m_sSpriteFrame == 1)) {
bSendCommand(MSGID_COMMAND_COMMON, DEF_COMMONTYPE_REQ_USEITEM, NULL, i, NULL, NULL, NULL);
m_bIsItemDisabled[i] = TRUE;
m_bItemUsingStatus = TRUE;
return;
}
for (i = 0; i < DEF_MAXITEMS; i++)
if ( (m_pItemList[i] != NULL) && (m_bIsItemDisabled[i] != TRUE) &&
(m_pItemList[i]->m_sSprite == 6) && (m_pItemList[i]->m_sSpriteFrame == 2)) {
bSendCommand(MSGID_COMMAND_COMMON, DEF_COMMONTYPE_REQ_USEITEM, NULL, i, NULL, NULL, NULL);
m_bIsItemDisabled[i] = TRUE;
m_bItemUsingStatus = TRUE;
return;
}
return;
}
if(memcmp( cConfigHotkeys[wKey], "mppotion",8) == 0){
if (m_iHP <= 0) return;
if (m_bItemUsingStatus == TRUE) {
AddEventList(USE_BLUE_POTION1, 10);
return;
}
if (m_bIsDialogEnabled[27] == TRUE) {
AddEventList(USE_BLUE_POTION2, 10);
return;
}
for (i = 0; i < DEF_MAXITEMS; i++)
if ( (m_pItemList[i] != NULL) && (m_bIsItemDisabled[i] != TRUE) &&
(m_pItemList[i]->m_sSprite == 6) && (m_pItemList[i]->m_sSpriteFrame == 3)) {
bSendCommand(MSGID_COMMAND_COMMON, DEF_COMMONTYPE_REQ_USEITEM, NULL, i, NULL, NULL, NULL);
m_bIsItemDisabled[i] = TRUE;
m_bItemUsingStatus = TRUE;
return;
}
for (i = 0; i < DEF_MAXITEMS; i++)
if ( (m_pItemList[i] != NULL) && (m_bIsItemDisabled[i] != TRUE) &&
(m_pItemList[i]->m_sSprite == 6) && (m_pItemList[i]->m_sSpriteFrame == 4)) {
bSendCommand(MSGID_COMMAND_COMMON, DEF_COMMONTYPE_REQ_USEITEM, NULL, i, NULL, NULL, NULL);
m_bIsItemDisabled[i] = TRUE;
m_bItemUsingStatus = TRUE;
return;
}
return;
}
if(memcmp( cConfigHotkeys[wKey], "lastmsg",7) == 0){
if ( ((m_bIsDialogEnabled[7] == TRUE) && (m_stDialogBoxInfo[7].cMode == 1) && (iGetTopDialogBoxIndex() == 7)) ||
((m_bIsDialogEnabled[17] == TRUE) && (m_stDialogBoxInfo[17].cMode == 1) && (iGetTopDialogBoxIndex() == 17)) ) {
}
else if ((!m_bInputStatus) && (m_cBackupChatMsg[0] != '!') && (m_cBackupChatMsg[0] != '~') && (m_cBackupChatMsg[0] != '^') &&
(m_cBackupChatMsg[0] != '@')) {
ZeroMemory(m_cChatMsg, sizeof(m_cChatMsg));
strcpy(m_cChatMsg, m_cBackupChatMsg);
StartInputString(10, 414, sizeof(m_cChatMsg), m_cChatMsg);
}
return;
}
if(memcmp( cConfigHotkeys[wKey], "safeattack",10) == 0){
if (m_cGameMode == DEF_GAMEMODE_ONMAINGAME) {
bSendCommand(MSGID_COMMAND_COMMON, DEF_COMMONTYPE_TOGGLESAFEATTACKMODE, NULL, NULL, NULL, NULL, NULL);
}
return;
}
if(memcmp( cConfigHotkeys[wKey], "specialability",14) == 0){
if (m_cGameMode != DEF_GAMEMODE_ONMAINGAME) return;
if (m_bInputStatus) return;
if (m_bIsSpecialAbilityEnabled == TRUE) {
if (m_iSpecialAbilityType != 0) {
bSendCommand(MSGID_COMMAND_COMMON, DEF_COMMONTYPE_REQUEST_ACTIVATESPECABLTY, NULL, NULL, NULL, NULL, NULL);
m_bIsSpecialAbilityEnabled = FALSE;
}
else AddEventList(ON_KEY_UP26, 10);
}
else {
if (m_iSpecialAbilityType == 0) AddEventList(ON_KEY_UP26, 10);
else {
if ((m_sPlayerAppr4 & 0x00F0) != 0) {
AddEventList(ON_KEY_UP28, 10);
return;
}
i = (dwTime - m_dwSpecialAbilitySettingTime)/1000;
i = m_iSpecialAbilityTimeLeftSec - i;
if (i < 0) i = 0;
ZeroMemory(G_cTxt, sizeof(G_cTxt));
if (i < 60) {
switch (m_iSpecialAbilityType) {
case 1: wsprintf(G_cTxt, ON_KEY_UP29, i); break;
case 2: wsprintf(G_cTxt, ON_KEY_UP30, i); break;
case 3: wsprintf(G_cTxt, ON_KEY_UP31, i); break;
case 4: wsprintf(G_cTxt, ON_KEY_UP32, i); break;
case 5: wsprintf(G_cTxt, ON_KEY_UP33, i); break;
case 50:wsprintf(G_cTxt, ON_KEY_UP34, i); break;
case 51:wsprintf(G_cTxt, ON_KEY_UP35, i); break;
case 52:wsprintf(G_cTxt, ON_KEY_UP36, i); break;
}
}
else {
switch (m_iSpecialAbilityType) {
case 1: wsprintf(G_cTxt, ON_KEY_UP37, i/60); break;
case 2: wsprintf(G_cTxt, ON_KEY_UP38, i/60); break;
case 3: wsprintf(G_cTxt, ON_KEY_UP39, i/60); break;
case 4: wsprintf(G_cTxt, ON_KEY_UP40, i/60); break;
case 5: wsprintf(G_cTxt, ON_KEY_UP41, i/60); break;
case 50:wsprintf(G_cTxt, ON_KEY_UP42, i/60); break;
case 51:wsprintf(G_cTxt, ON_KEY_UP43, i/60); break;
case 52:wsprintf(G_cTxt, ON_KEY_UP44, i/60); break;
}
}
AddEventList(G_cTxt, 10);
}
}
return;
}
}
Code: Select all
void CGame::OnKeyUp(WPARAM wParam)
{
switch (wParam) {
case VK_SHIFT:
m_bShiftPressed = FALSE;
break;
case VK_CONTROL:
m_bCtrlPressed = FALSE;
break;
case 107: //'+'
if(m_bInputStatus == FALSE) m_bZoomMap = TRUE;
break;
case 109: //'-'
if(m_bInputStatus == FALSE) m_bZoomMap = FALSE;
break;
case VK_F12:
m_bEscPressed = TRUE;
if (m_cGameMode == DEF_GAMEMODE_ONMAINGAME)
{
if ((m_bIsObserverMode == TRUE) && (m_bShiftPressed)) { //ObserverMode Shift+ F12 ( not SHIFT+ESC )
// Log Out
if (m_cLogOutCount == -1) m_cLogOutCount = 1;
DisableDialogBox(19);
PlaySound('E', 14, 5);
}
else if(m_cLogOutCount != -1) {
if (m_bForceDisconn == FALSE) { //Esc
m_cLogOutCount = -1;
AddEventList(DLGBOX_CLICK_SYSMENU2, 10);
}
}
if (m_bIsGetPointingMode == TRUE) {
m_bIsGetPointingMode = FALSE;
AddEventList(COMMAND_PROCESSOR1, 10);
}
m_bIsF1HelpWindowEnabled = FALSE;
}
break;
case VK_ESCAPE:
if(m_bInputStatus) return;
if (m_bIsDialogEnabled[19] == FALSE)
EnableDialogBox(19, NULL, NULL, NULL);
else DisableDialogBox(19);
break;
case VK_UP:
m_cArrowPressed = 1;
if( m_cGameMode == DEF_GAMEMODE_ONMAINGAME )
{
int iTotalMsg=0;
for( int i=DEF_MAXWHISPERMSG-1; i>=0; i-- )
{
if( m_pWhisperMsg[i] != NULL )
{
iTotalMsg = i;
break;
}
}
m_cWhisperIndex ++;
if( m_cWhisperIndex > iTotalMsg ) m_cWhisperIndex = 0;
if( m_cWhisperIndex < 0 ) m_cWhisperIndex = iTotalMsg;
if( m_pWhisperMsg[m_cWhisperIndex] != NULL ) {
EndInputString();
wsprintf( m_cChatMsg, "/to %s", m_pWhisperMsg[m_cWhisperIndex]->m_pMsg );
StartInputString(10, 414, sizeof(m_cChatMsg), m_cChatMsg);
}
}
break;
case VK_RIGHT:
m_cArrowPressed = 2;
break;
case VK_DOWN:
m_cArrowPressed = 3;
if( m_cGameMode == DEF_GAMEMODE_ONMAINGAME )
{
int iTotalMsg=0;
for( int i=DEF_MAXWHISPERMSG-1; i>=0; i-- )
{
if( m_pWhisperMsg[i] != NULL )
{
iTotalMsg = i;
break;
}
}
m_cWhisperIndex --;
if( m_cWhisperIndex < 0 ) m_cWhisperIndex = iTotalMsg;
if( m_cWhisperIndex > iTotalMsg ) m_cWhisperIndex = 0;
if( m_pWhisperMsg[m_cWhisperIndex] != NULL ) {
EndInputString();
wsprintf( m_cChatMsg, "/to %s", m_pWhisperMsg[m_cWhisperIndex]->m_pMsg );
StartInputString(10, 414, sizeof(m_cChatMsg), m_cChatMsg);
}
}
break;
case VK_LEFT:
m_cArrowPressed = 4;
break;
case VK_SNAPSHOT:
CreateScreenShot();
break;
case VK_TAB:
if( m_bShiftPressed )
{
m_cCurFocus--;
if( m_cCurFocus < 1 ) m_cCurFocus = m_cMaxFocus;
}
else
{
m_cCurFocus++;
if( m_cCurFocus > m_cMaxFocus) m_cCurFocus = 1;
}
if (m_cGameMode == DEF_GAMEMODE_ONMAINGAME) {
bSendCommand(MSGID_COMMAND_COMMON, DEF_COMMONTYPE_TOGGLECOMBATMODE, NULL, NULL, NULL, NULL, NULL);
}
break;
case VK_RETURN:
m_bEnterPressed = TRUE;
break;
}
// Cleroth - CTRL Hotkeys
HandleScript(wParam);
}
void CGame::OnKeyDown(WPARAM wParam)
{
switch (wParam) {
case VK_CONTROL:
m_bCtrlPressed = TRUE;
break;
case VK_SHIFT:
m_bShiftPressed = TRUE;
break;
case VK_INSERT:
case VK_DELETE:
case VK_TAB:
case VK_RETURN:
case VK_ESCAPE:
case VK_END:
case VK_HOME:
case VK_F1:
case VK_F2:
case VK_F3:
case VK_F4:
case VK_F5:
case VK_F6:
case VK_F7:
case VK_F8:
case VK_F9:
case VK_F10:
case VK_F11:
case VK_F12:
case VK_PRIOR: // Page-Up
case VK_NEXT: // Page-Down
case VK_LWIN:
case VK_RWIN:
case VK_MULTIPLY:
case VK_ADD: //'+'
case VK_SEPARATOR:
case VK_SUBTRACT: //'-'
case VK_DECIMAL:
case VK_DIVIDE:
case VK_NUMLOCK:
case VK_SCROLL:
break;
default:
if (m_cGameMode == DEF_GAMEMODE_ONMAINGAME) {
if (m_bCtrlPressed) {
switch (wParam) {
case 48: EnableDialogBox(3, NULL, NULL, NULL); m_stDialogBoxInfo[3].sView = 9; break; // 0
case 49: EnableDialogBox(3, NULL, NULL, NULL); m_stDialogBoxInfo[3].sView = 0; break; // 1
case 50: EnableDialogBox(3, NULL, NULL, NULL); m_stDialogBoxInfo[3].sView = 1; break; // 2
case 51: EnableDialogBox(3, NULL, NULL, NULL); m_stDialogBoxInfo[3].sView = 2; break; // 3
case 52: EnableDialogBox(3, NULL, NULL, NULL); m_stDialogBoxInfo[3].sView = 3; break; // 4
case 53: EnableDialogBox(3, NULL, NULL, NULL); m_stDialogBoxInfo[3].sView = 4; break; // 5
case 54: EnableDialogBox(3, NULL, NULL, NULL); m_stDialogBoxInfo[3].sView = 5; break; // 6
case 55: EnableDialogBox(3, NULL, NULL, NULL); m_stDialogBoxInfo[3].sView = 6; break; // 7
case 56: EnableDialogBox(3, NULL, NULL, NULL); m_stDialogBoxInfo[3].sView = 7; break; // 8
case 57: EnableDialogBox(3, NULL, NULL, NULL); m_stDialogBoxInfo[3].sView = 8; break; // 9
}
}
else if ((m_bInputStatus == FALSE) && (GetAsyncKeyState(VK_MENU)>>15 == FALSE)) {
StartInputString(10, 414, sizeof(m_cChatMsg), m_cChatMsg);
ClearInputString();
}
}
break;
}
}
Code: Select all
void CGame::UpdateScreen_OnLoading(bool bActive)
{
int i;
if( bActive ) UpdateScreen_OnLoading_Progress();
switch( m_cLoading )
{
case 0:
{
ZeroMemory(cIni, sizeof(cIni) );
ZeroMemory(cConfigHotkeys, sizeof(cConfigHotkeys) );
GetCurrentDirectory(1000, cIni);
strcat(cIni,"\\config.ini");
LoadHotkeys(cIni);
Code: Select all
char cConfigHotkeys[140][50];
char cIni[1000];
void LoadHotkeys(char * cFile);
void HandleScript(WORD wKey);
Code: Select all
void CGame::EraseItem(char cItemID)
{
int i;
char cStr1[64], cStr2[64], cStr3[64];
ZeroMemory(cStr1, sizeof(cStr1));
ZeroMemory(cStr2, sizeof(cStr2));
ZeroMemory(cStr3, sizeof(cStr3));
// Cleroth - hotkeys
for( i=0; i<13; i++ ){
if (m_sShortCut[i] == cItemID) {
GetItemName(m_pItemList[cItemID], cStr1, cStr2, cStr3);
sprintf(G_cTxt, ERASE_ITEM, cStr1, cStr2, cStr3, i);
AddEventList(G_cTxt, 10);
m_sShortCut[i] = -1;
}
}
if (cItemID == m_sRecentShortCut)
m_sRecentShortCut = -1;
for (i = 0; i < DEF_MAXITEMS; i++)
if (m_cItemOrder[i] == cItemID)
m_cItemOrder[i] = -1;
for (i = 1; i < DEF_MAXITEMS; i++)
if ((m_cItemOrder[i-1] == -1) && (m_cItemOrder[i] != -1)) {
m_cItemOrder[i-1] = m_cItemOrder[i];
m_cItemOrder[i] = -1;
}
delete m_pItemList[cItemID];
m_pItemList[cItemID] = NULL;
m_bIsItemEquipped[cItemID] = FALSE;
m_bIsItemDisabled[cItemID] = FALSE;
}
Create a config.ini file in the Client directory.
For a classic hotkey configuration (for letters, you still have to press CTRL+LETTER):
Code: Select all
[HOTKEYS]
A=autoattack
B=
C=
D=detail
E=
F=
G=
H=
I=
J=
K=
L=
M=map
N=
O=
P=
Q=hppotion
R=walkrun
S=music
T=to
U=
V=
W=
X=
Y=
Z=
F1=help
F2=spell02
F3=spell03
F4=lastspell
F5=charinfo
F6=inventory
F7=magiccircle
F8=skillinfo
F9=history
F10=
F11=dialogtrans
F12=
Insert=hppotion
Delete=mppotion
End=lastmsg
Home=safeattack
PageUp=specialability
PageDown=
For hotkeys with spells on 0-9 and F1-F12 and other modified shits:
Code: Select all
[HOTKEYS]
A=charinfo
B=music
C=detail
D=magiccircle
E=/tp
F=skillinfo
G=history
H=dialogtrans
I=
J=help
K=
L=
M=
N=to
O=
P=
Q=hppotion
R=/summon
S=inventory
T=/enableadmincommand
U=
V=map
W=mppotion
X=walkrun
Y=/enableadmincreateitem
Z=autoattack
F1=spell01
F2=spell02
F3=spell03
F4=spell04
F5=spell05
F6=spell06
F7=spell07
F8=spell08
F9=spell09
F10=spell10
F11=spell11
F12=spell12
Insert=specialability
Delete=safeattack
End=lastmsg
Home=lastspell
PageUp=
PageDown=
0=spell10
1=spell01
2=spell02
3=spell03
4=spell04
5=spell05
6=spell06
7=spell07
8=spell08
9=spell09