Move git root from Client/ to src/ to track all source code: - Client: Game client source (moved to Client/Client/) - Server: Game server source - GameTools: Development tools - CryptoSource: Encryption utilities - database: Database scripts - Script: Game scripts - rylCoder_16.02.2008_src: Legacy coder tools - GMFont, Game: Additional resources 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
3115 lines
87 KiB
C++
3115 lines
87 KiB
C++
// ClientMain.cpp: implementation of the CClientMain class.
|
|
//
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
//#include <crtdbg.h>
|
|
#include "ClientMain.h"
|
|
#include "FrameTimer.h"
|
|
#include "HumanGUI.h"
|
|
#include "AkhanGUI.h"
|
|
#include "WinInput.h"
|
|
#include "GUITextEdit.h"
|
|
#include "GUIMessageBoxManager.h"
|
|
#include <windows.h>
|
|
#include <mmsystem.h>
|
|
#include "ExceptionReport.h"
|
|
#include "SoundManager.h"
|
|
#include "DirectSound.h"
|
|
#include "RenderOption.h"
|
|
#include "Crc32Static.h"
|
|
//effect °ü·Ã
|
|
#include "CEffscript.h"
|
|
#include "SceneManager.h"
|
|
|
|
#include "httpclient.h"
|
|
|
|
#include "Creature\NPC\NPCList.h"
|
|
#include "Item\ItemMgr.h"
|
|
#include "Skill\SkillMgr.h"
|
|
#include "Creature\Monster\MonsterMgr.h"
|
|
#include "StringFilter.h"
|
|
|
|
#define USE_ANTIHACK 0
|
|
#include "AntiHack.h"
|
|
|
|
DECLARE_ANTIHACK();
|
|
|
|
#include "Z3D_GLOBALS.h"
|
|
#include "Z3DGeneralChrModel.h"
|
|
#include "Z3DChrEventGenerator.h"
|
|
#include "Z3DManagedObject.h"
|
|
|
|
#include "resource.h"
|
|
#include "profile.h"
|
|
|
|
#include <SectorSoundMap.h>
|
|
//#include <SoundBuffer.h>
|
|
//#include <exception>
|
|
|
|
using namespace std;
|
|
|
|
CClientMain g_ClientMain;
|
|
CCharacterControl g_CharacterData;
|
|
|
|
char CClientMain::m_strSheet[MAX_PATH];
|
|
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
LONG WINAPI MyExceptionReport(HANDLE hFile)
|
|
{
|
|
g_CExceptionReport.Printf("TEST!! This is by user function..\r\n");
|
|
g_CExceptionReport.Printf("Argc: %d\r\n", __argc);
|
|
|
|
return 0;
|
|
}
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
unsigned long __stdcall WindowProc(HWND hWnd, unsigned uMsg, WPARAM wParam, LPARAM lParam)
|
|
{
|
|
return g_ClientMain.ClientProc(hWnd, uMsg, wParam, lParam);
|
|
}
|
|
|
|
BOOL WINAPI AntiFunc(HINSTANCE hInstance)
|
|
{
|
|
MSG msg;
|
|
msg.wParam = 0;
|
|
|
|
/*#ifdef _DEBUG
|
|
__try
|
|
#else
|
|
try
|
|
#endif*/
|
|
{
|
|
LANGID li;
|
|
li = GetUserDefaultLangID();
|
|
|
|
char *strCommandLine = GetCommandLine();
|
|
//MessageBox(NULL,strCommandLine,0,0);
|
|
HWND hLoginWnd = FindWindow(NULL, "Login");
|
|
//MessageBox(NULL,strCommandLine,0,0);
|
|
|
|
#ifdef NDEBUG
|
|
if(!hLoginWnd && !g_ClientMain.m_bAdminMode)
|
|
{
|
|
MessageBox(NULL, "Please execute login.exe", "Program Error", MB_OK);
|
|
return 0;
|
|
}/**/
|
|
#endif
|
|
|
|
if(hLoginWnd)
|
|
{
|
|
char *pLast = strCommandLine;
|
|
sscanf(pLast, "%s %d %d %d", g_ClientMain.m_strIP, &g_ClientMain.m_dwUserID,
|
|
&g_ClientMain.m_dwServerID, &g_ClientMain.m_dwSessionID);
|
|
} else
|
|
{
|
|
char *pLast = strrchr(strCommandLine, '"');
|
|
pLast += 2;
|
|
sscanf(pLast,"%s %d %d %d", g_ClientMain.m_strIP, &g_ClientMain.m_dwUserID,
|
|
&g_ClientMain.m_dwServerID, &g_ClientMain.m_dwSessionID);
|
|
}
|
|
|
|
// SERVER_ID siServer;
|
|
// siServer.dwID = g_ClientMain.m_dwServerID;
|
|
g_ClientMain.m_dwChannelID = g_ClientMain.m_dwServerID;
|
|
g_ClientMain.m_dwPresentZone = 0;
|
|
// g_ClientMain.m_dwChannelID = siServer.GetChannel();
|
|
// g_ClientMain.m_dwPresentZone = siServer.GetZone();
|
|
|
|
/* if(g_ClientMain.m_dwVersion == 2002)
|
|
{
|
|
|
|
}*/
|
|
|
|
if(g_ClientMain.m_bAdminMode)
|
|
{
|
|
MessageBox(NULL, strCommandLine, "RYL", MB_OK);
|
|
}
|
|
|
|
if(!g_ClientMain.Init(hInstance))
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
while(1)
|
|
{
|
|
CProfileManager::Increment_Frame_Counter();
|
|
|
|
if(PeekMessage(&msg, NULL, 0U, 0U, PM_NOREMOVE))
|
|
{
|
|
{
|
|
PROFILE("Window Command");
|
|
if(0 == GetMessage(&msg, NULL, 0, 0 ))
|
|
{
|
|
return (int)msg.wParam;
|
|
}
|
|
|
|
TranslateMessage( &msg );
|
|
DispatchMessage( &msg );
|
|
}
|
|
}
|
|
else
|
|
{
|
|
{
|
|
PROFILE("Update");
|
|
g_ClientMain.Update();
|
|
}
|
|
|
|
{
|
|
g_ClientMain.Render();
|
|
}
|
|
}
|
|
}
|
|
return msg.wParam;
|
|
}
|
|
/*#ifdef _DEBUG
|
|
__except(ExcepCallBack(GetExceptionInformation()))
|
|
{
|
|
|
|
}
|
|
#else
|
|
catch(CError& e)
|
|
{
|
|
MessageBox(NULL, e.GetErrorMsg(), 0, 0);
|
|
}
|
|
#endif
|
|
|
|
return msg.wParam;*/
|
|
}
|
|
|
|
int _stdcall WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
|
|
{//
|
|
EXCEPTION_RECORD SavedExceptRec;
|
|
CONTEXT SavedContext;
|
|
//// EXCEPTION_POINTERS *pPointer;
|
|
|
|
if(g_ClientMain.m_bAdminMode)
|
|
{
|
|
g_CExceptionReport.SetProgramName("Risk Your Life");
|
|
g_CExceptionReport.SetUserFunc(MyExceptionReport);
|
|
|
|
USE_ANTIHACK1();
|
|
USE_ANTIHACK2( AntiFunc );
|
|
USE_ANTIHACK3( hInstance );
|
|
} else
|
|
{
|
|
__try
|
|
{
|
|
g_CExceptionReport.SetWriteInfo(FALSE);
|
|
g_CExceptionReport.SetProgramName("Risk Your Life");
|
|
g_CExceptionReport.SetUserFunc(MyExceptionReport);
|
|
|
|
USE_ANTIHACK1();
|
|
USE_ANTIHACK2( AntiFunc );
|
|
USE_ANTIHACK3( hInstance );
|
|
// } __except(pPointer = GetExceptionInformation(), EXCEPTION_EXECUTE_HANDLER)
|
|
} __except(SavedExceptRec = *(GetExceptionInformation())->ExceptionRecord, SavedContext = *(GetExceptionInformation())->ContextRecord, EXCEPTION_EXECUTE_HANDLER)
|
|
{
|
|
/* HINSTANCE hLib = LoadLibrary( "BlackBox.dll" );
|
|
|
|
typedef LONG (WINAPI* BlackBoxCrashHandlerFilter_PROC)( EXCEPTION_POINTERS * pExPtrs );
|
|
|
|
BlackBoxCrashHandlerFilter_PROC procShowBlackBoxUI;
|
|
procShowBlackBoxUI = (BlackBoxCrashHandlerFilter_PROC)GetProcAddress(hLib, "BlackBoxCrashHandlerFilter");
|
|
(procShowBlackBoxUI)(pPointer);
|
|
|
|
if ( NULL != hLib )
|
|
{
|
|
FreeLibrary( hLib );
|
|
}*///
|
|
g_ClientMain.PrintException(SavedExceptRec, SavedContext);
|
|
}
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
// Construction/Destruction
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
CClientMain::CClientMain()
|
|
{
|
|
m_lpBackGroundMusic = NULL;
|
|
|
|
m_lpSceneManager = NULL;
|
|
m_lpInterface = NULL;
|
|
m_lpCommonInterface = NULL;
|
|
m_lpPickItem = NULL;
|
|
m_CheckSoundBuffer = NULL;
|
|
m_bUpdateMove = TRUE;
|
|
m_ClassEffectPtr = NULL;
|
|
m_ClassEffectAlpha = 0;
|
|
m_pPlayerSelectEff = NULL;
|
|
m_pPlayerSkillSelectEff = NULL;
|
|
m_pEnemySelectEff = NULL;
|
|
m_pEnemySkillSelectEff = NULL;
|
|
m_dwFunction = 0;
|
|
m_bInterfaceAlreadyLoad = FALSE;
|
|
m_bStreetStallEnter = FALSE;
|
|
m_lTipBroadCounter = 0;
|
|
m_lTipBroadCounterSeed = 180000; // 3ºÐ
|
|
|
|
m_roOption.m_wReject = 0;
|
|
|
|
m_dwRespawnResult = 0;
|
|
m_dwFriendResult = 0;
|
|
|
|
m_dwPeaceModeResult = 0;
|
|
m_dwPeaceMode = 0;
|
|
|
|
m_dwAuthorizeResult = 0;
|
|
m_dwAuthorizeCasterID = 0;
|
|
m_cAuthorizeCmd = 0;
|
|
|
|
m_bChangeWeapon = FALSE;
|
|
m_bTargetMouseMode = FALSE;
|
|
m_bHardwareCursor = TRUE;
|
|
|
|
m_dwNumScreenShot = 1;
|
|
m_cEliteNation = (char)0xFF;
|
|
m_cEliteLevel = 0;
|
|
|
|
m_dwInternationalCode = 0; // Çѱ¹
|
|
// m_dwInternationalCode = 1; // ´ë¸¸
|
|
|
|
m_bTestServerVersion = TRUE; //Å×¼·
|
|
// m_bTestServerVersion = FALSE; //Á¤¼· ´ë¸¸¼·
|
|
|
|
m_bAdminMode = TRUE;
|
|
// m_bAdminMode = FALSE;
|
|
|
|
// _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
|
|
}
|
|
|
|
CClientMain::~CClientMain()
|
|
{
|
|
|
|
}
|
|
|
|
unsigned long CClientMain::ClientProc(HWND hWnd, unsigned int uMsg, WPARAM wParam, LPARAM lParam)
|
|
{
|
|
if(uMsg == WM_CLIENT_SOCKET)
|
|
{
|
|
m_Network.PacketProcess(lParam, FALSE);
|
|
return 0;
|
|
}
|
|
|
|
if(uMsg == WM_UDP_SOCKET)
|
|
{
|
|
m_Network.PacketProcess(lParam, TRUE);
|
|
return 0;
|
|
}
|
|
|
|
switch(uMsg)
|
|
{
|
|
case WM_TIMECHANGE:
|
|
{
|
|
int a=0;
|
|
}
|
|
break;
|
|
case WM_SETCURSOR:
|
|
if(LOWORD(lParam) == HTCLIENT) // hit-test code
|
|
{
|
|
if(m_bHardwareCursor)
|
|
{
|
|
if(m_dwKindCursor == CURSOR_NORMAL)
|
|
{
|
|
if(g_TooltipManager.m_ttRenderTarget)
|
|
::SetCursor(LoadCursor(m_hInstance, MAKEINTRESOURCE(IDC_TOOLTIP)));
|
|
else if(g_DeviceInput.GetIsLeftMousePress())
|
|
::SetCursor(LoadCursor(m_hInstance, MAKEINTRESOURCE(IDC_CLICKCURSOR)));
|
|
else
|
|
::SetCursor(LoadCursor(m_hInstance, MAKEINTRESOURCE(IDC_NORMALCURSOR)));
|
|
|
|
if(m_lpInterface)
|
|
{
|
|
if(m_lpPickItem && g_MessageBoxManager.m_lstMessageBox.empty())
|
|
{
|
|
::SetCursor(LoadCursor(m_hInstance, MAKEINTRESOURCE(IDC_PICKUP)));
|
|
} else if(m_lpInterface->m_bPopupShow)
|
|
{
|
|
::SetCursor(LoadCursor(m_hInstance, MAKEINTRESOURCE(IDC_POPUP)));
|
|
} else if(m_lpInterface->m_dwNormalTargetChrID != 0xFFFFFFFF)
|
|
{
|
|
if(g_CharacterData.GetClientType(m_lpInterface->m_dwNormalTargetChrID, TRUE) == CT_MONSTER)
|
|
::SetCursor(LoadCursor(m_hInstance, MAKEINTRESOURCE(IDC_ATTACK)));
|
|
else
|
|
::SetCursor(LoadCursor(m_hInstance, MAKEINTRESOURCE(IDC_DIALOG)));
|
|
// if(g_CharacterData.GetClientType(m_lpInterface->m_dwNormalTargetChrID) == CT_NPC)
|
|
// ::SetCursor(LoadCursor(m_hInstance, MAKEINTRESOURCE(IDC_DIALOG)));
|
|
// else if(g_CharacterData.GetClientType(m_lpInterface->m_dwNormalTargetChrID, TRUE) == CT_MONSTER)
|
|
// ::SetCursor(LoadCursor(m_hInstance, MAKEINTRESOURCE(IDC_ATTACK)));
|
|
}
|
|
}
|
|
} else if(g_ClientMain.m_dwKindCursor == CURSOR_REPAIR)
|
|
{
|
|
::SetCursor(LoadCursor(m_hInstance, MAKEINTRESOURCE(IDC_REPAIR)));
|
|
}
|
|
}
|
|
return 0;
|
|
}
|
|
return DefWindowProc(hWnd, uMsg, wParam, lParam);
|
|
|
|
case WM_KEYDOWN:
|
|
switch(wParam)
|
|
{
|
|
case VK_RETURN:
|
|
if(m_lpInterface && m_lpInterface->GetEnableChat()) g_TextEdit.SetFocus();
|
|
return 0;
|
|
}
|
|
break;
|
|
|
|
case WM_CHAR:
|
|
switch(wParam)
|
|
{
|
|
case VK_RETURN:
|
|
return 0;
|
|
}
|
|
break;
|
|
|
|
case WM_COMMAND:
|
|
if(HIWORD(wParam) == EN_CHANGE)
|
|
{
|
|
g_TextEdit.SetWindowText();
|
|
}
|
|
break;
|
|
|
|
case 0x020A:
|
|
case WM_MBUTTONDBLCLK:
|
|
case WM_MBUTTONDOWN:
|
|
case WM_MBUTTONUP:
|
|
case WM_LBUTTONDBLCLK:
|
|
case WM_LBUTTONDOWN:
|
|
case WM_LBUTTONUP:
|
|
case WM_RBUTTONDBLCLK:
|
|
case WM_RBUTTONDOWN:
|
|
case WM_RBUTTONUP:
|
|
g_DeviceInput.GetMouseState(uMsg, wParam, lParam);
|
|
break;
|
|
|
|
case WM_DESTROY:
|
|
Sleep(3000);
|
|
Destroy();
|
|
PostQuitMessage(WM_QUIT);
|
|
break;
|
|
}
|
|
|
|
return DefWindowProc(hWnd, uMsg, wParam, lParam);
|
|
}
|
|
|
|
BOOL CClientMain::Init(HINSTANCE hInstance)
|
|
{
|
|
WNDCLASS wc;
|
|
// Set up and register window class
|
|
wc.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS;
|
|
wc.lpfnWndProc = (WNDPROC) WindowProc;
|
|
wc.cbClsExtra = 0;
|
|
wc.cbWndExtra = sizeof(DWORD);
|
|
m_hInstance = wc.hInstance = hInstance;
|
|
wc.hIcon = NULL;
|
|
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
|
|
wc.hCursor = LoadCursor(hInstance, MAKEINTRESOURCE(IDC_NORMALCURSOR));
|
|
wc.hbrBackground = (HBRUSH) GetStockObject(BLACK_BRUSH);
|
|
wc.lpszMenuName = NULL;
|
|
wc.lpszClassName = "Risk Your Life";
|
|
|
|
if(!RegisterClass(&wc))
|
|
{
|
|
return FALSE;
|
|
}
|
|
|
|
m_hWnd = CreateWindow( "Risk Your Life", // class
|
|
"Risk Your Life", // caption
|
|
WS_VISIBLE | WS_POPUP, // style
|
|
0, 0, 800, 600, // window size
|
|
NULL, // parent window
|
|
NULL, // menu
|
|
hInstance, // instance
|
|
NULL); // parms
|
|
|
|
//g_DeviceInput.SetHwnd(&m_hWnd);
|
|
|
|
HKEY hMPClientReg;
|
|
unsigned long dwReadType = 0, dwReadLens = 256;
|
|
|
|
if(m_bTestServerVersion)
|
|
{
|
|
if( RegOpenKeyEx(HKEY_LOCAL_MACHINE, "Software\\GamaSoft\\MP-Client", 0, KEY_READ, &hMPClientReg) == ERROR_SUCCESS &&
|
|
RegQueryValueEx(hMPClientReg, "TestFolder", 0, &dwReadType, (LPBYTE)m_strClientPath, &dwReadLens) == ERROR_SUCCESS )
|
|
{
|
|
sprintf(INITVALUEFILE, "%s\\Mp.INI", m_strClientPath);
|
|
m_InitValue.Load();
|
|
char strRenderOption[256];
|
|
sprintf(strRenderOption,"%s\\RenderOption.dat",m_strClientPath);
|
|
CRenderOption::Load(strRenderOption);
|
|
RegCloseKey(hMPClientReg);
|
|
} else
|
|
{
|
|
MessageBox(NULL, g_StringTable.m_strString[28], g_StringTable.m_strString[21], MB_OK);
|
|
return FALSE;
|
|
}
|
|
} else
|
|
{
|
|
if( RegOpenKeyEx(HKEY_LOCAL_MACHINE, "Software\\GamaSoft\\MP-Client", 0, KEY_READ, &hMPClientReg) == ERROR_SUCCESS &&
|
|
RegQueryValueEx(hMPClientReg, "Folder", 0, &dwReadType, (LPBYTE)m_strClientPath, &dwReadLens) == ERROR_SUCCESS )
|
|
{
|
|
sprintf(INITVALUEFILE, "%s\\Mp.INI", m_strClientPath);
|
|
m_InitValue.Load();
|
|
char strRenderOption[256];
|
|
sprintf(strRenderOption,"%s\\RenderOption.dat",m_strClientPath);
|
|
CRenderOption::Load(strRenderOption);
|
|
RegCloseKey(hMPClientReg);
|
|
} else
|
|
{
|
|
MessageBox(NULL, g_StringTable.m_strString[28], g_StringTable.m_strString[21], MB_OK);
|
|
return FALSE;
|
|
}
|
|
}
|
|
|
|
char strScriptPath[MAX_PATH];
|
|
FILE *fp;
|
|
int ver;
|
|
|
|
sprintf(strScriptPath, "%s\\VersionInfo.dat", m_strClientPath);
|
|
fp = fopen(strScriptPath, "r");
|
|
fscanf(fp, "%d", &ver);
|
|
fclose(fp);
|
|
m_fClientVersion = ver;
|
|
m_fClientVersion /= 100.0f;
|
|
m_fClientVersion += 1.0f;
|
|
|
|
if(!m_bHardwareCursor)
|
|
{
|
|
g_DeviceInput.ShowCursor(FALSE);
|
|
}
|
|
|
|
unsigned long dwCrc[7];
|
|
|
|
sprintf(strScriptPath, "%s\\Script.mcf", m_strClientPath);
|
|
if(!g_StringTable.Load(strScriptPath))
|
|
{
|
|
MessageBox(NULL, "Can't load Language Script.", "Program Error", MB_OK);
|
|
return FALSE;
|
|
}
|
|
|
|
sprintf(strScriptPath, "%s\\Client.exe", m_strClientPath);
|
|
if(CCrc32Static::FileCrc32Assembly(strScriptPath, dwCrc[0]) != NO_ERROR)
|
|
{
|
|
MessageBox(NULL, g_StringTable.m_strString[22], g_StringTable.m_strString[21], MB_OK);
|
|
return FALSE;
|
|
}
|
|
sprintf(strScriptPath, "%s\\NPCScript.mcf", m_strClientPath);
|
|
if(CCrc32Static::FileCrc32Assembly(strScriptPath, dwCrc[1]) != NO_ERROR)
|
|
{
|
|
MessageBox(NULL, g_StringTable.m_strString[22], g_StringTable.m_strString[21], MB_OK);
|
|
return FALSE;
|
|
}
|
|
sprintf(strScriptPath, "%s\\ItemScript.gsf", m_strClientPath);
|
|
if(CCrc32Static::FileCrc32Assembly(strScriptPath, dwCrc[2]) != NO_ERROR)
|
|
{
|
|
MessageBox(NULL, g_StringTable.m_strString[22], g_StringTable.m_strString[21], MB_OK);
|
|
return FALSE;
|
|
}
|
|
sprintf(strScriptPath, "%s\\SkillScript.gsf", m_strClientPath);
|
|
if(CCrc32Static::FileCrc32Assembly(strScriptPath, dwCrc[3]) != NO_ERROR)
|
|
{
|
|
MessageBox(NULL, g_StringTable.m_strString[22], g_StringTable.m_strString[21], MB_OK);
|
|
return FALSE;
|
|
}
|
|
sprintf(strScriptPath, "%s\\MonsterProtoType.gsf", m_strClientPath);
|
|
if(CCrc32Static::FileCrc32Assembly(strScriptPath, dwCrc[4]) != NO_ERROR)
|
|
{
|
|
MessageBox(NULL, g_StringTable.m_strString[22], g_StringTable.m_strString[21], MB_OK);
|
|
return FALSE;
|
|
}
|
|
sprintf(strScriptPath, "%s\\Character\\Data\\ChrEvent.eds", m_strClientPath);
|
|
if(CCrc32Static::FileCrc32Assembly(strScriptPath, dwCrc[5]) != NO_ERROR)
|
|
{
|
|
MessageBox(NULL, g_StringTable.m_strString[22], g_StringTable.m_strString[21], MB_OK);
|
|
return FALSE;
|
|
}
|
|
sprintf(strScriptPath, "%s\\Script1.gsf", m_strClientPath);
|
|
if(CCrc32Static::FileCrc32Assembly(strScriptPath, dwCrc[6]) != NO_ERROR)
|
|
{
|
|
MessageBox(NULL, g_StringTable.m_strString[22], g_StringTable.m_strString[21], MB_OK);
|
|
return FALSE;
|
|
}
|
|
|
|
m_dwVersion = dwCrc[0] ^ dwCrc[1];
|
|
m_dwVersion = m_dwVersion ^ dwCrc[2];
|
|
m_dwVersion = m_dwVersion ^ dwCrc[3];
|
|
m_dwVersion = m_dwVersion ^ dwCrc[4];
|
|
m_dwVersion = m_dwVersion ^ dwCrc[5];
|
|
m_dwVersion = m_dwVersion ^ dwCrc[6];
|
|
|
|
if(m_bAdminMode)
|
|
{
|
|
if(m_bTestServerVersion)
|
|
m_dwVersion = 0xb7d7969a; // Å×¼·
|
|
else
|
|
m_dwVersion = 0xf87fa009; // Á¤¼·
|
|
}
|
|
|
|
// m_dwVersion = 0xf4cf65f9; // Å×¼·
|
|
|
|
char strFilePath[MAX_PATH], *strTipBroad;
|
|
sprintf(strFilePath, "%s\\Tip.dat", m_strClientPath);
|
|
fp = fopen(strFilePath,"r");
|
|
if(fp)
|
|
{
|
|
for(;;)
|
|
{
|
|
strTipBroad = new char[MAX_PATH];
|
|
if(fgets(strTipBroad, MAX_PATH, fp))
|
|
{
|
|
m_lstTipBroad.push_back(strTipBroad);
|
|
} else
|
|
{
|
|
delete[] strTipBroad;
|
|
break;
|
|
}
|
|
}
|
|
fclose(fp);
|
|
}
|
|
|
|
CEnumD3D::Enum();
|
|
CEnumD3D::m_nAdapter = m_InitValue.m_nAdapter;
|
|
CEnumD3D::m_nDevice = m_InitValue.m_nDevice;
|
|
CEnumD3D::m_nMode = m_InitValue.m_nMode;
|
|
m_BaseGraphicLayer.Create(m_hWnd, true, false, 0, 0);
|
|
m_lpSceneManager = new CSceneManager();
|
|
m_lpSceneManager->SetDevice(m_BaseGraphicLayer.GetDevice());
|
|
m_lpSceneManager->SetCamera(&m_BaseGraphicLayer.m_ViewCamera);
|
|
m_lpSceneManager->m_WeatherManager.SetClearColor(&m_BaseGraphicLayer.m_ClearColor);
|
|
m_lpSceneManager->Create(m_InitValue, (char *)m_strClientPath);
|
|
g_TextEdit.Create(m_hWnd, m_BaseGraphicLayer.GetDevice());
|
|
g_TextEdit.InitMessage();
|
|
g_MessageBoxManager.Create();
|
|
|
|
// _ASSERTE(_CrtCheckMemory());
|
|
|
|
/* char strString[MAX_PATH];
|
|
strcpy(strString, "³ª¤Ç¤¾´Ï¤Á¤Ç´ô¤Ç ¸®³ó¤¾ÇdzëÈù°¼ ¤Ç¤¾ ¤Ó¤¤°¼¤Ç¤¾¤¤°íÈø¤©³õ´Ï°÷Èø³ëÈ÷ ¤Ç ¤¤±âÇá¤Ç¤¡¤¤¸®¤Ç¤¾");
|
|
g_TextEdit.MakeWordBreak(strString, 200);
|
|
*/
|
|
m_lpCommonInterface = new CCommonInterface;
|
|
|
|
//------------------»ç¿îµå ó¸®-----------------------//
|
|
try
|
|
{
|
|
CSoundManager &sm = CSoundManager::GetInstance();
|
|
sm.Create(m_hWnd);
|
|
}
|
|
catch(exception & e)
|
|
{
|
|
MessageBox(NULL, e.what(), " ", MB_OK);
|
|
}
|
|
//---------------------------------------------------//
|
|
|
|
m_Network.Create(m_hWnd);
|
|
g_CharacterData.IsExistToList = m_Network.IsExistToList;
|
|
g_CharacterData.CharAddressRequireInfo = m_Network.CharAddressRequireInfo;
|
|
g_CharacterData.SendMovingPacket = m_Network.SendMovingPacket;
|
|
g_CharacterData.SendCharRespawn = m_Network.SendCharRespawn;
|
|
g_CharacterData.SendMoveUpdatePacket = m_Network.SendMoveUpdatePacket;
|
|
g_CharacterData.SendCharAttack = m_Network.SendCharAttack;
|
|
|
|
g_CharacterData.GetMotionSheet = GetMotionSheet;
|
|
g_CharacterData.GetWeaponType = GetWeaponType;
|
|
g_CharacterData.CheckTargetforSkill = CheckTargetforSkill;
|
|
|
|
g_CharacterData.CheckSkillStart = CheckSkillStart;
|
|
g_CharacterData.CheckStillCasting = CheckStillCasting;
|
|
|
|
g_CharacterData.SetKillCounter = SetKillCounter;
|
|
g_CharacterData.SetAutoRun = SetAutoRun;
|
|
g_CharacterData.GetAutoRun = GetAutoRun;
|
|
g_CharacterData.ChangeWeapon = ChangeWeapon;
|
|
g_CharacterData.SetChangeWeapon = SetChangeWeapon;
|
|
g_CharacterData.CheckAttackable = CheckAttackable;
|
|
|
|
g_CharacterData.GetMonsterMinBox = GetMonsterMinBox;
|
|
g_CharacterData.GetMonsterMaxBox = GetMonsterMaxBox;
|
|
|
|
m_cNumMember = 0;
|
|
m_cNumParty = 0;
|
|
ZeroMemory(m_mfpMember, sizeof(m_mfpMember));
|
|
ZeroMemory(m_pfmParty, sizeof(m_pfmParty));
|
|
|
|
/* sprintf(strScriptPath,"%s\\DemonItemScript.txt",m_strPath);
|
|
CGameData::LoadItemScript(strScriptPath);
|
|
|
|
sprintf(strScriptPath,"%s\\ChrOutfitScript.txt",m_strPath);
|
|
CGameData::LoadChrOutfitScript(strScriptPath);
|
|
|
|
sprintf(strScriptPath,"%s\\DemonNPCScript.txt",m_strPath);
|
|
CGameData::LoadNPCScript(strScriptPath);*/
|
|
|
|
/* m_bPressEnter = FALSE;
|
|
|
|
sprintf(EFFECTPATH, "%s\\Effect\\", m_strPath);
|
|
sprintf(EFFECTSOUNDPATH, "%s\\Sound\\Effect", m_strPath);*/
|
|
|
|
/*
|
|
sprintf(strScriptPath, "%s/Character/Data/Ani/", m_strClientPath);
|
|
g_ContAniKeyPack.SetFilePath( strScriptPath );
|
|
|
|
sprintf(strScriptPath, "%s/Character/Data/Mesh/", m_strClientPath);
|
|
g_ContLODMesh.SetFilePath( strScriptPath );
|
|
|
|
sprintf(strScriptPath, "%s/Character/Data/Tex/", m_strClientPath);
|
|
g_ContTexturePiece.SetFilePath( strScriptPath );
|
|
|
|
sprintf(strScriptPath, "%s/Character/Data/AMesh/", m_strClientPath);
|
|
g_ContAMesh.SetFilePath( strScriptPath );
|
|
|
|
sprintf(strScriptPath, "%s/Character/Data/Texture/", m_strClientPath);
|
|
g_ContTexture.SetFilePath( strScriptPath );
|
|
|
|
sprintf(strScriptPath, "%s/Character/Data/", m_strClientPath);
|
|
if( FALSE == CZ3DCharacterModel::_Init( strScriptPath ) )
|
|
{
|
|
return FALSE;
|
|
}
|
|
|
|
if( false == CZ3DGeneralChrModel::_BuildCMDSList() )
|
|
{
|
|
return FALSE;
|
|
}
|
|
|
|
sprintf(strScriptPath, "%s/Character/Data/ChrEvent.EDS", m_strClientPath);
|
|
if( false == CZ3DChrEventGenerator::_Load( strScriptPath ) )
|
|
{
|
|
return FALSE;
|
|
}
|
|
|
|
sprintf(strScriptPath, "%s/Character/Data/Tex/", m_strClientPath);
|
|
CZ3DRenderable::_Init( m_BaseGraphicLayer.GetDevice() );
|
|
Z3DTexture::_Init( m_BaseGraphicLayer.GetDevice(), strScriptPath, 0 );
|
|
*/
|
|
m_bMouseMode = TRUE;
|
|
g_CharacterData.m_Camera.m_nCameraMode = 0;
|
|
m_bShowCursor = TRUE;
|
|
m_bAutoRunMode = FALSE;
|
|
m_bSimpleMode = FALSE;
|
|
m_dwKindCursor = CURSOR_NORMAL;
|
|
strcpy(m_strRecentChatChrID, "");
|
|
strcpy(m_strWhisperChrID, "");
|
|
m_bInstanceWhisper = FALSE;
|
|
for(int i = 0; i < 3; i++)
|
|
{
|
|
strcpy(m_strChatMessage[i], "");
|
|
}
|
|
|
|
m_bShowInfo = FALSE;
|
|
|
|
CFrameTimer::Create();
|
|
m_nShowInterfaceTimerID = CFrameTimer::Regist(500.0f);
|
|
m_nSceneManagerTimerID = CFrameTimer::Regist(35.0f);
|
|
m_nWeatherTimerID = CFrameTimer::Regist(10.0f);
|
|
// m_nShowMessageBoxTimerID = CFrameTimer::Regist(30.0f);
|
|
m_dwCursorTimer = CFrameTimer::Regist(10.0f);
|
|
m_dwPartyInfoTimerID = CFrameTimer::Regist(1.0f);
|
|
m_dwSpeedHackCheckTimerID = CFrameTimer::Regist(1 / 10.0f);
|
|
m_dwUpdateAddressTimerID = CFrameTimer::Regist(1 / 2.0f);
|
|
m_dwUpdateFlushTimerID = CFrameTimer::Regist(10.0f);
|
|
m_dwCheckStatusTimerID = CFrameTimer::Regist(1 / 30.0f);
|
|
m_dwPingTimerID = CFrameTimer::Regist(1 / 5.0f);
|
|
|
|
m_bCursorToggle = FALSE;
|
|
m_bSystemConsoleShow = FALSE;
|
|
|
|
g_CharacterData.Create();
|
|
|
|
sprintf(strScriptPath, "%s\\ItemScript.gsf", m_strClientPath);
|
|
g_ItemMgr.LoadItemProtoTypeBinary(strScriptPath);
|
|
|
|
sprintf(strScriptPath, "%s\\SkillScript.gsf", m_strClientPath);
|
|
g_SkillMgr.LoadSkillsFromBinary(strScriptPath);
|
|
|
|
sprintf(strScriptPath, "%s\\MonsterProtoType.gsf", m_strClientPath);
|
|
g_MonsterMgr.LoadMonstersFromBinary(strScriptPath);
|
|
|
|
sprintf(strScriptPath, "%s\\Script1.gsf", m_strClientPath);
|
|
g_StringFilter.Load(strScriptPath);
|
|
|
|
char strQuestPath[MAX_PATH];
|
|
sprintf(strScriptPath, "%s\\NPCScript.mcf", m_strClientPath);
|
|
sprintf(strQuestPath, "%s\\Quest.mcf", m_strClientPath);
|
|
g_NPCList.LoadQuest(strScriptPath, strQuestPath);
|
|
|
|
strcpy(m_csStatus.m_Info.Name, "");
|
|
// /////////////////////////////
|
|
|
|
// m_lpInterface->InitChrSelect();
|
|
/////////////////////////////*/
|
|
// if(!m_lpCommonInterface->InitNationSelect())
|
|
|
|
/* CreateNationInterface(NATION_HUMAN);
|
|
m_lpInterface->InitGame();
|
|
/*/
|
|
|
|
// _ASSERTE(_CrtCheckMemory());
|
|
m_pPlayerSelectEff = new CEffScript;
|
|
m_lpSceneManager->AddEffectScript(m_pPlayerSelectEff);
|
|
m_pPlayerSelectEff->GetScriptBinData("mark.esf");
|
|
m_pPlayerSelectEff->SetStartPos(0.0f, 0.0f, 0.0f);
|
|
m_pPlayerSelectEff->SetEndPos(0.0f, 0.0f, 0.0f);
|
|
|
|
// _ASSERTE(_CrtCheckMemory());
|
|
m_pPlayerSkillSelectEff = new CEffScript;
|
|
m_lpSceneManager->AddEffectScript(m_pPlayerSkillSelectEff);
|
|
m_pPlayerSkillSelectEff->GetScriptBinData("inter_mark_player.esf");
|
|
m_pPlayerSkillSelectEff->SetStartPos(0.0f, 0.0f, 0.0f);
|
|
m_pPlayerSkillSelectEff->SetEndPos(0.0f, 0.0f, 0.0f);
|
|
|
|
// _ASSERTE(_CrtCheckMemory());
|
|
m_pEnemySelectEff = new CEffScript;
|
|
m_lpSceneManager->AddEffectScript(m_pEnemySelectEff);
|
|
m_pEnemySelectEff->GetScriptBinData("inter-enemyattack.esf");
|
|
m_pEnemySelectEff->SetStartPos(0.0f, 0.0f, 0.0f);
|
|
m_pEnemySelectEff->SetEndPos(0.0f, 0.0f, 0.0f);
|
|
|
|
// _ASSERTE(_CrtCheckMemory());
|
|
m_pEnemySkillSelectEff = new CEffScript;
|
|
m_lpSceneManager->AddEffectScript(m_pEnemySkillSelectEff);
|
|
m_pEnemySkillSelectEff->GetScriptBinData("inter_mark_enemy.esf");
|
|
m_pEnemySkillSelectEff->SetStartPos(0.0f, 0.0f, 0.0f);
|
|
m_pEnemySkillSelectEff->SetEndPos(0.0f, 0.0f, 0.0f);
|
|
|
|
/////////////////////
|
|
//*
|
|
if(!m_lpCommonInterface->InitLogo())
|
|
{
|
|
return FALSE;
|
|
}
|
|
//*/
|
|
////////////////////
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
void CClientMain::Destroy()
|
|
{
|
|
if(g_ClientMain.m_lpBackGroundMusic)
|
|
{
|
|
try
|
|
{
|
|
g_ClientMain.m_lpBackGroundMusic->Destroy();
|
|
g_ClientMain.m_lpBackGroundMusic = NULL;
|
|
} catch(exception & e)
|
|
{
|
|
e = 0;
|
|
g_ClientMain.m_lpBackGroundMusic = NULL;
|
|
}
|
|
}
|
|
|
|
if(m_lstTipBroad.size())
|
|
{
|
|
vector<char *>::iterator it;
|
|
char *lpDelete;
|
|
for(it = m_lstTipBroad.begin(); it != m_lstTipBroad.end();)
|
|
{
|
|
lpDelete = (*it);
|
|
it = m_lstTipBroad.erase(it);
|
|
delete[] lpDelete;
|
|
}
|
|
m_lstTipBroad.clear();
|
|
}
|
|
|
|
g_CharacterData.DeleteAllCharacter();
|
|
|
|
_Z3DGlobalClose( BaseGraphicsLayer::GetDevice() );
|
|
|
|
if(m_lpCommonInterface) { delete m_lpCommonInterface; m_lpCommonInterface = NULL; }
|
|
if(m_lpInterface) { delete m_lpInterface; m_lpInterface = NULL; }
|
|
if(m_lpSceneManager) { delete m_lpSceneManager; m_lpSceneManager = NULL; }
|
|
|
|
/*CZ3DManagedObject::Close();
|
|
Z3DTexture::_Close();
|
|
|
|
CZ3DChrEventGenerator::_Close();
|
|
CZ3DGeneralChrModel::_ClearCMDSList();*/
|
|
}
|
|
|
|
void CClientMain::Update(void)
|
|
{
|
|
// HWND hFocus = GetFocus();
|
|
g_TooltipManager.m_ttRenderTarget = NULL;
|
|
|
|
CFrameTimer::UpdateTime();
|
|
g_DeviceInput.UpdateInfo();
|
|
|
|
#ifdef NDEBUG
|
|
if(g_DeviceInput.KeyDown(VK_F12) && m_lpCommonInterface) ProcessScreenshot();
|
|
#else
|
|
if(g_DeviceInput.KeyDown(VK_F9) && m_lpCommonInterface) ProcessScreenshot();
|
|
#endif
|
|
|
|
/* if(CheckSoundBufferSpeedHack())
|
|
{
|
|
/* HTTPClient Client;
|
|
Client.Request("ruliweb.com", "/data/hobby/list.php");
|
|
while(Client.Wait(1000000) == FALSE) {}
|
|
|
|
// if(Client.result != HTTP_ERROR)
|
|
MessageBox(0, "Á¤»óÀûÀÎ µ¿ÀÛÀ» ÇÏÁö ¾Ê´Â ÄÄÇ»ÅÍ ÀÔ´Ï´Ù.\nÀçºÎÆÃÇØ ÁֽʽÿÀ.", "Risk Your Life", MB_OK);
|
|
SendMessage(g_ClientMain.m_hWnd, WM_DESTROY, 0, 0);
|
|
g_ClientMain.m_dwClientMode = CLIENT_END;
|
|
return;
|
|
}*/
|
|
|
|
float fUpdate = CFrameTimer::GetUpdateTimer(m_nShowInterfaceTimerID);
|
|
if(fUpdate >= 1.0f)
|
|
{
|
|
if(m_lTipBroadCounter)
|
|
{
|
|
m_lTipBroadCounter -= fUpdate * 2;
|
|
if(m_lTipBroadCounter < 0)
|
|
{
|
|
SetTipBroadTimer(m_lTipBroadCounterSeed);
|
|
char strMessage[MAX_PATH];
|
|
sprintf(strMessage, "Tip : %s", m_lstTipBroad[rand() % m_lstTipBroad.size()]);
|
|
g_TextEdit.AddNotice(strMessage, 1);
|
|
}
|
|
}
|
|
|
|
if(m_Network.m_lShoutCounter)
|
|
{
|
|
m_Network.m_lShoutCounter -= fUpdate * 2;
|
|
if(m_Network.m_lShoutCounter < 0) m_Network.m_lShoutCounter = 0;
|
|
}
|
|
|
|
if(m_Network.m_lFameInfoCounter)
|
|
{
|
|
m_Network.m_lFameInfoCounter -= fUpdate * 2;
|
|
if(m_Network.m_lFameInfoCounter < 0) m_Network.m_lFameInfoCounter = 0;
|
|
}
|
|
|
|
if(m_Network.m_lPartyFindCounter)
|
|
{
|
|
m_Network.m_lPartyFindCounter -= fUpdate * 2;
|
|
if(m_Network.m_lPartyFindCounter < 0) m_Network.m_lPartyFindCounter = 0;
|
|
}
|
|
|
|
if(m_Network.m_lPartyCmdCounter)
|
|
{
|
|
m_Network.m_lPartyCmdCounter -= fUpdate * 2;
|
|
if(m_Network.m_lPartyCmdCounter < 0) m_Network.m_lPartyCmdCounter = 0;
|
|
}
|
|
|
|
if(m_Network.m_lSetSkillCounter)
|
|
{
|
|
m_Network.m_lSetSkillCounter -= fUpdate * 2;
|
|
if(m_Network.m_lSetSkillCounter < 0)
|
|
{
|
|
m_Network.SendChant(m_csStatus.m_lpQuickSelected);
|
|
m_Network.m_lSetSkillCounter = 0;
|
|
}
|
|
}
|
|
|
|
if(m_lKillCounter)
|
|
{
|
|
static long lPrintCounter = 0;
|
|
m_lKillCounter -= fUpdate * 2;
|
|
|
|
if(m_lKillCounter < 0)
|
|
{
|
|
m_Network.m_pSocket->CharSuicide(m_dwMyChrID);
|
|
SetKillCounter(0);
|
|
} else
|
|
{
|
|
if(lPrintCounter != m_lKillCounter / 1000)
|
|
{
|
|
lPrintCounter = m_lKillCounter / 1000;
|
|
if(lPrintCounter)
|
|
{
|
|
char strText[MAX_PATH];
|
|
sprintf(strText, g_StringTable.m_strString[900], lPrintCounter);
|
|
g_TextEdit.AddMessage(strText, g_ClientMain.m_dwMyChrID, 129);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
if(CFrameTimer::GetUpdateTimer(m_dwPingTimerID) >= 1.0f)
|
|
{
|
|
m_Network.m_pSocket->SendSysPing();
|
|
}
|
|
|
|
if(CFrameTimer::GetUpdateTimer(m_dwCursorTimer) >= 1.0f) m_bCursorToggle = !m_bCursorToggle;
|
|
|
|
if(CFrameTimer::GetUpdateTimer(m_dwSpeedHackCheckTimerID) >= 1.0f)
|
|
{
|
|
if(GetSpeedHack())
|
|
{
|
|
/* HTTPClient Client;
|
|
Client.Request("ruliweb.com", "/data/hobby/list.php");
|
|
while(Client.Wait(1000000) == FALSE) {}
|
|
|
|
if(Client.result != HTTP_ERROR)*/
|
|
MessageBox(0, g_StringTable.m_strString[23], g_StringTable.m_strString[21], MB_OK);
|
|
SendMessage(g_ClientMain.m_hWnd, WM_DESTROY, 0, 0);
|
|
g_ClientMain.m_dwClientMode = CLIENT_END;
|
|
return;
|
|
}
|
|
}/**/
|
|
|
|
if(!m_Network.m_bUpdateAddressPacket && CFrameTimer::GetUpdateTimer(m_dwUpdateAddressTimerID) >= 1.0f)
|
|
{
|
|
CGUIMessageBox *lpMessageBox = new CGUIMessageBox;
|
|
lpMessageBox->Create(g_StringTable.m_strString[24]);
|
|
m_Network.m_pSocket->CharUpdateAddress(g_ClientMain.m_dwMyChrID);
|
|
}
|
|
|
|
if(m_dwRespawnResult & MB_YES)
|
|
{
|
|
m_Network.m_nsNetworkState = NS_RESPAWN;
|
|
POS psPos = { 0.0f, 0.0f, 0.0f };
|
|
m_Network.m_pSocket->CharRespawn(m_dwMyChrID, 0, psPos);
|
|
|
|
m_dwRespawnResult = 0;
|
|
|
|
return;
|
|
} else if(m_dwRespawnResult & MB_NO || m_dwRespawnResult & MB_EXIT)
|
|
{
|
|
POS psPos;
|
|
switch(m_dwPresentZone)
|
|
{
|
|
case 4:
|
|
if(m_dwClientNation == NATION_HUMAN)
|
|
{
|
|
psPos.fPointX = 1870.78f;
|
|
psPos.fPointY = 14.20f;
|
|
psPos.fPointZ = 1601.52f;
|
|
} else if(m_dwClientNation == NATION_AKHAN)
|
|
{
|
|
psPos.fPointX = 674.59f;
|
|
psPos.fPointY = 9.45f;
|
|
psPos.fPointZ = 1457.43f;
|
|
}
|
|
break;
|
|
|
|
case 5:
|
|
if(m_dwClientNation == NATION_HUMAN)
|
|
{
|
|
psPos.fPointX = 934.73f;
|
|
psPos.fPointY = 44.79f;
|
|
psPos.fPointZ = 2719.47f;
|
|
} else if(m_dwClientNation == NATION_AKHAN)
|
|
{
|
|
psPos.fPointX = 3041.62f;
|
|
psPos.fPointY = 103.18f;
|
|
psPos.fPointZ = 878.35f;
|
|
}
|
|
break;
|
|
}
|
|
|
|
m_Network.m_nsNetworkState = NS_RESPAWN;
|
|
m_Network.m_pSocket->CharRespawn(m_dwMyChrID, 1, psPos);
|
|
|
|
m_dwRespawnResult = 0;
|
|
|
|
return;
|
|
}
|
|
|
|
if(m_dwFriendResult & MB_YES)
|
|
{
|
|
m_Network.m_pSocket->CharFriendAddRequest(m_strFriendName, PktFriendAddReq::ADD_FRIEND_REQ);
|
|
m_dwFriendResult = 0;
|
|
|
|
return;
|
|
} else if(m_dwFriendResult & MB_NO || m_dwFriendResult & MB_EXIT)
|
|
{
|
|
m_dwFriendResult = 0;
|
|
|
|
return;
|
|
}
|
|
|
|
if(m_dwPeaceModeResult & MB_YES)
|
|
{
|
|
if(m_dwPeaceMode)
|
|
{
|
|
m_Network.m_pSocket->CharPeaceMode(m_dwMyChrID, true);
|
|
} else
|
|
{
|
|
m_Network.m_pSocket->CharPeaceMode(m_dwMyChrID, false);
|
|
}
|
|
|
|
m_dwPeaceMode = 0;
|
|
m_dwPeaceModeResult = 0;
|
|
|
|
return;
|
|
} else if(m_dwPeaceModeResult & MB_NO || m_dwPeaceModeResult & MB_EXIT)
|
|
{
|
|
m_dwPeaceMode = 0;
|
|
m_dwPeaceModeResult = 0;
|
|
|
|
return;
|
|
}
|
|
|
|
if(m_dwAuthorizeResult & MB_YES)
|
|
{
|
|
m_Network.m_pSocket->CharAuthorizePanel(m_dwMyChrID, m_dwAuthorizeCasterID, m_cAuthorizeCmd);
|
|
|
|
if(m_cAuthorizeCmd == ClientSocket::APCmd_Recall)
|
|
{
|
|
// ¸®ÄÝ ½ºÅ³
|
|
CEffScript *test_script;
|
|
test_script = new CEffScript;
|
|
if(test_script)
|
|
{
|
|
if(test_script->GetScriptBinData("recall2.esf"))
|
|
{
|
|
// ½ºÅ³ »ç¿ë½Ã Ÿ°Ý ÀÌÆÑÆ® ó¸®
|
|
test_script->SetStartPos(g_CharacterData.m_lstCharData[g_CharacterData.m_nFocusCharacter]->m_vecPos.x,
|
|
g_CharacterData.m_lstCharData[g_CharacterData.m_nFocusCharacter]->m_vecPos.y,
|
|
g_CharacterData.m_lstCharData[g_CharacterData.m_nFocusCharacter]->m_vecPos.z);
|
|
test_script->SetEndPos(g_CharacterData.m_lstCharData[g_CharacterData.m_nFocusCharacter]->m_vecPos.x,
|
|
g_CharacterData.m_lstCharData[g_CharacterData.m_nFocusCharacter]->m_vecPos.y,
|
|
g_CharacterData.m_lstCharData[g_CharacterData.m_nFocusCharacter]->m_vecPos.z);
|
|
|
|
float fChrDir = g_CharacterData.m_lstCharData[g_CharacterData.m_nFocusCharacter]->m_fDirection;
|
|
fChrDir = -fChrDir;
|
|
fChrDir -= FLOAT_PHI / 2.0f;
|
|
|
|
vector3 vecChrToward;
|
|
vecChrToward.x = cosf(fChrDir);
|
|
vecChrToward.z = sinf(fChrDir);
|
|
vecChrToward.y = 0.0f;
|
|
vecChrToward.Normalize();
|
|
test_script->SetChrFwd(-vecChrToward.x, -vecChrToward.y, -vecChrToward.z);
|
|
test_script->SetMine(true);
|
|
test_script->SetBSkill(true);
|
|
|
|
if(!CSceneManager::m_EffectManager.AddEffScript(test_script)) // ÀÌÆåÆ® ½ºÅ©¸³Æ®¸¦ ÀÐÀ¸¸é ³ª¿À´Â À妽º
|
|
{
|
|
delete test_script;
|
|
}
|
|
} else
|
|
{
|
|
delete test_script;
|
|
}
|
|
}
|
|
|
|
CastObject pCastObject;
|
|
pCastObject.m_wTypeID = 0;
|
|
pCastObject.m_cObjectType = 200;
|
|
pCastObject.m_cObjectLevel = 0;
|
|
pCastObject.m_DstPos.fPointX = g_CharacterData.m_lstCharData[g_CharacterData.m_nFocusCharacter]->m_vecPos.x;
|
|
pCastObject.m_DstPos.fPointY = g_CharacterData.m_lstCharData[g_CharacterData.m_nFocusCharacter]->m_vecPos.y;
|
|
pCastObject.m_DstPos.fPointZ = g_CharacterData.m_lstCharData[g_CharacterData.m_nFocusCharacter]->m_vecPos.z;
|
|
|
|
List<DWORD> SendCharacterList;
|
|
g_CharacterData.GetSendCharacterAroundList(SendCharacterList);
|
|
for(int i=0;i<SendCharacterList.num;i++)
|
|
{
|
|
g_ClientMain.m_Network.m_pSocket->RegistInstanceUDPList(SendCharacterList[i]);
|
|
}
|
|
g_ClientMain.m_Network.m_pSocket->CharCastObjectInfo(g_ClientMain.m_dwMyChrID, g_ClientMain.m_dwMyChrID, pCastObject);
|
|
}
|
|
|
|
m_dwAuthorizeResult = 0;
|
|
m_dwAuthorizeCasterID = 0;
|
|
m_cAuthorizeCmd = 0;
|
|
|
|
return;
|
|
} else if(m_dwAuthorizeResult & MB_NO || m_dwAuthorizeResult & MB_EXIT)
|
|
{
|
|
m_dwAuthorizeResult = 0;
|
|
m_dwAuthorizeCasterID = 0;
|
|
m_cAuthorizeCmd = 0;
|
|
|
|
return;
|
|
}
|
|
|
|
if(g_ClientMain.m_csStatus.m_lstQuest.size())
|
|
{
|
|
unsigned long dwTriggerCount;
|
|
LPQuestInstance lpQuest = NULL;
|
|
LPTriggerNode lpTrigger = g_ClientMain.m_csStatus.GetTriggertoGeton(lpQuest, &dwTriggerCount,
|
|
g_CharacterData.m_lstCharData[g_CharacterData.m_nFocusCharacter]->m_vecPos);
|
|
if(lpTrigger)
|
|
{
|
|
g_ClientMain.m_Network.m_pSocket->CharOperateTrigger(g_ClientMain.m_dwMyChrID,
|
|
(unsigned short)lpQuest->m_dwQuestID, (unsigned char)lpQuest->m_dwPresentPhase,
|
|
(unsigned char)dwTriggerCount, (unsigned char)lpQuest->m_lstTriggerCount[dwTriggerCount]);
|
|
}
|
|
}
|
|
|
|
switch(m_dwClientMode)
|
|
{
|
|
case CLIENT_LOGO:
|
|
m_lpCommonInterface->UpdateLogo();
|
|
break;
|
|
|
|
case CLIENT_MAIN:
|
|
m_lpCommonInterface->UpdateMain();
|
|
break;
|
|
|
|
case CLIENT_NATIONSELECT:
|
|
m_lpCommonInterface->UpdateNationSelect();
|
|
break;
|
|
|
|
case CLIENT_CHARACTERSELECT:
|
|
m_lpInterface->UpdateChrSelect();
|
|
break;
|
|
|
|
case CLIENT_GAME:
|
|
m_lpInterface->UpdateGame();
|
|
break;
|
|
}
|
|
//interface effect update
|
|
/*int snum = CSceneManager::m_EffectManager.GetInterfaceScriptNum();
|
|
|
|
for(int scnt = 0;scnt<snum;scnt++)
|
|
CSceneManager::m_EffectManager.ProcessInterfaceScript(scnt);
|
|
*/
|
|
/////////interface effect start//////////
|
|
int snum = CSceneManager::m_EffectManager.GetInterfaceScriptNum();
|
|
bool effcheck = false;
|
|
DWORD now_ceffecttime = 0;
|
|
|
|
static DWORD before_ceffecttime = 0;
|
|
static int effclick = 0;
|
|
|
|
static int increase = 0;
|
|
now_ceffecttime = timeGetTime();
|
|
|
|
for(int scnt = 0;scnt<snum;scnt++) {
|
|
effcheck = CSceneManager::m_EffectManager.ProcessInterfaceScript(scnt);
|
|
|
|
if(g_CharacterData.m_lpDuelReady)
|
|
{
|
|
if(CSceneManager::m_EffectManager.CheckNullInterfaceScript(g_CharacterData.m_lpDuelReady))
|
|
{
|
|
g_CharacterData.m_lpDuelReady = NULL;
|
|
g_CharacterData.SetDuelTarget();
|
|
// g_CharacterData.m_dwDuelTargetID = g_CharacterData.m_dwPreDuelTargetID;
|
|
}
|
|
}
|
|
|
|
if(m_ClassEffectPtr != NULL) { // ÇöÁ¦ ÀüÁ÷ ÀÌÆÑÆ®°¡ Ȱ¼ºÈ µÇ¾î ÀÖÀ¸¸é..
|
|
if(effcheck && CSceneManager::m_EffectManager.CheckInterfaceScript(scnt,m_ClassEffectPtr)) {
|
|
// ÀüÁ÷ ÀÌÆÑÆ®ÀÇ hit ½ÅÈ£°¡ ¹ß»ýÇßÀ¸¸é.
|
|
before_ceffecttime = now_ceffecttime;
|
|
effclick = 1;
|
|
increase = increase > 0 ? 0:1;
|
|
}
|
|
}
|
|
|
|
}
|
|
//
|
|
|
|
//ÀüÁ÷ ÀÌÆÑÆ®½Ã °°À̳ª¿À´Â ½ºÅ×À̼½º ¼öÄ¡ ¾÷µ¥ÀÌÆ® ºÎ.
|
|
if(m_ClassEffectPtr != NULL) {
|
|
if(!CSceneManager::m_EffectManager.CheckNullInterfaceScript(m_ClassEffectPtr)) {
|
|
// ÀüÁ÷ ÀÌÆÑÆ®°¡ ¾ÆÁ÷ µ¿ÀÛÁßÀ̸é.
|
|
if(effclick) {
|
|
for(int timeskip = 0;timeskip <(int)(now_ceffecttime - before_ceffecttime)/40;timeskip++) {
|
|
before_ceffecttime = now_ceffecttime;
|
|
|
|
if(increase==1) {
|
|
m_ClassEffectAlpha += 13;
|
|
}
|
|
else if(increase == 0){
|
|
m_ClassEffectAlpha -= 14;
|
|
}
|
|
|
|
if(m_ClassEffectAlpha >=255) {
|
|
m_ClassEffectAlpha = 255;
|
|
effclick = 0;
|
|
}
|
|
else if(m_ClassEffectAlpha <0)
|
|
m_ClassEffectAlpha = 0;
|
|
|
|
}
|
|
}
|
|
}
|
|
else{
|
|
m_ClassEffectAlpha = 0;
|
|
increase = 0;
|
|
before_ceffecttime = 0;
|
|
m_ClassEffectPtr = NULL;
|
|
}
|
|
}
|
|
/////////interface effect end///////////
|
|
if(CFrameTimer::GetUpdateTimer(m_dwUpdateFlushTimerID) >= 1.0f)
|
|
{
|
|
if(m_dwClientMode == CLIENT_GAME)
|
|
{
|
|
if(!g_CharacterData.m_lstCharData[g_CharacterData.m_nFocusCharacter]->m_bCharDead && m_bUpdateMove)
|
|
{
|
|
CCreature *lpCreature = g_CharacterData.m_lstCharData[g_CharacterData.m_nFocusCharacter];
|
|
float fDir = lpCreature->m_fDirection - (FLOAT_PHI / 2.0f);
|
|
vector3 vecPos = vector3(lpCreature->m_vecPos.x / 100.0f, lpCreature->m_vecPos.y / 100.0f, lpCreature->m_vecPos.z / 100.0f);
|
|
m_Network.SendMoveUpdatePacket(fDir, vecPos);
|
|
}
|
|
}
|
|
|
|
m_bUpdateMove = !m_bUpdateMove;
|
|
m_Network.m_pSocket->FlushSendBuffer();
|
|
}
|
|
}
|
|
|
|
void CClientMain::Render(void)
|
|
{
|
|
CSceneManager::m_cRenderPolygon = 0;
|
|
CSceneManager::m_cRenderVertex = 0;
|
|
|
|
CSceneManager::m_cRenderSectorPoly = 0;
|
|
CSceneManager::m_cRenderSectorVertex = 0;
|
|
|
|
{
|
|
PROFILE("Render Ready");
|
|
m_BaseGraphicLayer.PrefareRender();
|
|
m_BaseGraphicLayer.GetDevice()->BeginScene();
|
|
}
|
|
|
|
{
|
|
RenderMain();
|
|
}
|
|
|
|
{
|
|
PROFILE("Status Check");
|
|
////////////////////////// ½ºÅ×ÀÌÅͽº üũ
|
|
if(!m_bAdminMode)
|
|
{
|
|
float fUpdate = CFrameTimer::GetUpdateTimer(m_dwCheckStatusTimerID);
|
|
if(fUpdate >= 1.0f)
|
|
{
|
|
if(!m_csStatus.CheckStatus())
|
|
{
|
|
char strText[MAX_PATH];
|
|
strcpy(strText, "[Hack Log] ");
|
|
strcat(strText, g_StringTable.m_strString[901]);
|
|
m_Network.m_pSocket->CharChat(m_dwMyChrID, ClientSocket::ChatType_ClientLog, strText, strlen(strText));
|
|
|
|
MessageBox(NULL, g_StringTable.m_strString[902], g_StringTable.m_strString[21], MB_OK);
|
|
|
|
PostQuitMessage(0);
|
|
}
|
|
}
|
|
}/**/
|
|
}
|
|
|
|
unsigned long dwKindCursor;
|
|
{
|
|
PROFILE("Select Cursor");
|
|
////////////////////////// Ä¿¼ ¼±ÅÃ
|
|
if(m_dwKindCursor == CURSOR_NORMAL)
|
|
{
|
|
if(g_TooltipManager.m_ttRenderTarget)
|
|
dwKindCursor = CURSOR_TOOLTIP;
|
|
else if(g_DeviceInput.GetIsLeftMousePress())
|
|
dwKindCursor = CURSOR_CLICK;
|
|
else
|
|
dwKindCursor = CURSOR_NORMAL;
|
|
|
|
if(m_lpInterface)
|
|
{
|
|
if(m_lpPickItem && g_MessageBoxManager.m_lstMessageBox.empty())
|
|
{
|
|
dwKindCursor = CURSOR_PICKUP;
|
|
} else if(m_lpInterface->m_bPopupShow)
|
|
{
|
|
dwKindCursor = CURSOR_POPUP;
|
|
} else if(m_lpInterface->m_dwNormalTargetChrID != 0xFFFFFFFF)
|
|
{
|
|
if(g_CharacterData.GetClientType(m_lpInterface->m_dwNormalTargetChrID, TRUE) == CT_MONSTER)
|
|
dwKindCursor = CURSOR_ATTACK;
|
|
else
|
|
dwKindCursor = CURSOR_DIALOG;
|
|
}
|
|
}
|
|
} else if(g_ClientMain.m_dwKindCursor == CURSOR_REPAIR)
|
|
{
|
|
dwKindCursor = CURSOR_REPAIR;
|
|
}
|
|
|
|
if(!m_bHardwareCursor && m_bShowCursor)
|
|
{ // ¼ÒÇÁÆ®¿þ¾î Ä¿¼
|
|
POINT *ptMousePos = g_DeviceInput.GetMousePosition();
|
|
m_lpCommonInterface->RenderCursor(m_BaseGraphicLayer.GetDevice(), ptMousePos->x, ptMousePos->y, dwKindCursor);
|
|
}
|
|
}
|
|
|
|
{
|
|
PROFILE("Flip");
|
|
m_BaseGraphicLayer.GetDevice()->EndScene();
|
|
m_BaseGraphicLayer.Flip();
|
|
}
|
|
|
|
{
|
|
PROFILE("Hardware Cursor");
|
|
if(m_bHardwareCursor)
|
|
{ // Çϵå¿þ¾î Ä¿¼
|
|
switch(dwKindCursor)
|
|
{
|
|
case CURSOR_NORMAL:
|
|
::SetCursor(LoadCursor(m_hInstance, MAKEINTRESOURCE(IDC_NORMALCURSOR)));
|
|
break;
|
|
|
|
case CURSOR_CLICK:
|
|
::SetCursor(LoadCursor(m_hInstance, MAKEINTRESOURCE(IDC_CLICKCURSOR)));
|
|
break;
|
|
|
|
case CURSOR_PICKUP:
|
|
::SetCursor(LoadCursor(m_hInstance, MAKEINTRESOURCE(IDC_PICKUP)));
|
|
break;
|
|
|
|
case CURSOR_ATTACK:
|
|
::SetCursor(LoadCursor(m_hInstance, MAKEINTRESOURCE(IDC_ATTACK)));
|
|
break;
|
|
|
|
case CURSOR_DIALOG:
|
|
::SetCursor(LoadCursor(m_hInstance, MAKEINTRESOURCE(IDC_DIALOG)));
|
|
break;
|
|
|
|
case CURSOR_REPAIR:
|
|
::SetCursor(LoadCursor(m_hInstance, MAKEINTRESOURCE(IDC_REPAIR)));
|
|
break;
|
|
|
|
case CURSOR_TOOLTIP:
|
|
::SetCursor(LoadCursor(m_hInstance, MAKEINTRESOURCE(IDC_TOOLTIP)));
|
|
break;
|
|
|
|
case CURSOR_POPUP:
|
|
::SetCursor(LoadCursor(m_hInstance, MAKEINTRESOURCE(IDC_POPUP)));
|
|
break;
|
|
}
|
|
|
|
g_DeviceInput.ShowCursor(g_ClientMain.m_bShowCursor);
|
|
}
|
|
}
|
|
}
|
|
|
|
void CClientMain::RenderMain()
|
|
{
|
|
switch(m_dwClientMode)
|
|
{
|
|
case CLIENT_LOGO:
|
|
m_BaseGraphicLayer.GetDevice()->SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
|
|
m_BaseGraphicLayer.GetDevice()->SetTextureStageState(0, D3DTSS_COLORARG2, D3DTA_DIFFUSE);
|
|
m_BaseGraphicLayer.GetDevice()->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_MODULATE);
|
|
m_BaseGraphicLayer.GetDevice()->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_DIFFUSE);
|
|
m_BaseGraphicLayer.GetDevice()->SetTextureStageState(0, D3DTSS_ALPHAARG2, D3DTA_TEXTURE);
|
|
m_BaseGraphicLayer.GetDevice()->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_MODULATE);
|
|
m_BaseGraphicLayer.GetDevice()->SetTextureStageState(1, D3DTSS_COLOROP, D3DTOP_DISABLE);
|
|
m_BaseGraphicLayer.GetDevice()->SetTextureStageState(1, D3DTSS_ALPHAOP, D3DTOP_DISABLE);
|
|
|
|
m_BaseGraphicLayer.GetDevice()->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
|
|
m_BaseGraphicLayer.GetDevice()->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
|
|
m_BaseGraphicLayer.GetDevice()->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
|
|
|
|
m_BaseGraphicLayer.GetDevice()->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
|
|
m_lpCommonInterface->RenderLogo(m_BaseGraphicLayer.GetDevice());
|
|
break;
|
|
|
|
case CLIENT_MAIN:
|
|
m_BaseGraphicLayer.GetDevice()->SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
|
|
m_BaseGraphicLayer.GetDevice()->SetTextureStageState(0, D3DTSS_COLORARG2, D3DTA_DIFFUSE);
|
|
m_BaseGraphicLayer.GetDevice()->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_MODULATE);
|
|
m_BaseGraphicLayer.GetDevice()->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_DIFFUSE);
|
|
m_BaseGraphicLayer.GetDevice()->SetTextureStageState(0, D3DTSS_ALPHAARG2, D3DTA_TEXTURE);
|
|
m_BaseGraphicLayer.GetDevice()->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_MODULATE);
|
|
m_BaseGraphicLayer.GetDevice()->SetTextureStageState(1, D3DTSS_COLOROP, D3DTOP_DISABLE);
|
|
m_BaseGraphicLayer.GetDevice()->SetTextureStageState(1, D3DTSS_ALPHAOP, D3DTOP_DISABLE);
|
|
|
|
m_BaseGraphicLayer.GetDevice()->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
|
|
m_BaseGraphicLayer.GetDevice()->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
|
|
m_BaseGraphicLayer.GetDevice()->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
|
|
|
|
m_BaseGraphicLayer.GetDevice()->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
|
|
m_lpCommonInterface->RenderMain(m_BaseGraphicLayer.GetDevice());
|
|
break;
|
|
|
|
case CLIENT_NATIONSELECT:
|
|
m_BaseGraphicLayer.GetDevice()->SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
|
|
m_BaseGraphicLayer.GetDevice()->SetTextureStageState(0, D3DTSS_COLORARG2, D3DTA_DIFFUSE);
|
|
m_BaseGraphicLayer.GetDevice()->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_MODULATE);
|
|
m_BaseGraphicLayer.GetDevice()->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_DIFFUSE);
|
|
m_BaseGraphicLayer.GetDevice()->SetTextureStageState(0, D3DTSS_ALPHAARG2, D3DTA_TEXTURE);
|
|
m_BaseGraphicLayer.GetDevice()->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_MODULATE);
|
|
m_BaseGraphicLayer.GetDevice()->SetTextureStageState(1, D3DTSS_COLOROP, D3DTOP_DISABLE);
|
|
m_BaseGraphicLayer.GetDevice()->SetTextureStageState(1, D3DTSS_ALPHAOP, D3DTOP_DISABLE);
|
|
|
|
m_BaseGraphicLayer.GetDevice()->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
|
|
m_BaseGraphicLayer.GetDevice()->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
|
|
m_BaseGraphicLayer.GetDevice()->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
|
|
|
|
m_BaseGraphicLayer.GetDevice()->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
|
|
|
|
m_lpCommonInterface->RenderNationSelect(m_BaseGraphicLayer.GetDevice());
|
|
break;
|
|
|
|
case CLIENT_CHARACTERSELECTLOADING:
|
|
m_BaseGraphicLayer.GetDevice()->SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
|
|
m_BaseGraphicLayer.GetDevice()->SetTextureStageState(0, D3DTSS_COLORARG2, D3DTA_DIFFUSE);
|
|
m_BaseGraphicLayer.GetDevice()->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_MODULATE);
|
|
m_BaseGraphicLayer.GetDevice()->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_DIFFUSE);
|
|
m_BaseGraphicLayer.GetDevice()->SetTextureStageState(0, D3DTSS_ALPHAARG2, D3DTA_TEXTURE);
|
|
m_BaseGraphicLayer.GetDevice()->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_MODULATE);
|
|
m_BaseGraphicLayer.GetDevice()->SetTextureStageState(1, D3DTSS_COLOROP, D3DTOP_DISABLE);
|
|
m_BaseGraphicLayer.GetDevice()->SetTextureStageState(1, D3DTSS_ALPHAOP, D3DTOP_DISABLE);
|
|
|
|
m_BaseGraphicLayer.GetDevice()->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
|
|
m_BaseGraphicLayer.GetDevice()->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
|
|
m_BaseGraphicLayer.GetDevice()->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
|
|
|
|
m_BaseGraphicLayer.GetDevice()->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
|
|
|
|
m_lpCommonInterface->RenderLoading(m_BaseGraphicLayer.GetDevice());
|
|
|
|
m_dwClientMode = CLIENT_CHARACTERSELECT;
|
|
break;
|
|
|
|
case CLIENT_CHARACTERSELECT:
|
|
m_lpInterface->RenderChrSelect(m_BaseGraphicLayer.GetDevice());
|
|
m_lpCommonInterface->RenderLoading(m_BaseGraphicLayer.GetDevice());
|
|
break;
|
|
|
|
case CLIENT_GAMELOADING:
|
|
m_BaseGraphicLayer.GetDevice()->SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
|
|
m_BaseGraphicLayer.GetDevice()->SetTextureStageState(0, D3DTSS_COLORARG2, D3DTA_DIFFUSE);
|
|
m_BaseGraphicLayer.GetDevice()->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_MODULATE);
|
|
m_BaseGraphicLayer.GetDevice()->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_DIFFUSE);
|
|
m_BaseGraphicLayer.GetDevice()->SetTextureStageState(0, D3DTSS_ALPHAARG2, D3DTA_TEXTURE);
|
|
m_BaseGraphicLayer.GetDevice()->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_MODULATE);
|
|
m_BaseGraphicLayer.GetDevice()->SetTextureStageState(1, D3DTSS_COLOROP, D3DTOP_DISABLE);
|
|
m_BaseGraphicLayer.GetDevice()->SetTextureStageState(1, D3DTSS_ALPHAOP, D3DTOP_DISABLE);
|
|
|
|
m_BaseGraphicLayer.GetDevice()->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
|
|
m_BaseGraphicLayer.GetDevice()->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
|
|
m_BaseGraphicLayer.GetDevice()->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
|
|
|
|
m_BaseGraphicLayer.GetDevice()->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
|
|
|
|
m_lpCommonInterface->RenderLoading(m_BaseGraphicLayer.GetDevice());
|
|
|
|
m_dwClientMode = CLIENT_GAME;
|
|
break;
|
|
|
|
case CLIENT_GAME:
|
|
{
|
|
m_lpInterface->RenderGame(m_BaseGraphicLayer.GetDevice());
|
|
}
|
|
|
|
{
|
|
PROFILE("Loading");
|
|
m_lpCommonInterface->RenderLoading(m_BaseGraphicLayer.GetDevice());
|
|
}
|
|
break;
|
|
|
|
case CLIENT_ZONEMOVE:
|
|
m_BaseGraphicLayer.GetDevice()->SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
|
|
m_BaseGraphicLayer.GetDevice()->SetTextureStageState(0, D3DTSS_COLORARG2, D3DTA_DIFFUSE);
|
|
m_BaseGraphicLayer.GetDevice()->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_MODULATE);
|
|
m_BaseGraphicLayer.GetDevice()->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_DIFFUSE);
|
|
m_BaseGraphicLayer.GetDevice()->SetTextureStageState(0, D3DTSS_ALPHAARG2, D3DTA_TEXTURE);
|
|
m_BaseGraphicLayer.GetDevice()->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_MODULATE);
|
|
m_BaseGraphicLayer.GetDevice()->SetTextureStageState(1, D3DTSS_COLOROP, D3DTOP_DISABLE);
|
|
m_BaseGraphicLayer.GetDevice()->SetTextureStageState(1, D3DTSS_ALPHAOP, D3DTOP_DISABLE);
|
|
|
|
m_BaseGraphicLayer.GetDevice()->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
|
|
m_BaseGraphicLayer.GetDevice()->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
|
|
m_BaseGraphicLayer.GetDevice()->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
|
|
|
|
m_BaseGraphicLayer.GetDevice()->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
|
|
|
|
m_lpCommonInterface->RenderLoading(m_BaseGraphicLayer.GetDevice());
|
|
|
|
break;
|
|
}
|
|
|
|
{
|
|
PROFILE("Interface Effect");
|
|
/////////////// ÀÎÅÍÆäÀ̽º ÀÌÆÑÆ®
|
|
DWORD effcullmode;
|
|
DWORD effzmode;
|
|
DWORD effalphamode;
|
|
|
|
m_BaseGraphicLayer.GetDevice()->GetRenderState(D3DRS_CULLMODE,&effcullmode);
|
|
m_BaseGraphicLayer.GetDevice()->GetRenderState(D3DRS_ZENABLE,&effzmode);
|
|
m_BaseGraphicLayer.GetDevice()->GetRenderState(D3DRS_ALPHABLENDENABLE,&effalphamode);
|
|
|
|
CSceneManager::m_EffectManager.RenderInterfaceScript();
|
|
|
|
m_BaseGraphicLayer.GetDevice()->SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
|
|
m_BaseGraphicLayer.GetDevice()->SetTextureStageState(0, D3DTSS_COLORARG2, D3DTA_DIFFUSE);
|
|
m_BaseGraphicLayer.GetDevice()->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_MODULATE);
|
|
m_BaseGraphicLayer.GetDevice()->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_DIFFUSE);
|
|
m_BaseGraphicLayer.GetDevice()->SetTextureStageState(0, D3DTSS_ALPHAARG2, D3DTA_TEXTURE);
|
|
m_BaseGraphicLayer.GetDevice()->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_MODULATE);
|
|
m_BaseGraphicLayer.GetDevice()->SetTextureStageState(1, D3DTSS_COLOROP, D3DTOP_DISABLE);
|
|
m_BaseGraphicLayer.GetDevice()->SetTextureStageState(1, D3DTSS_ALPHAOP, D3DTOP_DISABLE);
|
|
|
|
m_BaseGraphicLayer.GetDevice()->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
|
|
m_BaseGraphicLayer.GetDevice()->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
|
|
|
|
m_BaseGraphicLayer.GetDevice()->SetRenderState(D3DRS_ZFUNC, D3DCMP_ALWAYS);
|
|
m_BaseGraphicLayer.GetDevice()->SetRenderState(D3DRS_FOGENABLE, FALSE);
|
|
m_BaseGraphicLayer.GetDevice()->SetRenderState(D3DRS_LIGHTING, FALSE);
|
|
|
|
m_BaseGraphicLayer.GetDevice()->SetRenderState(D3DRS_TEXTUREFACTOR, 0xFFFFFFFF);
|
|
m_BaseGraphicLayer.GetDevice()->SetRenderState(D3DRS_CULLMODE,effcullmode);
|
|
m_BaseGraphicLayer.GetDevice()->SetRenderState(D3DRS_ZENABLE,effzmode);
|
|
m_BaseGraphicLayer.GetDevice()->SetRenderState(D3DRS_ALPHABLENDENABLE,effalphamode);
|
|
|
|
//ÀüÁ÷½Ã °°ÀÌ ³ª¿À´Â state Ãâ·ÂºÎ
|
|
if(m_ClassEffectPtr != NULL) {
|
|
|
|
if(!CSceneManager::m_EffectManager.CheckNullInterfaceScript(m_ClassEffectPtr)) {
|
|
int change = 0;
|
|
int csvalue = 0;
|
|
|
|
for(int classeffect = 0;classeffect <7;classeffect++) {
|
|
switch(classeffect) {
|
|
case 0:
|
|
change = m_csStatus.m_Info.STR - m_csStatus.m_BeforeInfo.STR;
|
|
csvalue = m_csStatus.m_Info.STR;
|
|
break;
|
|
case 1:
|
|
change = m_csStatus.m_Info.DEX - m_csStatus.m_BeforeInfo.DEX;
|
|
csvalue = m_csStatus.m_Info.DEX;
|
|
break;
|
|
case 2:
|
|
change = m_csStatus.m_Info.INT - m_csStatus.m_BeforeInfo.INT;
|
|
csvalue = m_csStatus.m_Info.INT;
|
|
break;
|
|
case 3:
|
|
change = m_csStatus.m_Info.WIS - m_csStatus.m_BeforeInfo.WIS;
|
|
csvalue = m_csStatus.m_Info.WIS;
|
|
break;
|
|
case 4:
|
|
change = m_csStatus.m_Info.CON - m_csStatus.m_BeforeInfo.CON;
|
|
csvalue = m_csStatus.m_Info.CON;
|
|
break;
|
|
case 5:
|
|
change = m_csStatus.m_Info.HP - m_csStatus.m_BeforeInfo.HP;
|
|
csvalue = m_csStatus.m_Info.HP;
|
|
break;
|
|
case 6:
|
|
change = m_csStatus.m_Info.MP - m_csStatus.m_BeforeInfo.MP;
|
|
csvalue = m_csStatus.m_Info.MP;
|
|
break;
|
|
|
|
}
|
|
if(classeffect < 5) {
|
|
if(change >0)
|
|
m_lpCommonInterface->RenderNumber(m_BaseGraphicLayer.GetDevice(),730,264 + (classeffect*28),(unsigned char)m_ClassEffectAlpha,3,csvalue,0.5f);
|
|
else
|
|
m_lpCommonInterface->RenderNumber(m_BaseGraphicLayer.GetDevice(),730,264 + (classeffect*28),(unsigned char)m_ClassEffectAlpha,0,csvalue,0.5f);
|
|
}
|
|
else {
|
|
if(change >0)
|
|
m_lpCommonInterface->RenderNumber(m_BaseGraphicLayer.GetDevice(),730,292 + (classeffect*24),(unsigned char)m_ClassEffectAlpha,3,csvalue,0.5f);
|
|
else
|
|
m_lpCommonInterface->RenderNumber(m_BaseGraphicLayer.GetDevice(),730,292 + (classeffect*24),(unsigned char)m_ClassEffectAlpha,0,csvalue,0.5f);
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
|
|
{
|
|
PROFILE("Etc Render");
|
|
///////////////////////////////
|
|
if(m_bShowInfo) m_BaseGraphicLayer.ShowState();
|
|
if(!m_lpPickItem)
|
|
g_TooltipManager.Render(m_BaseGraphicLayer.GetDevice());
|
|
}
|
|
}
|
|
|
|
void CClientMain::ProcessLogin(void)
|
|
{
|
|
static bool bConnectionAuthServer = false;
|
|
static bool bConnectionComplete = false;
|
|
|
|
if(!bConnectionComplete)
|
|
{
|
|
if(!bConnectionAuthServer)
|
|
{
|
|
m_Network.ConnectToAuthServer(m_strIP);
|
|
bConnectionAuthServer = true;
|
|
}
|
|
if(bConnectionAuthServer)
|
|
{
|
|
if(m_Network.GetState() == NS_NOWAITING)
|
|
{
|
|
if(m_Network.GetError() == NE_NOERROR)
|
|
{
|
|
bConnectionComplete = true;
|
|
}
|
|
else
|
|
{
|
|
//////////////////////////////////////////////
|
|
//////// ±ú²ýÇÏ°Ô ³ª°¡´Â ÀÌÀ¯ÀÇ ÄÚµå /////////
|
|
//////////////////////////////////////////////
|
|
MessageBox(NULL, g_StringTable.m_strString[25], g_StringTable.m_strString[26], MB_OK);
|
|
PostQuitMessage(0);
|
|
}
|
|
}
|
|
}
|
|
return;
|
|
}
|
|
}
|
|
|
|
void CClientMain::ResetTerrain(void)
|
|
{
|
|
m_lpSceneManager->m_HeightField.m_NowPositionX = -100;
|
|
m_lpSceneManager->m_HeightField.m_NowPositionY = -100;
|
|
m_lpSceneManager->m_HeightField.CheckingNextTerrain();
|
|
m_lpSceneManager->m_HeightField.CheckingTessellate();
|
|
}
|
|
|
|
void CClientMain::EnterClient()
|
|
{
|
|
// Main ȸé Áö¿ì±â
|
|
/////////////////////////////////////////////////////////////////
|
|
m_lpCommonInterface->DestroyMain();
|
|
/////////////////////////////////////////////////////////////////
|
|
|
|
for(int i = 0; i < 3; i++)
|
|
{
|
|
if(g_ClientMain.m_scLoginChar[i].UID)
|
|
{
|
|
/* if(g_ClientMain.m_scLoginChar[i].Nationality != NATION_HUMAN)/* &&
|
|
g_ClientMain.m_scLoginChar[i].Nationality != NATION_AKHAN)*/
|
|
/* {
|
|
MessageBox(NULL, g_StringTable.m_strString[27], g_StringTable.m_strString[21], MB_OK);
|
|
exit(0);
|
|
}*/
|
|
CreateNationInterface(g_ClientMain.m_scLoginChar[i].Nationality);
|
|
g_ClientMain.m_lpInterface->InitChrSelect();
|
|
return;
|
|
}
|
|
}
|
|
|
|
m_dwClientMode = CLIENT_NATIONSELECT;
|
|
m_lpCommonInterface->InitNationSelect();
|
|
}
|
|
|
|
BOOL CClientMain::CreateNationInterface(unsigned long dwNation)
|
|
{
|
|
switch(dwNation)
|
|
{
|
|
case NATION_HUMAN:
|
|
g_ClientMain.m_lpInterface = new CHumanGUI;
|
|
break;
|
|
|
|
case NATION_AKHAN:
|
|
g_ClientMain.m_lpInterface = new CAkhanGUI;
|
|
break;
|
|
|
|
case NATION_UNKNONE:
|
|
g_ClientMain.m_lpInterface = NULL;
|
|
break;
|
|
}
|
|
|
|
if(g_ClientMain.m_lpInterface)
|
|
{
|
|
g_CharacterData.PickItem = g_ClientMain.m_lpInterface->PickItem;
|
|
m_dwClientNation = dwNation;
|
|
return TRUE;
|
|
}
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
void CClientMain::SetDayTimer()
|
|
{
|
|
unsigned long dwNowTime = GetTickCount();
|
|
unsigned long dwInter = dwNowTime - g_ClientMain.m_dwStartTime;
|
|
dwInter = dwInter + g_ClientMain.m_dwServerTime;
|
|
|
|
dwInter = dwInter % 3600000;
|
|
float fDayTime = (dwInter / 3600000.0f) * 24.0f;
|
|
|
|
if(m_dwPresentZone == 100)
|
|
{
|
|
fDayTime=17.0f;
|
|
} else
|
|
{
|
|
fDayTime=13.0f;
|
|
}
|
|
|
|
m_lpSceneManager->SetWeatherTime(fDayTime);
|
|
}
|
|
|
|
void CClientMain::AddFieldObject(LPFieldObject lpObject)
|
|
{
|
|
list<LPFieldInstance>::iterator it;
|
|
for(it = m_lstFieldItem.begin(); it != m_lstFieldItem.end(); it++)
|
|
{
|
|
if((*it)->m_dwOID == lpObject->m_dwOID) return;
|
|
}
|
|
|
|
LPFieldInstance lpAdd = new FieldInstance;
|
|
vector3 vecPos;
|
|
lpAdd->m_dwOID = lpObject->m_dwOID;
|
|
vecPos.x = lpObject->m_Pos.fPointX * 100.0f;
|
|
vecPos.z = lpObject->m_Pos.fPointZ * 100.0f;
|
|
vecPos.y = 0.0f;
|
|
vecPos.y = m_lpSceneManager->m_HeightField.GetHeight(vecPos) + 15.0f;
|
|
lpAdd->m_dwTypeID = lpObject->m_dwTypeID;
|
|
lpAdd->m_cNum = lpObject->m_cNum;
|
|
lpAdd->m_lLifeTick = 590000;
|
|
lpAdd->m_Pos.fPointX = vecPos.x;
|
|
lpAdd->m_Pos.fPointY = vecPos.y;
|
|
lpAdd->m_Pos.fPointZ = vecPos.z;
|
|
|
|
if(lpObject->m_dwTypeID & FieldObject::Gold) // µ·
|
|
{
|
|
lpAdd->m_dwInstanceID = m_lpSceneManager->AddInstanceObject("0000.R3S", vecPos);
|
|
} else // ¾ÆÀÌÅÛ
|
|
{
|
|
const Item::ItemInfo *lpProtoType = g_ItemMgr.GetItemInfo(lpObject->m_dwTypeID);
|
|
if(lpProtoType)
|
|
{
|
|
lpAdd->m_dwInstanceID = m_lpSceneManager->AddInstanceObject((char *)lpProtoType->m_StringData.m_szFieldModelName, vecPos);
|
|
} else
|
|
{
|
|
delete lpAdd;
|
|
return;
|
|
}
|
|
}
|
|
|
|
m_lstFieldItem.push_back(lpAdd);
|
|
}
|
|
|
|
void CClientMain::DeleteFieldObject(unsigned long dwFieldInstanceID)
|
|
{
|
|
list<LPFieldInstance>::iterator it;
|
|
for(it = m_lstFieldItem.begin(); it != m_lstFieldItem.end(); it++)
|
|
{
|
|
if((*it)->m_dwOID == dwFieldInstanceID)
|
|
{
|
|
LPFieldInstance lpInstance = (*it);
|
|
m_lpSceneManager->DeleteInstanceObject(lpInstance->m_dwInstanceID);
|
|
m_lstFieldItem.erase(it);
|
|
delete lpInstance;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
LPFieldInstance CClientMain::GetFieldObject(unsigned long dwFieldInstanceID)
|
|
{
|
|
list<LPFieldInstance>::iterator it;
|
|
for(it = m_lstFieldItem.begin(); it != m_lstFieldItem.end(); it++)
|
|
{
|
|
if((*it)->m_dwInstanceID == dwFieldInstanceID)
|
|
{
|
|
return (*it);
|
|
}
|
|
}
|
|
|
|
return NULL;
|
|
}
|
|
|
|
char *CClientMain::GetMotionSheet(char *strWeaponName, char *strShieldName, unsigned short wClass)
|
|
{
|
|
if(strWeaponName == NULL || !strcmp(strWeaponName, ""))
|
|
{
|
|
strcpy(m_strSheet, "NO_WEAPON_B");
|
|
return m_strSheet;
|
|
}
|
|
|
|
unsigned long dwDualWeapon = 0;
|
|
const Item::ItemInfo *lpItemBase = g_ItemMgr.GetItemInfoFromEquipName(strWeaponName);
|
|
const Item::ItemInfo *lpItemBase2 = g_ItemMgr.GetItemInfoFromEquipName(strShieldName);
|
|
if(lpItemBase2)
|
|
{
|
|
switch(lpItemBase2->m_DetailData.m_cItemType)
|
|
{
|
|
case Item::CItemType::AXE:
|
|
case Item::CItemType::SWORD:
|
|
case Item::CItemType::BLUNT:
|
|
if(wClass == 6) dwDualWeapon = 1;
|
|
break;
|
|
|
|
case Item::CItemType::DAGGER:
|
|
if(wClass == 7) dwDualWeapon = 2;
|
|
break;
|
|
|
|
case Item::CItemType::SKILL_A_KNIFE:
|
|
if(wClass == 24) dwDualWeapon = 3;
|
|
break;
|
|
}
|
|
}
|
|
|
|
if(lpItemBase)
|
|
{
|
|
switch(lpItemBase->m_DetailData.m_cItemType)
|
|
{
|
|
case Item::CItemType::AXE:
|
|
case Item::CItemType::SWORD:
|
|
case Item::CItemType::BLUNT:
|
|
if(dwDualWeapon == 1)
|
|
strcpy(m_strSheet, "WEAPON_2DO");
|
|
else
|
|
strcpy(m_strSheet, "WEAPON_ONE_HAND");
|
|
break;
|
|
|
|
case Item::CItemType::COM_SWORD:
|
|
case Item::CItemType::COM_BLUNT:
|
|
case Item::CItemType::OPP_AXE:
|
|
case Item::CItemType::OPP_HAMMER:
|
|
case Item::CItemType::OPP_SLUSHER:
|
|
strcpy(m_strSheet, "WEAPON_ONE_HAND");
|
|
break;
|
|
|
|
case Item::CItemType::OPP_SYTHE:
|
|
strcpy(m_strSheet, "WEAPON_SICKLE");
|
|
break;
|
|
|
|
case Item::CItemType::OPP_TALON:
|
|
if(wClass == 24)
|
|
/* if(dwDualWeapon == 3)
|
|
strcpy(m_strSheet, "WEAPON_2CLAW");
|
|
else*/
|
|
strcpy(m_strSheet, "WEAPON_SHADOW_OFF");
|
|
else
|
|
strcpy(m_strSheet, "WEAPON_CLAW");
|
|
break;
|
|
|
|
case Item::CItemType::STAFF:
|
|
strcpy(m_strSheet, "WEAPON_STAFF");
|
|
break;
|
|
|
|
case Item::CItemType::TWOHANDED_BLUNT:
|
|
case Item::CItemType::TWOHANDED_AXE:
|
|
strcpy(m_strSheet, "WEAPON_BLUNT");
|
|
break;
|
|
|
|
case Item::CItemType::BOW:
|
|
strcpy(m_strSheet, "WEAPON_BOW");
|
|
break;
|
|
|
|
case Item::CItemType::CROSSBOW:
|
|
strcpy(m_strSheet, "WEAPON_CROSSBOW");
|
|
break;
|
|
|
|
case Item::CItemType::DAGGER:
|
|
if(wClass == 2 || wClass == 7) // Rogue, Archer, Assasin
|
|
{
|
|
if(wClass == 7 && dwDualWeapon == 2)
|
|
strcpy(m_strSheet, "WEAPON_2DA");
|
|
else
|
|
strcpy(m_strSheet, "CLASS_ROGUE");
|
|
}
|
|
else/**/
|
|
strcpy(m_strSheet, "WEAPON_DAGGER");
|
|
break;
|
|
|
|
case Item::CItemType::TWOHANDED_SWORD:
|
|
strcpy(m_strSheet, "WEAPON_TWO_HAND");
|
|
break;
|
|
|
|
default:
|
|
strcpy(m_strSheet, "NO_WEAPON_B");
|
|
break;
|
|
}
|
|
} else
|
|
{
|
|
strcpy(m_strSheet, "NO_WEAPON_B");
|
|
}
|
|
|
|
return m_strSheet;
|
|
}
|
|
|
|
unsigned long CClientMain::GetWeaponType(char *strWeaponName)
|
|
{
|
|
if(strWeaponName == NULL || !strcmp(strWeaponName, "")) return 0;
|
|
|
|
const Item::ItemInfo *lpItemBase = g_ItemMgr.GetItemInfoFromEquipName((char *)strWeaponName);
|
|
|
|
if(lpItemBase)
|
|
{
|
|
switch(lpItemBase->m_DetailData.m_cItemType)
|
|
{
|
|
case Item::CItemType::AXE:
|
|
case Item::CItemType::SWORD:
|
|
case Item::CItemType::BLUNT:
|
|
case Item::CItemType::STAFF:
|
|
case Item::CItemType::TWOHANDED_BLUNT:
|
|
case Item::CItemType::TWOHANDED_AXE:
|
|
case Item::CItemType::BOW:
|
|
case Item::CItemType::CROSSBOW:
|
|
case Item::CItemType::DAGGER:
|
|
case Item::CItemType::TWOHANDED_SWORD:
|
|
return lpItemBase->m_DetailData.m_cItemType;
|
|
}
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
BOOL CClientMain::GetSpeedHack()
|
|
{
|
|
if(FindWindow("#32770", "½ºÇǵåÇÙ Ver 1.0 ")) return TRUE;
|
|
if(FindWindow("#32770", "Speed Hack - PCGameHacks.com")) return TRUE;
|
|
if(FindWindow("#32770", " ")) return TRUE;
|
|
if(FindWindow("#32770", "ô¸ÍöñýàòÊ¥áÜÐï")) return TRUE;
|
|
if(FindWindow("#32770", "Brothers Speeder")) return TRUE;
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
bool CClientMain::CheckSoundBufferSpeedHack()
|
|
{
|
|
static bool bFirstPlay=false;
|
|
static int nBuffer=-1;
|
|
static int nError=0;
|
|
|
|
if(bFirstPlay==false)
|
|
{
|
|
char strSoundFile[256];
|
|
sprintf(strSoundFile,"%s\\%s",g_ClientMain.m_strClientPath,"Zone0.z3s");
|
|
CSoundManager &sm = CSoundManager::GetInstance();
|
|
CSoundBuffer * pSndBuf = new CSoundBuffer();
|
|
pSndBuf->Create( sm.GetDirectSound().GetDS(),strSoundFile,false,1);
|
|
m_CheckSoundBuffer= pSndBuf;
|
|
nBuffer=m_CheckSoundBuffer->Play(false);
|
|
m_dwSoundTickCount=GetTickCount();
|
|
bFirstPlay=true;
|
|
|
|
}
|
|
|
|
if(m_CheckSoundBuffer->IsPlaying(nBuffer)==false)
|
|
{
|
|
DWORD dwNowTime=GetTickCount();
|
|
/*
|
|
CGUIMessageBox *lpMessageBox;
|
|
lpMessageBox = new CGUIMessageBox;
|
|
char strValue[256];
|
|
sprintf(strValue,"%f Speed",(float)dwNowTime-(float)m_dwSoundTickCount);
|
|
lpMessageBox->Create(strValue);
|
|
*/
|
|
|
|
if(((float)dwNowTime-(float)m_dwSoundTickCount) > 3100.0f)
|
|
{
|
|
return true;
|
|
/*
|
|
nError++;
|
|
if(nError>0)
|
|
*/
|
|
|
|
}
|
|
m_CheckSoundBuffer->Play(false);
|
|
m_dwSoundTickCount=GetTickCount();
|
|
}
|
|
return false;
|
|
}
|
|
|
|
unsigned long CClientMain::GetScreenPosChr(POINT &Point, int nMode, float fLength)
|
|
{
|
|
if(nMode == Skill::Target::FRIEND)
|
|
{
|
|
if(g_DeviceInput.KeyHold(VK_CONTROL) || fLength <= 100.0f) return m_dwMyChrID;
|
|
}
|
|
|
|
if(nMode == Skill::Target::ENEMY && fLength <= 100.0f)
|
|
{
|
|
return m_dwMyChrID;
|
|
}
|
|
|
|
if(nMode == Skill::Target::PARTY)
|
|
{
|
|
return m_dwMyChrID;
|
|
}
|
|
float fMinLength = 0.0f;
|
|
int iMinChr = 0;
|
|
|
|
vector3 vecChrPos;
|
|
|
|
for(int cChr = 0;cChr < g_CharacterData.m_lstCharData.num;cChr++)
|
|
{
|
|
vecChrPos = *g_CharacterData.m_lstCharData[cChr]->GetPosition();
|
|
vecChrPos.y += 100.0f;
|
|
|
|
D3DXVECTOR3 vecChrDXPos = D3DXVECTOR3(vecChrPos.x,vecChrPos.y,vecChrPos.z);
|
|
float fScreenx;
|
|
float fScreeny;
|
|
|
|
ProjectPt(&vecChrDXPos,&fScreenx,&fScreeny);
|
|
D3DXVECTOR3 vecLength = D3DXVECTOR3(fScreenx - Point.x,fScreeny - Point.y,0.0f);
|
|
float fLength = D3DXVec3Length(&vecLength);
|
|
|
|
if(cChr == 0)
|
|
{
|
|
iMinChr = 0;
|
|
fMinLength = fLength;
|
|
}
|
|
else if(fMinLength > fLength)
|
|
{
|
|
iMinChr = cChr;
|
|
fMinLength = fLength;
|
|
}
|
|
}
|
|
|
|
|
|
/*
|
|
// CZ3DGeneralChrModel *pSelectChr = m_lpSceneManager->PickingCharacter(Point.x, Point.y);
|
|
|
|
m_lpSceneManager->PickMakeRay(Point.x, Point.y, m_BaseGraphicLayer.m_lScreenSx, m_BaseGraphicLayer.m_lScreenSy);
|
|
|
|
vector3 vecChrPos;
|
|
|
|
float fRad = 50.0f;
|
|
float fNearestInterval = 100.0f;
|
|
|
|
vector3 vecMousePos;
|
|
vecMousePos.x = Point.x;
|
|
vecMousePos.y = Point.y;
|
|
vecMousePos.z = 0.0f;
|
|
|
|
vector3 vecLens, vecResult;
|
|
vector3 vecViewPos = *m_lpSceneManager->GetCamera()->GetPosition();
|
|
float fW;
|
|
|
|
for(int cChr = 0; cChr < g_CharacterData.m_lstCharData.num; cChr++)
|
|
{
|
|
vecChrPos = *g_CharacterData.m_lstCharData[cChr]->GetPosition();
|
|
vecChrPos.y += 100.0f;
|
|
|
|
if(m_BaseGraphicLayer.TransformVector(vecChrPos, vecResult, fW))
|
|
{
|
|
if(vecResult.z < 0.0f || vecResult.z > 1.0f) continue;
|
|
|
|
vecLens = vecViewPos - vecChrPos;
|
|
float fInterCamera = vecLens.GetLens();
|
|
float fZRate = -(fInterCamera / 10000.0f) + 1;
|
|
vecResult.z = 0.0f;
|
|
vecLens = vecMousePos - vecResult;
|
|
|
|
if(vecLens.GetLens() <= fRad * fZRate)
|
|
{
|
|
CCreature *lpCreature = g_CharacterData.GetCreature(g_CharacterData.m_lstCharData[cChr]->m_dwChrID);
|
|
if(!lpCreature) return 0xFFFFFFFF;
|
|
|
|
if(m_dwMyChrID == lpCreature->m_dwChrID) continue;
|
|
|
|
unsigned dwResult = g_CharacterData.GetClientType(lpCreature->m_dwChrID, TRUE);
|
|
switch(nMode)
|
|
{
|
|
case Skill::Target::MELEE:
|
|
if(dwResult != CT_MONSTER || lpCreature->m_bCharDead) continue;
|
|
break;
|
|
|
|
case Skill::Target::FRIEND:
|
|
if(dwResult != CT_PC || lpCreature->m_bCharDead) continue;
|
|
break;
|
|
|
|
case Skill::Target::ENEMY:
|
|
if(dwResult != CT_MONSTER || lpCreature->m_bCharDead) continue;
|
|
break;
|
|
|
|
case Skill::Target::DEAD_FRIEND:
|
|
if(dwResult != CT_PC || !lpCreature->m_bCharDead) continue;
|
|
break;
|
|
|
|
case Skill::Target::DEAD_ENEMY:
|
|
if(dwResult != CT_MONSTER || !lpCreature->m_bCharDead) continue;
|
|
break;
|
|
|
|
case Skill::Target::FRIEND_OBJECT:
|
|
if(dwResult != CT_PC || lpCreature->m_bCharDead) continue;
|
|
break;
|
|
|
|
case Skill::Target::ENEMY_OBJECT:
|
|
if(dwResult != CT_MONSTER || lpCreature->m_bCharDead) continue;
|
|
break;
|
|
|
|
case Skill::Target::FRIEND_EXCEPT_SELF:
|
|
if(dwResult != CT_PC || lpCreature->m_bCharDead || lpCreature->m_dwChrID == m_dwMyChrID) continue;
|
|
break;
|
|
|
|
case Skill::Target::LINE_ENEMY:
|
|
if(dwResult != CT_MONSTER || lpCreature->m_bCharDead) continue;
|
|
break;
|
|
|
|
case TARGET_SELECTCHAR:
|
|
return lpCreature->m_dwChrID;
|
|
|
|
default:
|
|
if(lpCreature->m_bCharDead) continue;
|
|
break;
|
|
}
|
|
|
|
vector3 vecPos = lpCreature->m_vecPos;
|
|
vecPos.y = 0.0f;
|
|
vector3 vecSelf = g_CharacterData.m_lstCharData[g_CharacterData.m_nFocusCharacter]->m_vecPos;
|
|
vecSelf.y = 0.0f;
|
|
vecSelf -= vecPos;
|
|
|
|
if(vecSelf.GetLens() <= fLength) return lpCreature->m_dwChrID;
|
|
}
|
|
}
|
|
}
|
|
*/
|
|
return 0xFFFFFFFF;
|
|
/* return pResult;
|
|
|
|
if(pSelectChr)
|
|
{
|
|
CCreature *lpCreature = g_CharacterData.GetCreature(pSelectChr);
|
|
if(!lpCreature) return 0xFFFFFFFF;
|
|
|
|
if(m_dwMyChrID == lpCreature->m_dwChrID) return 0xFFFFFFFF;
|
|
|
|
unsigned dwResult = g_CharacterData.GetClientType(lpCreature->m_dwChrID);
|
|
switch(nMode)
|
|
{
|
|
case Skill::Target::MELEE:
|
|
if(dwResult != CT_MONSTER || lpCreature->m_bCharDead) return 0xFFFFFFFF;
|
|
break;
|
|
|
|
case Skill::Target::FRIEND:
|
|
if(dwResult != CT_PC || lpCreature->m_bCharDead) return 0xFFFFFFFF;
|
|
break;
|
|
|
|
case Skill::Target::ENEMY:
|
|
if(dwResult != CT_MONSTER || lpCreature->m_bCharDead) return 0xFFFFFFFF;
|
|
break;
|
|
|
|
case Skill::Target::DEAD_FRIEND:
|
|
if(dwResult != CT_PC || !lpCreature->m_bCharDead) return 0xFFFFFFFF;
|
|
break;
|
|
|
|
case Skill::Target::DEAD_ENEMY:
|
|
if(dwResult != CT_MONSTER || !lpCreature->m_bCharDead) return 0xFFFFFFFF;
|
|
break;
|
|
|
|
case Skill::Target::FRIEND_OBJECT:
|
|
if(dwResult != CT_PC || lpCreature->m_bCharDead) return 0xFFFFFFFF;
|
|
break;
|
|
|
|
case Skill::Target::ENEMY_OBJECT:
|
|
if(dwResult != CT_MONSTER || lpCreature->m_bCharDead) return 0xFFFFFFFF;
|
|
break;
|
|
|
|
case Skill::Target::PARTY:
|
|
return m_dwMyChrID;
|
|
|
|
case Skill::Target::FRIEND_EXCEPT_SELF:
|
|
if(dwResult != CT_PC || lpCreature->m_bCharDead || lpCreature->m_dwChrID == m_dwMyChrID) return 0xFFFFFFFF;
|
|
break;
|
|
|
|
case Skill::Target::LINE_ENEMY:
|
|
if(dwResult != CT_MONSTER || lpCreature->m_bCharDead) return 0xFFFFFFFF;
|
|
break;
|
|
|
|
case TARGET_SELECTCHAR:
|
|
return lpCreature->m_dwChrID;
|
|
|
|
default:
|
|
if(lpCreature->m_bCharDead) return 0xFFFFFFFF;
|
|
break;
|
|
}
|
|
|
|
vector3 vecPos = lpCreature->m_vecPos;
|
|
vecPos.y = 0.0f;
|
|
vector3 vecSelf = g_CharacterData.m_lstCharData[g_CharacterData.m_nFocusCharacter]->m_vecPos;
|
|
vecSelf.y = 0.0f;
|
|
vecSelf -= vecPos;
|
|
|
|
if(vecSelf.GetLens() <= fLength) return lpCreature->m_dwChrID;
|
|
}*/
|
|
}
|
|
|
|
void CClientMain::CheckTargetforSkill(unsigned long &dwTargetID, BOOL bCheckLength)
|
|
{
|
|
const Skill::ProtoType *lpSkill;
|
|
CCreature *lpCreature = NULL;
|
|
|
|
if(g_ClientMain.m_csStatus.m_lpQuickSelected)
|
|
{
|
|
lpSkill = g_SkillMgr.GetSkillProtoType(g_ClientMain.m_csStatus.m_lpQuickSelected->GetProtoTypeID());
|
|
if(!lpSkill)
|
|
{
|
|
goto ExitTarget;
|
|
}
|
|
|
|
lpSkill = &lpSkill[g_ClientMain.m_csStatus.m_lpQuickSelected->GetMaxDurability()];
|
|
g_CharacterData.m_fSkillLength = lpSkill->m_EffectDistance * 100.0f;
|
|
} else
|
|
{
|
|
goto ExitTarget;
|
|
}
|
|
|
|
if(lpSkill->m_eTargetType == Skill::Target::PARTY)
|
|
{
|
|
dwTargetID = g_ClientMain.m_dwMyChrID;
|
|
return;
|
|
}
|
|
|
|
if(lpSkill->m_eTargetType == Skill::Target::ENEMY && lpSkill->m_EffectDistance <= 1.0f)
|
|
{
|
|
dwTargetID = g_ClientMain.m_dwMyChrID;
|
|
return;
|
|
}
|
|
|
|
if(lpSkill->m_eTargetType != Skill::Target::FRIEND && dwTargetID == g_ClientMain.m_dwMyChrID) goto ExitTarget;
|
|
|
|
if(lpSkill->m_eTargetType == Skill::Target::FRIEND)
|
|
{
|
|
if(g_DeviceInput.KeyHold(VK_CONTROL) || lpSkill->m_EffectDistance <= 1.0f)
|
|
{
|
|
dwTargetID = g_ClientMain.m_dwMyChrID;
|
|
return;
|
|
}
|
|
}
|
|
|
|
lpCreature = g_CharacterData.GetCreature(dwTargetID);
|
|
if(lpCreature)
|
|
{
|
|
unsigned dwResult = g_CharacterData.GetClientType(lpCreature->m_dwChrID, TRUE);
|
|
|
|
switch(lpSkill->m_eTargetType)
|
|
{
|
|
case Skill::Target::MELEE:
|
|
if(dwResult != CT_MONSTER || lpCreature->m_bCharDead) goto ExitTarget;
|
|
break;
|
|
|
|
case Skill::Target::FRIEND:
|
|
if(dwResult != CT_PC || lpCreature->m_bCharDead) goto ExitTarget;
|
|
break;
|
|
|
|
case Skill::Target::ENEMY:
|
|
if(dwResult != CT_MONSTER || lpCreature->m_bCharDead) goto ExitTarget;
|
|
break;
|
|
|
|
case Skill::Target::DEAD_FRIEND:
|
|
if(dwResult != CT_PC || !lpCreature->m_bCharDead) goto ExitTarget;
|
|
break;
|
|
|
|
case Skill::Target::DEAD_ENEMY:
|
|
if(dwResult != CT_MONSTER || !lpCreature->m_bCharDead) goto ExitTarget;
|
|
break;
|
|
|
|
case Skill::Target::FRIEND_OBJECT:
|
|
if(dwResult != CT_PC || lpCreature->m_bCharDead) goto ExitTarget;
|
|
break;
|
|
|
|
case Skill::Target::ENEMY_OBJECT:
|
|
if(dwResult != CT_MONSTER || lpCreature->m_bCharDead) goto ExitTarget;
|
|
break;
|
|
|
|
case Skill::Target::FRIEND_EXCEPT_SELF:
|
|
if(dwResult != CT_PC || lpCreature->m_bCharDead || lpCreature->m_dwChrID == g_ClientMain.m_dwMyChrID) goto ExitTarget;
|
|
break;
|
|
|
|
case Skill::Target::LINE_ENEMY:
|
|
if(dwResult != CT_MONSTER || lpCreature->m_bCharDead) goto ExitTarget;
|
|
break;
|
|
|
|
default:
|
|
if(lpCreature->m_bCharDead) goto ExitTarget;
|
|
break;
|
|
}
|
|
|
|
if(bCheckLength)
|
|
{
|
|
vector3 vecLen = lpCreature->m_vecPos - g_CharacterData.m_lstCharData[g_CharacterData.m_nFocusCharacter]->m_vecPos;
|
|
vecLen.y = 0.0f;
|
|
|
|
if(vecLen.GetLens() <= lpSkill->m_EffectDistance * 100.0f) return;
|
|
} else
|
|
{
|
|
return;
|
|
}
|
|
}
|
|
|
|
ExitTarget:
|
|
|
|
dwTargetID = 0xFFFFFFFF;
|
|
return;
|
|
}
|
|
|
|
void CClientMain::ProcessScreenshot()
|
|
{
|
|
LPDIRECT3DSURFACE8 frontbuf; //this is our pointer to the memory location containing our copy of the front buffer
|
|
D3DDISPLAYMODE dmDisplay;
|
|
|
|
CSceneManager::m_cRenderPolygon = 0;
|
|
CSceneManager::m_cRenderVertex = 0;
|
|
CSceneManager::m_cRenderSectorPoly = 0;
|
|
CSceneManager::m_cRenderSectorVertex = 0;
|
|
|
|
m_BaseGraphicLayer.PrefareRender();
|
|
m_BaseGraphicLayer.GetDevice()->BeginScene();
|
|
|
|
RenderMain();
|
|
|
|
SYSTEMTIME pSystemTime;
|
|
TCHAR strFilename[MAX_PATH], strTemp[MAX_PATH], strMessage[MAX_PATH];
|
|
GetLocalTime(&pSystemTime);
|
|
strcpy(strTemp, g_ClientMain.m_csStatus.m_Info.Name);
|
|
strcat(strTemp, "_");
|
|
if(strcmp(g_ClientMain.m_csStatus.m_Info.Name, ""))
|
|
{
|
|
sprintf(strTemp, "%s_%04d_%02d_%02d_%02d_%02d(%d).jpg", g_ClientMain.m_csStatus.m_Info.Name,
|
|
pSystemTime.wYear, pSystemTime.wMonth, pSystemTime.wDay, pSystemTime.wHour, pSystemTime.wMinute,
|
|
g_ClientMain.m_dwNumScreenShot);
|
|
} else
|
|
{
|
|
sprintf(strTemp, "RiskYourLife_%04d_%02d_%02d_%02d_%02d(%d).jpg",
|
|
pSystemTime.wYear, pSystemTime.wMonth, pSystemTime.wDay, pSystemTime.wHour, pSystemTime.wMinute,
|
|
g_ClientMain.m_dwNumScreenShot);
|
|
}
|
|
|
|
RECT rcRect = { 3, 465, 800, 480 };
|
|
sprintf(strMessage, g_StringTable.m_strString[29], strTemp);
|
|
g_TextEdit.DrawText(strMessage, &rcRect, DT_LEFT | DT_VCENTER, D3DCOLOR_RGBA(255, 222, 0, 255));
|
|
|
|
m_BaseGraphicLayer.GetDevice()->EndScene();
|
|
m_BaseGraphicLayer.Flip();
|
|
|
|
m_BaseGraphicLayer.GetDevice()->GetDisplayMode(&dmDisplay);
|
|
//now we create the image that our screen shot will be copied into
|
|
//NOTE: Surface format of the front buffer is D3DFMT_A8R8G8B8 when it is returned
|
|
m_BaseGraphicLayer.GetDevice()->CreateImageSurface(dmDisplay.Width, dmDisplay.Height, D3DFMT_A8R8G8B8, &frontbuf);
|
|
|
|
//now we copy the front buffer into our surface
|
|
HRESULT hr = m_BaseGraphicLayer.GetDevice()->GetFrontBuffer(frontbuf);
|
|
|
|
//error checking
|
|
if(hr != D3D_OK)
|
|
{
|
|
//do error handling etc...
|
|
frontbuf->Release(); //release the surface so there is no memory leak
|
|
//g_TextEdit.AddMessage("ȸéÀÌ Ä¸ÃÄ µÇÁö ¾Ê¾Ò½À´Ï´Ù.", g_ClientMain.m_dwMyChrID, 129);
|
|
} else
|
|
{
|
|
sprintf(strFilename, "%s\\ScreenShots\\%s", g_ClientMain.m_strClientPath, strTemp);
|
|
HANDLE hFile = CreateFile(strFilename, GENERIC_WRITE, FILE_SHARE_WRITE, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_OVERLAPPED, NULL);
|
|
if(hFile == INVALID_HANDLE_VALUE)
|
|
{
|
|
char strDirTemp[MAX_PATH];
|
|
sprintf(strDirTemp, "%s\\ScreenShots", g_ClientMain.m_strClientPath);
|
|
if(!CreateDirectory(strDirTemp, NULL))
|
|
{
|
|
frontbuf->Release();
|
|
//g_TextEdit.AddMessage("Æú´õ°¡ ¸¸µé¾î ÁöÁö ¾Ê¾Ò½À´Ï´Ù.", g_ClientMain.m_dwMyChrID, 129);
|
|
return;
|
|
}
|
|
}
|
|
CloseHandle(hFile);
|
|
|
|
if(!m_lpCommonInterface->EncodeJPGFile(strFilename, frontbuf))
|
|
{
|
|
//g_TextEdit.AddMessage("ÈÀÏ »ý¼º¿¡ ½ÇÆÐÇÏ¿´½À´Ï´Ù.", g_ClientMain.m_dwMyChrID, 129);
|
|
}
|
|
|
|
//release the surface so there is no memory leak
|
|
frontbuf->Release();
|
|
|
|
g_ClientMain.m_dwNumScreenShot++;
|
|
}
|
|
}
|
|
|
|
BOOL CClientMain::CheckSkillStart(BOOL bDown)
|
|
{
|
|
BOOL bAble = FALSE;
|
|
|
|
if(g_ClientMain.m_csStatus.m_lpQuickSelected)
|
|
{
|
|
if(g_ClientMain.m_csStatus.m_lpQuickSelected->GetSkillType() == Skill::Type::CHANT ||
|
|
g_ClientMain.m_csStatus.m_lpQuickSelected->GetSkillType() == Skill::Type::PASSIVE)
|
|
{
|
|
return FALSE;
|
|
}
|
|
} else
|
|
{
|
|
return FALSE;
|
|
}
|
|
|
|
if(bDown)
|
|
{
|
|
unsigned long dwFunction = 0;
|
|
if(g_DeviceInput.GetIsRightMousePress())
|
|
{
|
|
if(g_ClientMain.m_csStatus.m_lpQuickSelected->GetProtoTypeID() != 0x9502) // ÆÄÀ̾ ¿¬»ç
|
|
{
|
|
if(g_DeviceInput.GetIsRightMouseDown())
|
|
{
|
|
g_ClientMain.m_dwFunction = dwFunction;
|
|
bAble = TRUE;
|
|
}
|
|
} else
|
|
{
|
|
g_ClientMain.m_dwFunction = dwFunction;
|
|
bAble = TRUE;
|
|
}
|
|
}
|
|
else if(g_DeviceInput.KeyDown(VK_F2)) dwFunction = 2;
|
|
else if(g_DeviceInput.KeyDown(VK_F3)) dwFunction = 3;
|
|
else if(g_DeviceInput.KeyDown(VK_F4)) dwFunction = 4;
|
|
else if(g_DeviceInput.KeyDown(VK_F5)) dwFunction = 5;
|
|
else if(g_DeviceInput.KeyDown(VK_F6)) dwFunction = 6;
|
|
else if(g_DeviceInput.KeyDown(VK_F7)) dwFunction = 7;
|
|
else if(g_DeviceInput.KeyDown(VK_F8)) dwFunction = 8;
|
|
else if(g_DeviceInput.KeyDown(VK_F9)) dwFunction = 9;
|
|
else if(g_DeviceInput.KeyDown(VK_F10)) dwFunction = 10;
|
|
|
|
if(dwFunction)
|
|
{
|
|
const Skill::ProtoType *lpSkillType = g_SkillMgr.GetSkillProtoType(g_ClientMain.m_csStatus.m_lpQuickSelected->GetProtoTypeID());
|
|
if(lpSkillType)
|
|
{
|
|
if((lpSkillType->m_eTargetType == Skill::Target::FRIEND && lpSkillType->m_EffectDistance > 0.0f) ||
|
|
lpSkillType->m_eTargetType == Skill::Target::FRIEND_EXCEPT_SELF)
|
|
{
|
|
int count = 1;
|
|
for(int i = 0; i < g_ClientMain.m_csStatus.m_PartyInfo.m_cMemberNum; i++)
|
|
{
|
|
if(g_ClientMain.m_csStatus.m_PartyInfo.ServerID[i])
|
|
{
|
|
if(g_ClientMain.m_csStatus.m_PartyInfo.MemberCID[i] != g_ClientMain.m_dwMyChrID)
|
|
{
|
|
// ŸÀÎ
|
|
count++;
|
|
}
|
|
}
|
|
|
|
if(count == dwFunction)
|
|
{
|
|
unsigned long dwTarget = g_ClientMain.m_csStatus.m_PartyInfo.MemberCID[i];
|
|
CheckTargetforSkill(dwTarget, TRUE);
|
|
|
|
if(dwTarget != 0xFFFFFFFF)
|
|
{
|
|
bAble = TRUE;
|
|
g_ClientMain.m_dwFunction = dwFunction;
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} else
|
|
{
|
|
unsigned long dwFunction = 0;
|
|
if(g_DeviceInput.GetIsRightMouseUp()) bAble = TRUE;
|
|
else if(g_DeviceInput.KeyUp(VK_F2)) { bAble = TRUE; dwFunction = 2; }
|
|
else if(g_DeviceInput.KeyUp(VK_F3)) { bAble = TRUE; dwFunction = 3; }
|
|
else if(g_DeviceInput.KeyUp(VK_F4)) { bAble = TRUE; dwFunction = 4; }
|
|
else if(g_DeviceInput.KeyUp(VK_F5)) { bAble = TRUE; dwFunction = 5; }
|
|
else if(g_DeviceInput.KeyUp(VK_F6)) { bAble = TRUE; dwFunction = 6; }
|
|
else if(g_DeviceInput.KeyUp(VK_F7)) { bAble = TRUE; dwFunction = 7; }
|
|
else if(g_DeviceInput.KeyUp(VK_F8)) { bAble = TRUE; dwFunction = 8; }
|
|
else if(g_DeviceInput.KeyUp(VK_F9)) { bAble = TRUE; dwFunction = 9; }
|
|
else if(g_DeviceInput.KeyUp(VK_F10)) { bAble = TRUE; dwFunction = 10; }
|
|
|
|
if(dwFunction)
|
|
{
|
|
const Skill::ProtoType *lpSkillType = g_SkillMgr.GetSkillProtoType(g_ClientMain.m_csStatus.m_lpQuickSelected->GetProtoTypeID());
|
|
if(lpSkillType)
|
|
{
|
|
if((lpSkillType->m_eTargetType == Skill::Target::FRIEND && lpSkillType->m_EffectDistance > 0.0f) ||
|
|
lpSkillType->m_eTargetType == Skill::Target::FRIEND_EXCEPT_SELF)
|
|
{
|
|
bAble = TRUE;
|
|
} else
|
|
{
|
|
bAble = FALSE;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
return bAble;
|
|
}
|
|
|
|
BOOL CClientMain::CheckStillCasting(unsigned long &dwFunction)
|
|
{
|
|
BOOL bAble = FALSE;
|
|
|
|
switch(g_ClientMain.m_dwFunction)
|
|
{
|
|
case 0:
|
|
if(g_DeviceInput.GetIsRightMousePress()) bAble = TRUE;
|
|
break;
|
|
|
|
case 2:
|
|
if(g_DeviceInput.KeyHold(VK_F2)) bAble = TRUE;
|
|
break;
|
|
|
|
case 3:
|
|
if(g_DeviceInput.KeyHold(VK_F3)) bAble = TRUE;
|
|
break;
|
|
|
|
case 4:
|
|
if(g_DeviceInput.KeyHold(VK_F4)) bAble = TRUE;
|
|
break;
|
|
|
|
case 5:
|
|
if(g_DeviceInput.KeyHold(VK_F5)) bAble = TRUE;
|
|
break;
|
|
|
|
case 6:
|
|
if(g_DeviceInput.KeyHold(VK_F6)) bAble = TRUE;
|
|
break;
|
|
|
|
case 7:
|
|
if(g_DeviceInput.KeyHold(VK_F7)) bAble = TRUE;
|
|
break;
|
|
|
|
case 8:
|
|
if(g_DeviceInput.KeyHold(VK_F8)) bAble = TRUE;
|
|
break;
|
|
|
|
case 9:
|
|
if(g_DeviceInput.KeyHold(VK_F9)) bAble = TRUE;
|
|
break;
|
|
|
|
case 10:
|
|
if(g_DeviceInput.KeyHold(VK_F10)) bAble = TRUE;
|
|
break;
|
|
}
|
|
|
|
if(g_ClientMain.m_dwFunction)
|
|
{
|
|
const Skill::ProtoType *lpSkillType = g_SkillMgr.GetSkillProtoType(g_ClientMain.m_csStatus.m_lpQuickSelected->GetProtoTypeID());
|
|
if(lpSkillType)
|
|
{
|
|
if((lpSkillType->m_eTargetType == Skill::Target::FRIEND && lpSkillType->m_EffectDistance > 0.0f) ||
|
|
lpSkillType->m_eTargetType == Skill::Target::FRIEND_EXCEPT_SELF)
|
|
{
|
|
int count = 1;
|
|
for(int i = 0; i < g_ClientMain.m_csStatus.m_PartyInfo.m_cMemberNum; i++)
|
|
{
|
|
if(g_ClientMain.m_csStatus.m_PartyInfo.ServerID[i])
|
|
{
|
|
if(g_ClientMain.m_csStatus.m_PartyInfo.MemberCID[i] != g_ClientMain.m_dwMyChrID)
|
|
{
|
|
// ŸÀÎ
|
|
count++;
|
|
}
|
|
}
|
|
|
|
if(count == g_ClientMain.m_dwFunction)
|
|
{
|
|
dwFunction = g_ClientMain.m_csStatus.m_PartyInfo.MemberCID[i];
|
|
break;
|
|
}
|
|
}
|
|
|
|
if(i >= g_ClientMain.m_csStatus.m_PartyInfo.m_cMemberNum)
|
|
{
|
|
dwFunction = 0xFFFFFFFF;
|
|
bAble = FALSE;
|
|
}
|
|
} else
|
|
{
|
|
dwFunction = 0xFFFFFFFF;
|
|
bAble = FALSE;
|
|
}
|
|
} else
|
|
{
|
|
dwFunction = 0xFFFFFFFF;
|
|
bAble = FALSE;
|
|
}
|
|
} else
|
|
{
|
|
dwFunction = 0xFFFFFFFF;
|
|
}
|
|
|
|
return bAble;
|
|
}
|
|
|
|
void CClientMain::WriteLogtoFile(const char *strLog, const char *strFileName, int nLine)
|
|
{
|
|
FILE *fp;
|
|
char strFilename[MAX_PATH], strRealLog[1000];
|
|
SYSTEMTIME pSystemTime;
|
|
GetLocalTime(&pSystemTime);
|
|
|
|
sprintf(strFilename, "%s\\Log.txt", m_strClientPath);
|
|
if(fp = fopen(strFilename, "ab"))
|
|
{
|
|
fseek(fp, 0, SEEK_END);
|
|
sprintf(strRealLog, "[%04d:%02d:%02d:%02d:%02d] %s(%d) : %s\n", pSystemTime.wYear, pSystemTime.wMonth, pSystemTime.wDay,
|
|
pSystemTime.wHour, pSystemTime.wMinute, strFileName, nLine, strLog);
|
|
unsigned int nLength = strlen(strRealLog);
|
|
fwrite((const void *)strRealLog, nLength, 1, fp);
|
|
fclose(fp);
|
|
}
|
|
}
|
|
|
|
void CClientMain::SetSkillCoolDown(unsigned short wGrade, unsigned char cEndCooldown)
|
|
{
|
|
unsigned short wSkill = m_csStatus.m_lpQuickSelected->GetProtoTypeID();
|
|
|
|
int i;
|
|
if(m_csStatus.m_lpQuickSelected->m_bClassSkill)
|
|
{
|
|
vector<CItemInstance *>::iterator it;
|
|
for(it = m_csStatus.m_lstClassSkill.begin(); it != m_csStatus.m_lstClassSkill.end(); it++)
|
|
{
|
|
if((*it)->GetProtoTypeID() == wSkill)
|
|
{
|
|
(*it)->StartCoolDown(wGrade, cEndCooldown);
|
|
}
|
|
}
|
|
} else
|
|
{
|
|
for(i = 0; i < 20; i++)
|
|
{
|
|
if(m_csStatus.m_lstSkillSlot[i])
|
|
{
|
|
if(m_csStatus.m_lstSkillSlot[i]->GetProtoTypeID() == wSkill)
|
|
{
|
|
m_csStatus.m_lstSkillSlot[i]->StartCoolDown(wGrade, cEndCooldown);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
for(i = 0; i < 10; i++)
|
|
{
|
|
if(m_csStatus.m_lstQuickSlot[i])
|
|
{
|
|
if(m_csStatus.m_lstQuickSlot[i]->GetProtoTypeID() == wSkill)
|
|
{
|
|
m_csStatus.m_lstQuickSlot[i]->StartCoolDown(wGrade, cEndCooldown);
|
|
}
|
|
}
|
|
}
|
|
|
|
if(m_csStatus.m_lpQuickSelected)
|
|
{
|
|
m_csStatus.m_lpQuickSelected->StartCoolDown(wGrade, cEndCooldown);
|
|
}
|
|
|
|
if(m_lpPickItem)
|
|
{
|
|
if(m_lpPickItem->m_bSkill && m_lpPickItem->GetProtoTypeID() == wSkill)
|
|
{
|
|
m_lpPickItem->StartCoolDown(wGrade, cEndCooldown);
|
|
}
|
|
}/**/
|
|
}
|
|
|
|
void CClientMain::SetPotionCoolDown()
|
|
{
|
|
list<CItemInstance *>::iterator it;
|
|
for(it = m_csStatus.m_lstInventory.begin(); it != m_csStatus.m_lstInventory.end(); it++)
|
|
{
|
|
if((*it)->GetItemType() == Item::CItemType::POTION)
|
|
{
|
|
(*it)->StartCoolDown();
|
|
if(m_csStatus.m_lPotionCoolDownTime <= 0)
|
|
m_csStatus.m_lPotionCoolDownTime = (*it)->m_lCoolDownTime;
|
|
}
|
|
}
|
|
|
|
for(int i = 0; i < 10; i++)
|
|
{
|
|
if(m_csStatus.m_lstQuickSlot[i])
|
|
{
|
|
if(m_csStatus.m_lstQuickSlot[i]->GetItemType() == Item::CItemType::POTION)
|
|
{
|
|
m_csStatus.m_lstQuickSlot[i]->StartCoolDown();
|
|
}
|
|
}
|
|
}
|
|
|
|
if(m_lpPickItem)
|
|
{
|
|
if(m_lpPickItem->GetItemType() == Item::CItemType::POTION)
|
|
m_lpPickItem->StartCoolDown();
|
|
}
|
|
}
|
|
|
|
void CClientMain::SetSkillClearCoolDown(void)
|
|
{
|
|
unsigned short wSkill = m_csStatus.m_lpQuickSelected->GetProtoTypeID();
|
|
|
|
int i;
|
|
if(m_csStatus.m_lpQuickSelected->m_bClassSkill)
|
|
{
|
|
vector<CItemInstance *>::iterator it;
|
|
for(it = m_csStatus.m_lstClassSkill.begin(); it != m_csStatus.m_lstClassSkill.end(); it++)
|
|
{
|
|
if((*it)->GetProtoTypeID() == wSkill)
|
|
{
|
|
(*it)->ClearCoolDown();
|
|
}
|
|
}
|
|
} else
|
|
{
|
|
for(i = 0; i < 20; i++)
|
|
{
|
|
if(m_csStatus.m_lstSkillSlot[i])
|
|
{
|
|
if(m_csStatus.m_lstSkillSlot[i]->GetProtoTypeID() == wSkill)
|
|
{
|
|
m_csStatus.m_lstSkillSlot[i]->ClearCoolDown();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
for(i = 0; i < 10; i++)
|
|
{
|
|
if(m_csStatus.m_lstQuickSlot[i])
|
|
{
|
|
if(m_csStatus.m_lstQuickSlot[i]->GetProtoTypeID() == wSkill)
|
|
{
|
|
m_csStatus.m_lstQuickSlot[i]->ClearCoolDown();
|
|
}
|
|
}
|
|
}
|
|
|
|
m_csStatus.m_lpQuickSelected->ClearCoolDown();
|
|
|
|
if(m_lpPickItem)
|
|
{
|
|
if(m_lpPickItem->m_bSkill && m_lpPickItem->GetProtoTypeID() == wSkill)
|
|
{
|
|
m_lpPickItem->ClearCoolDown();
|
|
}
|
|
}
|
|
}
|
|
|
|
void CClientMain::SetAutoRun(BOOL bAutoRun)
|
|
{
|
|
g_ClientMain.m_bAutoRunMode = bAutoRun;
|
|
}
|
|
|
|
BOOL CClientMain::GetAutoRun(void)
|
|
{
|
|
return g_ClientMain.m_bAutoRunMode;
|
|
}
|
|
|
|
void CClientMain::PrintException(EXCEPTION_RECORD &SavedExceptRec, CONTEXT &SavedContext)
|
|
{
|
|
char a[MAX_PATH], strCode[MAX_PATH], strTestServer[MAX_PATH];
|
|
switch(SavedExceptRec.ExceptionCode)
|
|
{
|
|
case EXCEPTION_ACCESS_VIOLATION:
|
|
strcpy(strCode, "EXCEPTION_ACCESS_VIOLATION");
|
|
break;
|
|
|
|
case EXCEPTION_ARRAY_BOUNDS_EXCEEDED:
|
|
strcpy(strCode, "EXCEPTION_ARRAY_BOUNDS_EXCEEDED");
|
|
break;
|
|
|
|
case EXCEPTION_BREAKPOINT:
|
|
strcpy(strCode, "EXCEPTION_BREAKPOINT");
|
|
break;
|
|
|
|
case EXCEPTION_DATATYPE_MISALIGNMENT:
|
|
strcpy(strCode, "EXCEPTION_DATATYPE_MISALIGNMENT");
|
|
break;
|
|
|
|
case EXCEPTION_FLT_DENORMAL_OPERAND:
|
|
strcpy(strCode, "EXCEPTION_FLT_DENORMAL_OPERAND");
|
|
break;
|
|
|
|
case EXCEPTION_FLT_DIVIDE_BY_ZERO:
|
|
strcpy(strCode, "EXCEPTION_FLT_DIVIDE_BY_ZERO");
|
|
break;
|
|
|
|
case EXCEPTION_FLT_INEXACT_RESULT:
|
|
strcpy(strCode, "EXCEPTION_FLT_INEXACT_RESULT");
|
|
break;
|
|
|
|
case EXCEPTION_FLT_INVALID_OPERATION:
|
|
strcpy(strCode, "EXCEPTION_FLT_INVALID_OPERATION");
|
|
break;
|
|
|
|
case EXCEPTION_FLT_OVERFLOW:
|
|
strcpy(strCode, "EXCEPTION_FLT_OVERFLOW");
|
|
break;
|
|
|
|
case EXCEPTION_FLT_STACK_CHECK:
|
|
strcpy(strCode, "EXCEPTION_FLT_STACK_CHECK");
|
|
break;
|
|
|
|
case EXCEPTION_FLT_UNDERFLOW:
|
|
strcpy(strCode, "EXCEPTION_FLT_UNDERFLOW");
|
|
break;
|
|
|
|
case EXCEPTION_ILLEGAL_INSTRUCTION:
|
|
strcpy(strCode, "EXCEPTION_ILLEGAL_INSTRUCTION");
|
|
break;
|
|
|
|
case EXCEPTION_IN_PAGE_ERROR:
|
|
strcpy(strCode, "EXCEPTION_IN_PAGE_ERROR");
|
|
break;
|
|
|
|
case EXCEPTION_INT_DIVIDE_BY_ZERO:
|
|
strcpy(strCode, "EXCEPTION_INT_DIVIDE_BY_ZERO");
|
|
break;
|
|
|
|
case EXCEPTION_INT_OVERFLOW:
|
|
strcpy(strCode, "EXCEPTION_INT_OVERFLOW");
|
|
break;
|
|
|
|
case EXCEPTION_INVALID_DISPOSITION:
|
|
strcpy(strCode, "EXCEPTION_INVALID_DISPOSITION");
|
|
break;
|
|
|
|
case EXCEPTION_NONCONTINUABLE_EXCEPTION:
|
|
strcpy(strCode, "EXCEPTION_NONCONTINUABLE_EXCEPTION");
|
|
break;
|
|
|
|
case EXCEPTION_PRIV_INSTRUCTION:
|
|
strcpy(strCode, "EXCEPTION_PRIV_INSTRUCTION");
|
|
break;
|
|
|
|
case EXCEPTION_SINGLE_STEP:
|
|
strcpy(strCode, "EXCEPTION_SINGLE_STEP");
|
|
break;
|
|
|
|
case EXCEPTION_STACK_OVERFLOW:
|
|
strcpy(strCode, "EXCEPTION_STACK_OVERFLOW");
|
|
break;
|
|
}
|
|
|
|
if(g_ClientMain.m_bTestServerVersion)
|
|
strcpy(strTestServer, "Test Server Version");
|
|
else
|
|
strcpy(strTestServer, "Regular Server Version");
|
|
|
|
sprintf(a, "Server = %s\nClient Current Version = %3.2f\nException Code = %s\nException Address = 0x%08x",
|
|
strTestServer, g_ClientMain.m_fClientVersion, strCode, SavedExceptRec.ExceptionAddress);
|
|
MessageBox(NULL, a, "Error", MB_OK);
|
|
}
|
|
|
|
void CClientMain::ChangeWeapon(void)
|
|
{
|
|
if(!g_ClientMain.m_lpInterface) return;
|
|
if(g_ClientMain.m_csStatus.m_Info.Nationality != NATION_HUMAN) return;
|
|
|
|
if((g_DeviceInput.KeyDown('Q') && g_ClientMain.m_lpInterface->m_bWeaponExchageAble && !g_TextEdit.IsFocus()))
|
|
{
|
|
g_ClientMain.m_bChangeWeapon = TRUE;
|
|
}
|
|
|
|
if((g_DeviceInput.KeyDown('Q') && g_ClientMain.m_lpInterface->m_bWeaponExchageAble && !g_TextEdit.IsFocus()) ||
|
|
g_ClientMain.m_lpInterface->m_bQuickWeaponExchange)
|
|
{
|
|
if(g_CharacterData.GetAttacking())
|
|
{
|
|
if((g_DeviceInput.KeyDown('Q') && g_ClientMain.m_lpInterface->m_bWeaponExchageAble && !g_TextEdit.IsFocus()))
|
|
{
|
|
g_ClientMain.m_lpInterface->m_bQuickWeaponExchange = !g_ClientMain.m_lpInterface->m_bQuickWeaponExchange;
|
|
g_DeviceInput.InitKey('Q');
|
|
}
|
|
} else
|
|
{
|
|
if(g_ClientMain.m_csStatus.m_cWeaponPos == 0)
|
|
{
|
|
g_ClientMain.m_csStatus.m_cWeaponPos = 1;
|
|
}
|
|
else
|
|
{
|
|
g_ClientMain.m_csStatus.m_cWeaponPos = 0;
|
|
}
|
|
|
|
g_ClientMain.m_Network.SendCharSwitchHand();
|
|
g_ClientMain.m_Network.SendCharShape();
|
|
g_ClientMain.m_csStatus.StatusUpdate();
|
|
|
|
g_CharacterData.m_lstCharData[g_CharacterData.m_nFocusCharacter]->m_dwAttackCombo = 0;
|
|
g_ClientMain.m_bChangeWeapon = TRUE;
|
|
|
|
g_ClientMain.m_lpInterface->m_fWeaponExchageAbleTimeCounter = 3.0f;
|
|
g_ClientMain.m_lpInterface->m_bWeaponExchageAble = FALSE;
|
|
g_ClientMain.m_lpInterface->m_bQuickWeaponExchange = FALSE;
|
|
}
|
|
}
|
|
}
|
|
|
|
BOOL CClientMain::GetChangeWeapon(void)
|
|
{
|
|
return m_bChangeWeapon;
|
|
}
|
|
|
|
void CClientMain::SetChangeWeapon(BOOL bChangeWeapon)
|
|
{
|
|
g_ClientMain.m_bChangeWeapon = bChangeWeapon;
|
|
}
|
|
|
|
vector3 CClientMain::GetMonsterMinBox(unsigned long dwChrID)
|
|
{
|
|
const CMonsterMgr::MonsterProtoType *lpMonster = g_MonsterMgr.GetMonsterProtoType(dwChrID & 0x0000FFFF);
|
|
|
|
vector3 vecMinBox = vector3(-35.0f, 0.0f, -55.0f);
|
|
|
|
if(lpMonster)
|
|
{
|
|
vecMinBox = vector3(lpMonster->m_MonsterInfo.m_fHitBox[1], 0.0f, lpMonster->m_MonsterInfo.m_fHitBox[3]);
|
|
}
|
|
|
|
return vecMinBox;
|
|
}
|
|
|
|
vector3 CClientMain::GetMonsterMaxBox(unsigned long dwChrID)
|
|
{
|
|
const CMonsterMgr::MonsterProtoType *lpMonster = g_MonsterMgr.GetMonsterProtoType(dwChrID & 0x0000FFFF);
|
|
|
|
vector3 vecMaxBox = vector3(35.0f, 0.0f, 55.0f);
|
|
|
|
if(lpMonster)
|
|
{
|
|
vecMaxBox = vector3(lpMonster->m_MonsterInfo.m_fHitBox[0], 0.0f, lpMonster->m_MonsterInfo.m_fHitBox[2]);
|
|
}
|
|
|
|
return vecMaxBox;
|
|
}
|
|
|
|
void CClientMain::SetKillCounter(long lKillCounter)
|
|
{
|
|
g_ClientMain.m_lKillCounter = lKillCounter;
|
|
}
|
|
|
|
void CClientMain::SetSkillCoolDown(unsigned short wSkill)
|
|
{
|
|
int i;
|
|
if(m_csStatus.m_lpQuickSelected->m_bClassSkill)
|
|
{
|
|
vector<CItemInstance *>::iterator it;
|
|
for(it = m_csStatus.m_lstClassSkill.begin(); it != m_csStatus.m_lstClassSkill.end(); it++)
|
|
{
|
|
if((*it)->GetProtoTypeID() == wSkill)
|
|
{
|
|
if((*it)->m_cCountCooldown)
|
|
{
|
|
(*it)->StartCoolDown((*it)->GetSkillGrade());
|
|
}
|
|
(*it)->ClearCoolDown();
|
|
}
|
|
}
|
|
} else
|
|
{
|
|
for(i = 0; i < 20; i++)
|
|
{
|
|
if(m_csStatus.m_lstSkillSlot[i])
|
|
{
|
|
if(m_csStatus.m_lstSkillSlot[i]->GetProtoTypeID() == wSkill)
|
|
{
|
|
if(m_csStatus.m_lstSkillSlot[i]->m_cCountCooldown)
|
|
{
|
|
m_csStatus.m_lstSkillSlot[i]->StartCoolDown(m_csStatus.m_lstSkillSlot[i]->GetSkillGrade());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
for(i = 0; i < 10; i++)
|
|
{
|
|
if(m_csStatus.m_lstQuickSlot[i])
|
|
{
|
|
if(m_csStatus.m_lstQuickSlot[i]->GetProtoTypeID() == wSkill)
|
|
{
|
|
if(m_csStatus.m_lstQuickSlot[i]->m_cCountCooldown)
|
|
{
|
|
m_csStatus.m_lstQuickSlot[i]->StartCoolDown(m_csStatus.m_lstQuickSlot[i]->GetSkillGrade());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
if(m_csStatus.m_lpQuickSelected)
|
|
{
|
|
if(m_csStatus.m_lpQuickSelected->GetProtoTypeID() == wSkill)
|
|
{
|
|
if(m_csStatus.m_lpQuickSelected->m_cCountCooldown)
|
|
{
|
|
m_csStatus.m_lpQuickSelected->StartCoolDown(m_csStatus.m_lpQuickSelected->GetSkillGrade());
|
|
}
|
|
}
|
|
}
|
|
|
|
if(m_lpPickItem)
|
|
{
|
|
if(m_lpPickItem->m_bSkill && m_lpPickItem->GetProtoTypeID() == wSkill)
|
|
{
|
|
if(m_lpPickItem->m_cCountCooldown)
|
|
{
|
|
m_lpPickItem->StartCoolDown(m_lpPickItem->GetSkillGrade());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
BOOL CClientMain::CheckAttackable()
|
|
{
|
|
BOOL bAttackable = TRUE;
|
|
|
|
CItemInstance *lpWeapon = g_ClientMain.m_csStatus.m_lstEquipment[Item::EquipmentPos::WEAPON_HAND1 + g_ClientMain.m_csStatus.m_cWeaponPos];
|
|
CItemInstance *lpShield = g_ClientMain.m_csStatus.m_lstEquipment[Item::EquipmentPos::SHIELD_HAND1 + g_ClientMain.m_csStatus.m_cWeaponPos];
|
|
|
|
if(lpWeapon)
|
|
{
|
|
if(lpWeapon->GetNowDurability())
|
|
{
|
|
if(lpShield)
|
|
{
|
|
unsigned long dwType = lpShield->GetItemType();
|
|
if(dwType == Item::CItemType::SWORD || dwType == Item::CItemType::BLUNT || dwType == Item::CItemType::DAGGER || dwType == Item::CItemType::AXE)
|
|
{
|
|
if(lpShield->GetNowDurability() == 0)
|
|
{
|
|
bAttackable = FALSE;
|
|
}
|
|
}
|
|
}
|
|
} else
|
|
{
|
|
bAttackable = FALSE;
|
|
}
|
|
}
|
|
|
|
return bAttackable;
|
|
}
|
|
|
|
void CClientMain::SetPickItem(CItemInstance *lpItem, BOOL bSound)
|
|
{
|
|
m_lpPickItem = lpItem;
|
|
|
|
if(bSound && lpItem)
|
|
{
|
|
CSoundManager &sm = CSoundManager::GetInstance();
|
|
char Temp[MAX_PATH];
|
|
sprintf(Temp, "%s\\Sound\\Interface\\click.mnd", g_ClientMain.m_strClientPath);
|
|
ISoundObject &sb = sm.GetBuffer(Temp, false);
|
|
sb.Play(false);
|
|
}
|
|
}
|
|
|
|
void CClientMain::SetTipBroadTimer(long lTimer)
|
|
{
|
|
m_lTipBroadCounter = lTimer;
|
|
}
|
|
|
|
void CClientMain::ProjectPt( D3DXVECTOR3 *V, float *xScreen, float *yScreen )
|
|
{
|
|
|
|
LPDIRECT3DDEVICE8 pDevice = CSceneManager::GetDevice();
|
|
D3DVIEWPORT8 ViewPort;
|
|
pDevice->GetViewPort(&ViewPort);
|
|
|
|
int viewportWidth = (int)ViewPort.Width;
|
|
int viewportHeight = (int)ViewPort.Height;
|
|
|
|
float focusDist = ( viewportHeight/2 ) / tan( (3.1415f / 3.0f)/2.0f );
|
|
|
|
(*xScreen) = ( V->x / V->z * focusDist ) + viewportWidth/2;
|
|
(*yScreen) = ( V->y / V->z * focusDist ) + viewportHeight/2;
|
|
}
|
|
|