1. #include "StdAfx.h"
  2. #include "Resource.h"
  3. #include "PythonApplication.h"
  4. #include "../EterLib/Camera.h"
  5. extern bool PERF_CHECKER_RENDER_GAME;
  6. extern D3DXCOLOR g_fSpecularColor;
  7. extern BOOL bVisibleNotice = true;
  8. extern BOOL bTestServerFlag = FALSE;
  9. extern int TWOHANDED_WEWAPON_ATT_SPEED_DECREASE_VALUE = 0;
  10. PyObject* appShowWebPage(PyObject* poSelf, PyObject* poArgs)
  11. {
  12. char* szWebPage;
  13. if (!PyTuple_GetString(poArgs, 0, &szWebPage))
  14. return Py_BuildException();
  15. PyObject* poRect=PyTuple_GetItem(poArgs, 1);
  16. if (!PyTuple_Check(poRect))
  17. return Py_BuildException();
  18. RECT rcWebPage;
  19. rcWebPage.left=PyInt_AsLong(PyTuple_GetItem(poRect, 0));
  20. rcWebPage.top=PyInt_AsLong(PyTuple_GetItem(poRect, 1));
  21. rcWebPage.right=PyInt_AsLong(PyTuple_GetItem(poRect, 2));
  22. rcWebPage.bottom=PyInt_AsLong(PyTuple_GetItem(poRect, 3));
  23. CPythonApplication::Instance().ShowWebPage(
  24. szWebPage,
  25. rcWebPage
  26. );
  27. return Py_BuildNone();
  28. }
  29. PyObject* appMoveWebPage(PyObject* poSelf, PyObject* poArgs)
  30. {
  31. PyObject* poRect=PyTuple_GetItem(poArgs, 0);
  32. if (!PyTuple_Check(poRect))
  33. return Py_BuildException();
  34. RECT rcWebPage;
  35. rcWebPage.left=PyInt_AsLong(PyTuple_GetItem(poRect, 0));
  36. rcWebPage.top=PyInt_AsLong(PyTuple_GetItem(poRect, 1));
  37. rcWebPage.right=PyInt_AsLong(PyTuple_GetItem(poRect, 2));
  38. rcWebPage.bottom=PyInt_AsLong(PyTuple_GetItem(poRect, 3));
  39. CPythonApplication::Instance().MoveWebPage(rcWebPage);
  40. return Py_BuildNone();
  41. }
  42. PyObject* appHideWebPage(PyObject* poSelf, PyObject* poArgs)
  43. {
  44. CPythonApplication::Instance().HideWebPage();
  45. return Py_BuildNone();
  46. }
  47. PyObject * appIsWebPageMode(PyObject * poSelf, PyObject * poArgs)
  48. {
  49. return Py_BuildValue("i", CPythonApplication::Instance().IsWebPageMode());
  50. }
  51. PyObject* appEnablePerformanceTime(PyObject* poSelf, PyObject* poArgs)
  52. {
  53. char* szMode;
  54. if (!PyTuple_GetString(poArgs, 0, &szMode))
  55. return Py_BuildException();
  56. int nEnable;
  57. if (!PyTuple_GetInteger(poArgs, 1, &nEnable))
  58. return Py_BuildException();
  59. bool isEnable=nEnable ? true : false;
  60. if (strcmp(szMode, "RENDER_GAME")==0)
  61. PERF_CHECKER_RENDER_GAME = isEnable;
  62. return Py_BuildNone();
  63. }
  64. /////////////////////////////////////////////////////
  65. extern BOOL HAIR_COLOR_ENABLE;
  66. extern BOOL USE_ARMOR_SPECULAR;
  67. extern BOOL USE_WEAPON_SPECULAR;
  68. extern BOOL SKILL_EFFECT_UPGRADE_ENABLE;
  69. extern BOOL RIDE_HORSE_ENABLE;
  70. extern double g_specularSpd;
  71. // TEXTTAIL_LIVINGTIME_CONTROL
  72. extern void TextTail_SetLivingTime(long livingTime);
  73. PyObject* appSetTextTailLivingTime(PyObject* poSelf, PyObject* poArgs)
  74. {
  75. float livingTime;
  76. if (!PyTuple_GetFloat(poArgs, 0, &livingTime))
  77. return Py_BuildException();
  78. TextTail_SetLivingTime(livingTime*1000);
  79. return Py_BuildNone();
  80. }
  81. // END_OF_TEXTTAIL_LIVINGTIME_CONTROL
  82. PyObject* appSetHairColorEnable(PyObject* poSelf, PyObject* poArgs)
  83. {
  84. int nEnable;
  85. if (!PyTuple_GetInteger(poArgs, 0, &nEnable))
  86. return Py_BuildException();
  87. HAIR_COLOR_ENABLE=nEnable;
  88. return Py_BuildNone();
  89. }
  90. PyObject* appSetArmorSpecularEnable(PyObject* poSelf, PyObject* poArgs)
  91. {
  92. int nEnable;
  93. if (!PyTuple_GetInteger(poArgs, 0, &nEnable))
  94. return Py_BuildException();
  95. USE_ARMOR_SPECULAR=nEnable;
  96. return Py_BuildNone();
  97. }
  98. PyObject* appSetWeaponSpecularEnable(PyObject* poSelf, PyObject* poArgs)
  99. {
  100. int nEnable;
  101. if (!PyTuple_GetInteger(poArgs, 0, &nEnable))
  102. return Py_BuildException();
  103. USE_WEAPON_SPECULAR=nEnable;
  104. return Py_BuildNone();
  105. }
  106. PyObject* appSetSkillEffectUpgradeEnable(PyObject* poSelf, PyObject* poArgs)
  107. {
  108. int nEnable;
  109. if (!PyTuple_GetInteger(poArgs, 0, &nEnable))
  110. return Py_BuildException();
  111. SKILL_EFFECT_UPGRADE_ENABLE=nEnable;
  112. return Py_BuildNone();
  113. }
  114. PyObject* SetTwoHandedWeaponAttSpeedDecreaseValue(PyObject* poSelf, PyObject* poArgs)
  115. {
  116. int iValue;
  117. if (!PyTuple_GetInteger(poArgs, 0, &iValue))
  118. return Py_BuildException();
  119. TWOHANDED_WEWAPON_ATT_SPEED_DECREASE_VALUE = iValue;
  120. return Py_BuildNone();
  121. }
  122. PyObject* appSetRideHorseEnable(PyObject* poSelf, PyObject* poArgs)
  123. {
  124. int nEnable;
  125. if (!PyTuple_GetInteger(poArgs, 0, &nEnable))
  126. return Py_BuildException();
  127. RIDE_HORSE_ENABLE=nEnable;
  128. return Py_BuildNone();
  129. }
  130. PyObject* appSetCameraMaxDistance(PyObject* poSelf, PyObject* poArgs)
  131. {
  132. float fMax;
  133. if (!PyTuple_GetFloat(poArgs, 0, &fMax))
  134. return Py_BuildException();
  135. CCamera::SetCameraMaxDistance(fMax);
  136. return Py_BuildNone();
  137. }
  138. PyObject* appSetControlFP(PyObject* poSelf, PyObject* poArgs)
  139. {
  140. _controlfp( _PC_24, _MCW_PC );
  141. return Py_BuildNone();
  142. }
  143. PyObject* appSetSpecularSpeed(PyObject* poSelf, PyObject* poArgs)
  144. {
  145. float fSpeed;
  146. if (!PyTuple_GetFloat(poArgs, 0, &fSpeed))
  147. return Py_BuildException();
  148. g_specularSpd = fSpeed;
  149. return Py_BuildNone();
  150. }
  151. PyObject * appSetMinFog(PyObject * poSelf, PyObject * poArgs)
  152. {
  153. float fMinFog;
  154. if (!PyTuple_GetFloat(poArgs, 0, &fMinFog))
  155. return Py_BuildException();
  156. CPythonApplication::Instance().SetMinFog(fMinFog);
  157. return Py_BuildNone();
  158. }
  159. PyObject* appSetFrameSkip(PyObject* poSelf, PyObject* poArgs)
  160. {
  161. int nFrameSkip;
  162. if (!PyTuple_GetInteger(poArgs, 0, &nFrameSkip))
  163. return Py_BuildException();
  164. CPythonApplication::Instance().SetFrameSkip(nFrameSkip ? true : false);
  165. return Py_BuildNone();
  166. }
  167. // LOCALE
  168. PyObject* appForceSetLocale(PyObject* poSelf, PyObject* poArgs)
  169. {
  170. char* szName;
  171. if (!PyTuple_GetString(poArgs, 0, &szName))
  172. return Py_BuildException();
  173. char* szLocalePath;
  174. if (!PyTuple_GetString(poArgs, 1, &szLocalePath))
  175. return Py_BuildException();
  176. LocaleService_ForceSetLocale(szName, szLocalePath);
  177. return Py_BuildNone();
  178. }
  179. PyObject* appGetLocaleServiceName(PyObject* poSelf, PyObject* poArgs)
  180. {
  181. return Py_BuildValue("s", LocaleService_GetName());
  182. }
  183. //
  184. bool LoadLocaleData(const char* localePath);
  185. PyObject* appSetCHEONMA(PyObject* poSelf, PyObject* poArgs)
  186. {
  187. int enable;
  188. if (!PyTuple_GetInteger(poArgs, 0, &enable))
  189. return Py_BuildException();
  190. LocaleService_SetCHEONMA(enable ? true : false);
  191. return Py_BuildNone();
  192. }
  193. PyObject* appIsCHEONMA(PyObject* poSelf, PyObject* poArgs)
  194. {
  195. return Py_BuildValue("i", LocaleService_IsCHEONMA());
  196. }
  197. #include "../eterBase/tea.h"
  198. PyObject* appLoadLocaleAddr(PyObject* poSelf, PyObject* poArgs)
  199. {
  200. char* addrPath;
  201. if (!PyTuple_GetString(poArgs, 0, &addrPath))
  202. return Py_BuildException();
  203. FILE* fp = fopen(addrPath, "rb");
  204. if (!fp)
  205. return Py_BuildException();
  206. fseek(fp, 0, SEEK_END);
  207. int size = ftell(fp);
  208. char* enc = (char*)_alloca(size);
  209. fseek(fp, 0, SEEK_SET);
  210. fread(enc, size, 1, fp);
  211. fclose(fp);
  212. static const unsigned char key[16] = {
  213. 0x82, 0x1b, 0x34, 0xae,
  214. 0x12, 0x3b, 0xfb, 0x17,
  215. 0xd7, 0x2c, 0x39, 0xae,
  216. 0x41, 0x98, 0xf1, 0x63
  217. };
  218. char* buf = (char*)_alloca(size);
  219. //int decSize =
  220. tea_decrypt((unsigned long*)buf, (const unsigned long*)enc, (const unsigned long*)key, size);
  221. unsigned int retSize = *(unsigned int*)buf;
  222. char* ret = buf + sizeof(unsigned int);
  223. return Py_BuildValue("s#", ret, retSize);
  224. }
  225. PyObject* appLoadLocaleData(PyObject* poSelf, PyObject* poArgs)
  226. {
  227. char* localePath;
  228. if (!PyTuple_GetString(poArgs, 0, &localePath))
  229. return Py_BuildException();
  230. return Py_BuildValue("i", LoadLocaleData(localePath));
  231. }
  232. PyObject* appGetLocaleName(PyObject* poSelf, PyObject* poArgs)
  233. {
  234. return Py_BuildValue("s", LocaleService_GetLocaleName());
  235. }
  236. PyObject* appGetLocalePath(PyObject* poSelf, PyObject* poArgs)
  237. {
  238. return Py_BuildValue("s", LocaleService_GetLocalePath());
  239. }
  240. // END_OF_LOCALE
  241. PyObject* appGetDefaultCodePage(PyObject* poSelf, PyObject* poArgs)
  242. {
  243. return Py_BuildValue("i", LocaleService_GetCodePage());
  244. }
  245. #ifdef __VTUNE__
  246. PyObject* appGetImageInfo(PyObject* poSelf, PyObject* poArgs)
  247. {
  248. char* szFileName;
  249. if (!PyTuple_GetString(poArgs, 0, &szFileName))
  250. return Py_BuildException();
  251. return Py_BuildValue("iii", 0, 0, 0);
  252. }
  253. #else
  254. #include <il/il.h>
  255. PyObject* appGetImageInfo(PyObject* poSelf, PyObject* poArgs)
  256. {
  257. char* szFileName;
  258. if (!PyTuple_GetString(poArgs, 0, &szFileName))
  259. return Py_BuildException();
  260. BOOL canLoad=FALSE;
  261. ILuint uWidth=0;
  262. ILuint uHeight=0;
  263. ILuint uImg;
  264. ilGenImages(1, &uImg);
  265. ilBindImage(uImg);
  266. if (ilLoad(IL_TYPE_UNKNOWN, szFileName))
  267. {
  268. canLoad=TRUE;
  269. uWidth=ilGetInteger(IL_IMAGE_WIDTH);
  270. uHeight=ilGetInteger(IL_IMAGE_HEIGHT);
  271. }
  272. ilDeleteImages(1, &uImg);
  273. return Py_BuildValue("iii", canLoad, uWidth, uHeight);
  274. }
  275. #endif
  276. #include "../EterPack/EterPackManager.h"
  277. PyObject* appIsExistFile(PyObject* poSelf, PyObject* poArgs)
  278. {
  279. char* szFileName;
  280. if (!PyTuple_GetString(poArgs, 0, &szFileName))
  281. return Py_BuildException();
  282. bool isExist=CEterPackManager::Instance().isExist(szFileName);
  283. return Py_BuildValue("i", isExist);
  284. }
  285. PyObject* appGetFileList(PyObject* poSelf, PyObject* poArgs)
  286. {
  287. char* szFilter;
  288. if (!PyTuple_GetString(poArgs, 0, &szFilter))
  289. return Py_BuildException();
  290. PyObject* poList=PyList_New(0);
  291. WIN32_FIND_DATA wfd;
  292. memset(&wfd, 0, sizeof(wfd));
  293. HANDLE hFind = FindFirstFile(szFilter, &wfd);
  294. if (hFind != INVALID_HANDLE_VALUE)
  295. {
  296. do
  297. {
  298. PyObject* poFileName=PyString_FromString(wfd.cFileName) ;
  299. PyList_Append(poList, poFileName);
  300. }
  301. while (FindNextFile(hFind, &wfd));
  302. FindClose(hFind);
  303. }
  304. return poList;
  305. }
  306. PyObject* appUpdateGame(PyObject* poSelf, PyObject* poArgs)
  307. {
  308. CPythonApplication::Instance().UpdateGame();
  309. return Py_BuildNone();
  310. }
  311. PyObject* appRenderGame(PyObject* poSelf, PyObject* poArgs)
  312. {
  313. CPythonApplication::Instance().RenderGame();
  314. return Py_BuildNone();
  315. }
  316. PyObject* appSetMouseHandler(PyObject* poSelf, PyObject* poArgs)
  317. {
  318. PyObject* poHandler;
  319. if (!PyTuple_GetObject(poArgs, 0, &poHandler))
  320. return Py_BuildException();
  321. CPythonApplication::Instance().SetMouseHandler(poHandler);
  322. return Py_BuildNone();
  323. }
  324. PyObject* appCreate(PyObject* poSelf, PyObject* poArgs)
  325. {
  326. char* szName;
  327. if (!PyTuple_GetString(poArgs, 0, &szName))
  328. return Py_BuildException();
  329. int width;
  330. if (!PyTuple_GetInteger(poArgs, 1, &width))
  331. return Py_BuildException();
  332. int height;
  333. if (!PyTuple_GetInteger(poArgs, 2, &height))
  334. return Py_BuildException();
  335. int Windowed;
  336. if (!PyTuple_GetInteger(poArgs, 3, &Windowed))
  337. return Py_BuildException();
  338. CPythonApplication& rkApp=CPythonApplication::Instance();
  339. if (!rkApp.Create(poSelf, szName, width, height, Windowed))
  340. {
  341. //return Py_BuildNone();
  342. return NULL;
  343. }
  344. return Py_BuildNone();
  345. }
  346. PyObject* appLoop(PyObject* poSelf, PyObject* poArgs)
  347. {
  348. CPythonApplication::Instance().Loop();
  349. return Py_BuildNone();
  350. }
  351. PyObject* appGetInfo(PyObject* poSelf, PyObject* poArgs)
  352. {
  353. int nInfo;
  354. if (!PyTuple_GetInteger(poArgs, 0, &nInfo))
  355. return Py_BuildException();
  356. std::string stInfo;
  357. CPythonApplication::Instance().GetInfo(nInfo, &stInfo);
  358. return Py_BuildValue("s", stInfo.c_str());
  359. }
  360. PyObject* appProcess(PyObject* poSelf, PyObject* poArgs)
  361. {
  362. if (CPythonApplication::Instance().Process())
  363. return Py_BuildValue("i", 1);
  364. return Py_BuildValue("i", 0);
  365. }
  366. PyObject* appAbort(PyObject* poSelf, PyObject* poArgs)
  367. {
  368. CPythonApplication::Instance().Abort();
  369. return Py_BuildNone();
  370. }
  371. PyObject* appExit(PyObject* poSelf, PyObject* poArgs)
  372. {
  373. CPythonApplication::Instance().Exit();
  374. return Py_BuildNone();
  375. }
  376. PyObject * appSetCamera(PyObject * poSelf, PyObject * poArgs)
  377. {
  378. float Distance;
  379. if (!PyTuple_GetFloat(poArgs, 0, &Distance))
  380. return Py_BuildException();
  381. float Pitch;
  382. if (!PyTuple_GetFloat(poArgs, 1, &Pitch))
  383. return Py_BuildException();
  384. float Rotation;
  385. if (!PyTuple_GetFloat(poArgs, 2, &Rotation))
  386. return Py_BuildException();
  387. float fDestinationHeight;
  388. if (!PyTuple_GetFloat(poArgs, 3, &fDestinationHeight))
  389. return Py_BuildException();
  390. CPythonApplication::Instance().SetCamera(Distance, Pitch, Rotation, fDestinationHeight);
  391. return Py_BuildNone();
  392. }
  393. PyObject * appGetCamera(PyObject * poSelf, PyObject * poArgs)
  394. {
  395. float Distance, Pitch, Rotation, DestinationHeight;
  396. CPythonApplication::Instance().GetCamera(&Distance, &Pitch, &Rotation, &DestinationHeight);
  397. return Py_BuildValue("ffff", Distance, Pitch, Rotation, DestinationHeight);
  398. }
  399. PyObject * appGetCameraPitch(PyObject * poSelf, PyObject * poArgs)
  400. {
  401. return Py_BuildValue("f", CPythonApplication::Instance().GetPitch());
  402. }
  403. PyObject * appGetCameraRotation(PyObject * poSelf, PyObject * poArgs)
  404. {
  405. return Py_BuildValue("f", CPythonApplication::Instance().GetRotation());
  406. }
  407. PyObject * appGetTime(PyObject * poSelf, PyObject * poArgs)
  408. {
  409. return Py_BuildValue("f", CPythonApplication::Instance().GetGlobalTime());
  410. }
  411. PyObject * appGetGlobalTime(PyObject * poSelf, PyObject * poArgs)
  412. {
  413. return Py_BuildValue("i", CPythonApplication::Instance().GetServerTime());
  414. }
  415. PyObject * appGetGlobalTimeStamp(PyObject * poSelf, PyObject * poArgs)
  416. {
  417. return Py_BuildValue("i", CPythonApplication::Instance().GetServerTimeStamp());
  418. }
  419. PyObject * appGetUpdateFPS(PyObject * poSelf, PyObject * poArgs)
  420. {
  421. return Py_BuildValue("i", CPythonApplication::Instance().GetUpdateFPS());
  422. }
  423. PyObject * appGetRenderFPS(PyObject * poSelf, PyObject * poArgs)
  424. {
  425. return Py_BuildValue("i", CPythonApplication::Instance().GetRenderFPS());
  426. }
  427. PyObject * appRotateCamera(PyObject * poSelf, PyObject * poArgs)
  428. {
  429. int iDirection;
  430. if (!PyTuple_GetInteger(poArgs, 0, &iDirection))
  431. return Py_BuildException();
  432. CPythonApplication::Instance().RotateCamera(iDirection);
  433. return Py_BuildNone();
  434. }
  435. PyObject * appPitchCamera(PyObject * poSelf, PyObject * poArgs)
  436. {
  437. int iDirection;
  438. if (!PyTuple_GetInteger(poArgs, 0, &iDirection))
  439. return Py_BuildException();
  440. CPythonApplication::Instance().PitchCamera(iDirection);
  441. return Py_BuildNone();
  442. }
  443. PyObject * appZoomCamera(PyObject * poSelf, PyObject * poArgs)
  444. {
  445. int iDirection;
  446. if (!PyTuple_GetInteger(poArgs, 0, &iDirection))
  447. return Py_BuildException();
  448. CPythonApplication::Instance().ZoomCamera(iDirection);
  449. return Py_BuildNone();
  450. }
  451. PyObject * appMovieRotateCamera(PyObject * poSelf, PyObject * poArgs)
  452. {
  453. int iDirection;
  454. if (!PyTuple_GetInteger(poArgs, 0, &iDirection))
  455. return Py_BuildException();
  456. CPythonApplication::Instance().MovieRotateCamera(iDirection);
  457. return Py_BuildNone();
  458. }
  459. PyObject * appMoviePitchCamera(PyObject * poSelf, PyObject * poArgs)
  460. {
  461. int iDirection;
  462. if (!PyTuple_GetInteger(poArgs, 0, &iDirection))
  463. return Py_BuildException();
  464. CPythonApplication::Instance().MoviePitchCamera(iDirection);
  465. return Py_BuildNone();
  466. }
  467. PyObject * appMovieZoomCamera(PyObject * poSelf, PyObject * poArgs)
  468. {
  469. int iDirection;
  470. if (!PyTuple_GetInteger(poArgs, 0, &iDirection))
  471. return Py_BuildException();
  472. CPythonApplication::Instance().MovieZoomCamera(iDirection);
  473. return Py_BuildNone();
  474. }
  475. PyObject * appMovieResetCamera(PyObject * poSelf, PyObject * poArgs)
  476. {
  477. CPythonApplication::Instance().MovieResetCamera();
  478. return Py_BuildNone();
  479. }
  480. PyObject * appGetFaceSpeed(PyObject * poSelf, PyObject * poArgs)
  481. {
  482. return Py_BuildValue("f", CPythonApplication::Instance().GetFaceSpeed());
  483. }
  484. PyObject * appGetRenderTime(PyObject * poSelf, PyObject * poArgs)
  485. {
  486. return Py_BuildValue("fi",
  487. CPythonApplication::Instance().GetAveRenderTime(),
  488. CPythonApplication::Instance().GetCurRenderTime());
  489. }
  490. PyObject * appGetUpdateTime(PyObject * poSelf, PyObject * poArgs)
  491. {
  492. return Py_BuildValue("i", CPythonApplication::Instance().GetCurUpdateTime());
  493. }
  494. PyObject * appGetLoad(PyObject * poSelf, PyObject * poArgs)
  495. {
  496. return Py_BuildValue("i", CPythonApplication::Instance().GetLoad());
  497. }
  498. PyObject * appGetFaceCount(PyObject * poSelf, PyObject * poArgs)
  499. {
  500. return Py_BuildValue("i", CPythonApplication::Instance().GetFaceCount());
  501. }
  502. PyObject * appGetAvaiableTextureMememory(PyObject * poSelf, PyObject * poArgs)
  503. {
  504. return Py_BuildValue("i", CGraphicBase::GetAvailableTextureMemory());
  505. }
  506. PyObject * appSetFPS(PyObject * poSelf, PyObject * poArgs)
  507. {
  508. int iFPS;
  509. if (!PyTuple_GetInteger(poArgs, 0, &iFPS))
  510. return Py_BuildException();
  511. CPythonApplication::Instance().SetFPS(iFPS);
  512. return Py_BuildNone();
  513. }
  514. PyObject * appSetGlobalCenterPosition(PyObject * poSelf, PyObject * poArgs)
  515. {
  516. int x;
  517. if (!PyTuple_GetInteger(poArgs, 0, &x))
  518. return Py_BuildException();
  519. int y;
  520. if (!PyTuple_GetInteger(poArgs, 1, &y))
  521. return Py_BuildException();
  522. CPythonApplication::Instance().SetGlobalCenterPosition(x, y);
  523. return Py_BuildNone();
  524. }
  525. PyObject * appSetCenterPosition(PyObject * poSelf, PyObject * poArgs)
  526. {
  527. float fx;
  528. if (!PyTuple_GetFloat(poArgs, 0, &fx))
  529. return Py_BuildException();
  530. float fy;
  531. if (!PyTuple_GetFloat(poArgs, 1, &fy))
  532. return Py_BuildException();
  533. float fz;
  534. if (!PyTuple_GetFloat(poArgs, 2, &fz))
  535. return Py_BuildException();
  536. CPythonApplication::Instance().SetCenterPosition(fx, -fy, fz);
  537. return Py_BuildNone();
  538. }
  539. PyObject * appGetCursorPosition(PyObject * poSelf, PyObject * poArgs)
  540. {
  541. long lx, ly;
  542. UI::CWindowManager& rkWndMgr=UI::CWindowManager::Instance();
  543. rkWndMgr.GetMousePosition(lx, ly);
  544. return Py_BuildValue("ii", lx, ly);
  545. }
  546. PyObject * appRunPythonFile(PyObject * poSelf, PyObject * poArgs)
  547. {
  548. char *szFileName;
  549. if (!PyTuple_GetString(poArgs, 0, &szFileName))
  550. return Py_BuildException();
  551. bool ret = CPythonLauncher::Instance().RunFile(szFileName);
  552. return Py_BuildValue("i", ret);
  553. }
  554. PyObject * appIsPressed(PyObject * poSelf, PyObject * poArgs)
  555. {
  556. int iKey;
  557. if (!PyTuple_GetInteger(poArgs, 0, &iKey))
  558. return Py_BuildException();
  559. return Py_BuildValue("i", CPythonApplication::Instance().IsPressed(iKey));
  560. }
  561. PyObject * appSetCursor(PyObject * poSelf, PyObject * poArgs)
  562. {
  563. /*
  564. char * szName;
  565. if (!PyTuple_GetString(poArgs, 0, &szName))
  566. return Py_BuildException();
  567. if (!CPythonApplication::Instance().SetHardwareCursor(szName))
  568. return Py_BuildException("Wrong Cursor Name [%s]", szName);
  569. */
  570. int iCursorNum;
  571. if (!PyTuple_GetInteger(poArgs, 0, &iCursorNum))
  572. return Py_BuildException();
  573. if (!CPythonApplication::Instance().SetCursorNum(iCursorNum))
  574. return Py_BuildException("Wrong Cursor Name [%d]", iCursorNum);
  575. return Py_BuildNone();
  576. }
  577. PyObject * appGetCursor(PyObject * poSelf, PyObject * poArgs)
  578. {
  579. return Py_BuildValue("i", CPythonApplication::Instance().GetCursorNum());
  580. }
  581. PyObject * appShowCursor(PyObject * poSelf, PyObject * poArgs)
  582. {
  583. CPythonApplication::Instance().SetCursorVisible(TRUE);
  584. return Py_BuildNone();
  585. }
  586. PyObject * appHideCursor(PyObject * poSelf, PyObject * poArgs)
  587. {
  588. CPythonApplication::Instance().SetCursorVisible(FALSE);
  589. return Py_BuildNone();
  590. }
  591. PyObject * appIsShowCursor(PyObject * poSelf, PyObject * poArgs)
  592. {
  593. return Py_BuildValue("i", TRUE == CPythonApplication::Instance().GetCursorVisible());
  594. }
  595. PyObject * appIsLiarCursorOn(PyObject * poSelf, PyObject * poArgs)
  596. {
  597. return Py_BuildValue("i", TRUE == CPythonApplication::Instance().GetLiarCursorOn());
  598. }
  599. PyObject * appSetSoftwareCursor(PyObject * poSelf, PyObject * poArgs)
  600. {
  601. CPythonApplication::Instance().SetCursorMode(CPythonApplication::CURSOR_MODE_SOFTWARE);
  602. return Py_BuildNone();
  603. }
  604. PyObject * appSetHardwareCursor(PyObject * poSelf, PyObject * poArgs)
  605. {
  606. CPythonApplication::Instance().SetCursorMode(CPythonApplication::CURSOR_MODE_HARDWARE);
  607. return Py_BuildNone();
  608. }
  609. PyObject * appSetConnectData(PyObject * poSelf, PyObject * poArgs)
  610. {
  611. char * szIP;
  612. if (!PyTuple_GetString(poArgs, 0, &szIP))
  613. return Py_BuildException();
  614. int iPort;
  615. if (!PyTuple_GetInteger(poArgs, 1, &iPort))
  616. return Py_BuildException();
  617. CPythonApplication::Instance().SetConnectData(szIP, iPort);
  618. return Py_BuildNone();
  619. }
  620. PyObject * appGetConnectData(PyObject * poSelf, PyObject * poArgs)
  621. {
  622. std::string strIP;
  623. int iPort;
  624. CPythonApplication::Instance().GetConnectData(strIP, iPort);
  625. return Py_BuildValue("si", strIP.c_str(), iPort);
  626. }
  627. PyObject * appGetRandom(PyObject * poSelf, PyObject * poArgs)
  628. {
  629. int from;
  630. if (!PyTuple_GetInteger(poArgs, 0, &from))
  631. return Py_BuildException();
  632. int to;
  633. if (!PyTuple_GetInteger(poArgs, 1, &to))
  634. return Py_BuildException();
  635. if (from > to)
  636. {
  637. int tmp = from;
  638. from = to;
  639. to = tmp;
  640. }
  641. return Py_BuildValue("i", random_range(from, to));
  642. }
  643. PyObject * appGetRotatingDirection(PyObject * poSelf, PyObject * poArgs)
  644. {
  645. float fSource;
  646. if (!PyTuple_GetFloat(poArgs, 0, &fSource))
  647. return Py_BuildException();
  648. float fTarget;
  649. if (!PyTuple_GetFloat(poArgs, 1, &fTarget))
  650. return Py_BuildException();
  651. return Py_BuildValue("i", GetRotatingDirection(fSource, fTarget));
  652. }
  653. PyObject * appGetDegreeDifference(PyObject * poSelf, PyObject * poArgs)
  654. {
  655. float fSource;
  656. if (!PyTuple_GetFloat(poArgs, 0, &fSource))
  657. return Py_BuildException();
  658. float fTarget;
  659. if (!PyTuple_GetFloat(poArgs, 1, &fTarget))
  660. return Py_BuildException();
  661. return Py_BuildValue("f", GetDegreeDifference(fSource, fTarget));
  662. }
  663. PyObject * appSleep(PyObject * poSelf, PyObject * poArgs)
  664. {
  665. int iTime;
  666. if (!PyTuple_GetInteger(poArgs, 0, &iTime))
  667. return Py_BuildException();
  668. Sleep(iTime);
  669. return Py_BuildNone();
  670. }
  671. PyObject * appSetDefaultFontName(PyObject * poSelf, PyObject * poArgs)
  672. {
  673. char * szFontName;
  674. if (!PyTuple_GetString(poArgs, 0, &szFontName))
  675. return Py_BuildException();
  676. // DEFAULT_FONT
  677. DefaultFont_SetName(szFontName);
  678. // END_OF_DEFAULT_FONT
  679. return Py_BuildNone();
  680. }
  681. PyObject * appSetGuildSymbolPath(PyObject * poSelf, PyObject * poArgs)
  682. {
  683. char * szPathName;
  684. if (!PyTuple_GetString(poArgs, 0, &szPathName))
  685. return Py_BuildException();
  686. SetGuildSymbolPath(szPathName);
  687. return Py_BuildNone();
  688. }
  689. PyObject * appEnableSpecialCameraMode(PyObject * poSelf, PyObject * poArgs)
  690. {
  691. CPythonApplication::Instance().EnableSpecialCameraMode();
  692. return Py_BuildNone();
  693. }
  694. PyObject * appSetCameraSpeed(PyObject * poSelf, PyObject * poArgs)
  695. {
  696. int iPercentage;
  697. if (!PyTuple_GetInteger(poArgs, 0, &iPercentage))
  698. return Py_BuildException();
  699. CPythonApplication::Instance().SetCameraSpeed(iPercentage);
  700. CCamera * pCamera = CCameraManager::Instance().GetCurrentCamera();
  701. if (pCamera)
  702. pCamera->SetResistance(float(iPercentage) / 100.0f);
  703. return Py_BuildNone();
  704. }
  705. PyObject * appIsFileExist(PyObject * poSelf, PyObject * poArgs)
  706. {
  707. char * szFileName;
  708. if (!PyTuple_GetString(poArgs, 0, &szFileName))
  709. return Py_BuildException();
  710. return Py_BuildValue("i", -1 != _access(szFileName, 0));
  711. }
  712. PyObject * appSetCameraSetting(PyObject * poSelf, PyObject * poArgs)
  713. {
  714. int ix;
  715. if (!PyTuple_GetInteger(poArgs, 0, &ix))
  716. return Py_BuildException();
  717. int iy;
  718. if (!PyTuple_GetInteger(poArgs, 1, &iy))
  719. return Py_BuildException();
  720. int iz;
  721. if (!PyTuple_GetInteger(poArgs, 2, &iz))
  722. return Py_BuildException();
  723. int iZoom;
  724. if (!PyTuple_GetInteger(poArgs, 3, &iZoom))
  725. return Py_BuildException();
  726. int iRotation;
  727. if (!PyTuple_GetInteger(poArgs, 4, &iRotation))
  728. return Py_BuildException();
  729. int iPitch;
  730. if (!PyTuple_GetInteger(poArgs, 5, &iPitch))
  731. return Py_BuildException();
  732. CPythonApplication::SCameraSetting CameraSetting;
  733. ZeroMemory(&CameraSetting, sizeof(CameraSetting));
  734. CameraSetting.v3CenterPosition.x = float(ix);
  735. CameraSetting.v3CenterPosition.y = float(iy);
  736. CameraSetting.v3CenterPosition.z = float(iz);
  737. CameraSetting.fZoom = float(iZoom);
  738. CameraSetting.fRotation = float(iRotation);
  739. CameraSetting.fPitch = float(iPitch);
  740. CPythonApplication::Instance().SetEventCamera(CameraSetting);
  741. return Py_BuildNone();
  742. }
  743. PyObject * appSaveCameraSetting(PyObject * poSelf, PyObject * poArgs)
  744. {
  745. char * szFileName;
  746. if (!PyTuple_GetString(poArgs, 0, &szFileName))
  747. return Py_BuildException();
  748. CPythonApplication::Instance().SaveCameraSetting(szFileName);
  749. return Py_BuildNone();
  750. }
  751. PyObject * appLoadCameraSetting(PyObject * poSelf, PyObject * poArgs)
  752. {
  753. char * szFileName;
  754. if (!PyTuple_GetString(poArgs, 0, &szFileName))
  755. return Py_BuildException();
  756. bool bResult = CPythonApplication::Instance().LoadCameraSetting(szFileName);
  757. return Py_BuildValue("i", bResult);
  758. }
  759. PyObject * appSetDefaultCamera(PyObject * poSelf, PyObject * poArgs)
  760. {
  761. CPythonApplication::Instance().SetDefaultCamera();
  762. return Py_BuildNone();
  763. }
  764. PyObject * appSetSightRange(PyObject * poSelf, PyObject * poArgs)
  765. {
  766. int iRange;
  767. if (!PyTuple_GetInteger(poArgs, 0, &iRange))
  768. return Py_BuildException();
  769. CPythonApplication::Instance().SetForceSightRange(iRange);
  770. return Py_BuildNone();
  771. }
  772. extern int g_iAccumulationTime;
  773. PyObject * apptestGetAccumulationTime(PyObject * poSelf, PyObject * poArgs)
  774. {
  775. return Py_BuildValue("i", g_iAccumulationTime);
  776. }
  777. PyObject * apptestResetAccumulationTime(PyObject * poSelf, PyObject * poArgs)
  778. {
  779. g_iAccumulationTime = 0;
  780. return Py_BuildNone();
  781. }
  782. PyObject * apptestSetSpecularColor(PyObject * poSelf, PyObject * poArgs)
  783. {
  784. float fr;
  785. if (!PyTuple_GetFloat(poArgs, 0, &fr))
  786. return Py_BuildException();
  787. float fg;
  788. if (!PyTuple_GetFloat(poArgs, 1, &fg))
  789. return Py_BuildException();
  790. float fb;
  791. if (!PyTuple_GetFloat(poArgs, 2, &fb))
  792. return Py_BuildException();
  793. g_fSpecularColor = D3DXCOLOR(fr, fg, fb, 1.0f);
  794. return Py_BuildNone();
  795. }
  796. PyObject * appSetVisibleNotice(PyObject * poSelf, PyObject * poArgs)
  797. {
  798. int iFlag;
  799. if (!PyTuple_GetInteger(poArgs, 0, &iFlag))
  800. return Py_BuildException();
  801. bVisibleNotice = iFlag;
  802. return Py_BuildNone();
  803. }
  804. PyObject * appIsVisibleNotice(PyObject * poSelf, PyObject * poArgs)
  805. {
  806. return Py_BuildValue("i", bVisibleNotice);
  807. }
  808. PyObject * appEnableTestServerFlag(PyObject * poSelf, PyObject * poArgs)
  809. {
  810. bTestServerFlag = TRUE;
  811. return Py_BuildNone();
  812. }
  813. PyObject * appIsEnableTestServerFlag(PyObject * poSelf, PyObject * poArgs)
  814. {
  815. return Py_BuildValue("i", bTestServerFlag);
  816. }
  817. class CTextLineLoader
  818. {
  819. public:
  820. CTextLineLoader(const char * c_szFileName)
  821. {
  822. const VOID* pvData;
  823. CMappedFile kFile;
  824. if (!CEterPackManager::Instance().Get(kFile, c_szFileName, &pvData))
  825. return;
  826. m_kTextFileLoader.Bind(kFile.Size(), pvData);
  827. }
  828. DWORD GetLineCount()
  829. {
  830. return m_kTextFileLoader.GetLineCount();
  831. }
  832. const char * GetLine(DWORD dwIndex)
  833. {
  834. if (dwIndex >= GetLineCount())
  835. return "";
  836. return m_kTextFileLoader.GetLineString(dwIndex).c_str();
  837. }
  838. protected:
  839. CMemoryTextFileLoader m_kTextFileLoader;
  840. };
  841. PyObject * appOpenTextFile(PyObject * poSelf, PyObject * poArgs)
  842. {
  843. char * szFileName;
  844. if (!PyTuple_GetString(poArgs, 0, &szFileName))
  845. return Py_BuildException();
  846. CTextLineLoader * pTextLineLoader = new CTextLineLoader(szFileName);
  847. return Py_BuildValue("i", (int)pTextLineLoader);
  848. }
  849. PyObject * appCloseTextFile(PyObject * poSelf, PyObject * poArgs)
  850. {
  851. int iHandle;
  852. if (!PyTuple_GetInteger(poArgs, 0, &iHandle))
  853. return Py_BuildException();
  854. CTextLineLoader * pTextFileLoader = (CTextLineLoader *)iHandle;
  855. delete pTextFileLoader;
  856. return Py_BuildNone();
  857. }
  858. PyObject * appGetTextFileLineCount(PyObject * poSelf, PyObject * poArgs)
  859. {
  860. int iHandle;
  861. if (!PyTuple_GetInteger(poArgs, 0, &iHandle))
  862. return Py_BuildException();
  863. CTextLineLoader * pTextFileLoader = (CTextLineLoader *)iHandle;
  864. return Py_BuildValue("i", pTextFileLoader->GetLineCount());
  865. }
  866. PyObject * appGetTextFileLine(PyObject * poSelf, PyObject * poArgs)
  867. {
  868. int iHandle;
  869. if (!PyTuple_GetInteger(poArgs, 0, &iHandle))
  870. return Py_BuildException();
  871. int iLineIndex;
  872. if (!PyTuple_GetInteger(poArgs, 1, &iLineIndex))
  873. return Py_BuildException();
  874. CTextLineLoader * pTextFileLoader = (CTextLineLoader *)iHandle;
  875. return Py_BuildValue("s", pTextFileLoader->GetLine(iLineIndex));
  876. }
  877. PyObject * appSetGuildMarkPath(PyObject * poSelf, PyObject * poArgs)
  878. {
  879. char * path;
  880. if (!PyTuple_GetString(poArgs, 0, &path))
  881. return Py_BuildException();
  882. char newPath[256];
  883. char * ext = strstr(path, ".tga");
  884. if (ext)
  885. {
  886. int extPos = ext - path;
  887. strncpy(newPath, path, extPos);
  888. newPath[extPos] = '\0';
  889. }
  890. else
  891. strncpy(newPath, path, sizeof(newPath)-1);
  892. CGuildMarkManager::Instance().SetMarkPathPrefix(newPath);
  893. return Py_BuildNone();
  894. }
  895. PyObject* appIsDevStage(PyObject* poSelf, PyObject* poArgs)
  896. {
  897. int nIsDevelopmentStage = 0;
  898. #if defined(LOCALE_SERVICE_STAGE_DEVELOPMENT)
  899. nIsDevelopmentStage = 1;
  900. #endif
  901. return Py_BuildValue("i", nIsDevelopmentStage);
  902. }
  903. PyObject* appIsTestStage(PyObject* poSelf, PyObject* poArgs)
  904. {
  905. int nIsTestStage = 0;
  906. #if defined(LOCALE_SERVICE_STAGE_TEST)
  907. nIsTestStage = 1;
  908. #endif
  909. return Py_BuildValue("i", nIsTestStage);
  910. }
  911. PyObject* appIsLiveStage(PyObject* poSelf, PyObject* poArgs)
  912. {
  913. int nIsLiveStage = 0;
  914. #if !defined(LOCALE_SERVICE_STAGE_TEST) && !defined(LOCALE_SERVICE_STAGE_DEVELOPMENT)
  915. nIsLiveStage = 1;
  916. #endif
  917. return Py_BuildValue("i", nIsLiveStage);
  918. }
  919. PyObject* appLogoOpen(PyObject* poSelf, PyObject* poArgs)
  920. {
  921. char* szName;
  922. if (!PyTuple_GetString(poArgs, 0, &szName))
  923. return Py_BuildException();
  924. int nIsSuccess = 1; //CPythonApplication::Instance().OnLogoOpen(szName);
  925. CMovieMan::Instance().PlayLogo(szName);
  926. return Py_BuildValue("i", nIsSuccess);
  927. }
  928. PyObject* appLogoUpdate(PyObject* poSelf, PyObject* poArgs)
  929. {
  930. int nIsRun = 0; //CPythonApplication::Instance().OnLogoUpdate();
  931. return Py_BuildValue("i", nIsRun);
  932. }
  933. PyObject* appLogoRender(PyObject* poSelf, PyObject* poArgs)
  934. {
  935. //CPythonApplication::Instance().OnLogoRender();
  936. return Py_BuildNone();
  937. }
  938. PyObject* appLogoClose(PyObject* poSelf, PyObject* poArgs)
  939. {
  940. //CPythonApplication::Instance().OnLogoClose();
  941. return Py_BuildNone();
  942. }
  943. PyObject* appSetTitle(PyObject* poSelf, PyObject* poArgs)
  944. {
  945. char* szTitle;
  946. if (!PyTuple_GetString(poArgs, 0, &szTitle))
  947. return Py_BuildException();
  948. CPythonApplication::Instance().SetTitle(szTitle);
  949. return Py_BuildNone();
  950. }
  951. PyObject* appFlashApplication(PyObject* poSelf, PyObject* poArgs)
  952. {
  953. CPythonApplication::Instance().FlashApplication();
  954. return Py_BuildNone();
  955. }
  956. void initapp()
  957. {
  958. static PyMethodDef s_methods[] =
  959. {
  960. { "IsDevStage", appIsDevStage, METH_VARARGS },
  961. { "IsTestStage", appIsTestStage, METH_VARARGS },
  962. { "IsLiveStage", appIsLiveStage, METH_VARARGS },
  963. // TEXTTAIL_LIVINGTIME_CONTROL
  964. { "SetTextTailLivingTime", appSetTextTailLivingTime, METH_VARARGS },
  965. // END_OF_TEXTTAIL_LIVINGTIME_CONTROL
  966. { "EnablePerformanceTime", appEnablePerformanceTime, METH_VARARGS },
  967. { "SetHairColorEnable", appSetHairColorEnable, METH_VARARGS },
  968. { "SetArmorSpecularEnable", appSetArmorSpecularEnable, METH_VARARGS },
  969. { "SetWeaponSpecularEnable", appSetWeaponSpecularEnable, METH_VARARGS },
  970. { "SetSkillEffectUpgradeEnable",appSetSkillEffectUpgradeEnable, METH_VARARGS },
  971. { "SetTwoHandedWeaponAttSpeedDecreaseValue", SetTwoHandedWeaponAttSpeedDecreaseValue, METH_VARARGS },
  972. { "SetRideHorseEnable", appSetRideHorseEnable, METH_VARARGS },
  973. { "SetCameraMaxDistance", appSetCameraMaxDistance, METH_VARARGS },
  974. { "SetMinFog", appSetMinFog, METH_VARARGS },
  975. { "SetFrameSkip", appSetFrameSkip, METH_VARARGS },
  976. { "GetImageInfo", appGetImageInfo, METH_VARARGS },
  977. { "GetInfo", appGetInfo, METH_VARARGS },
  978. { "UpdateGame", appUpdateGame, METH_VARARGS },
  979. { "RenderGame", appRenderGame, METH_VARARGS },
  980. { "Loop", appLoop, METH_VARARGS },
  981. { "Create", appCreate, METH_VARARGS },
  982. { "Process", appProcess, METH_VARARGS },
  983. { "Exit", appExit, METH_VARARGS },
  984. { "Abort", appAbort, METH_VARARGS },
  985. { "SetMouseHandler", appSetMouseHandler, METH_VARARGS },
  986. { "IsExistFile", appIsExistFile, METH_VARARGS },
  987. { "GetFileList", appGetFileList, METH_VARARGS },
  988. { "SetCamera", appSetCamera, METH_VARARGS },
  989. { "GetCamera", appGetCamera, METH_VARARGS },
  990. { "GetCameraPitch", appGetCameraPitch, METH_VARARGS },
  991. { "GetCameraRotation", appGetCameraRotation, METH_VARARGS },
  992. { "GetTime", appGetTime, METH_VARARGS },
  993. { "GetGlobalTime", appGetGlobalTime, METH_VARARGS },
  994. { "GetGlobalTimeStamp", appGetGlobalTimeStamp, METH_VARARGS },
  995. { "GetUpdateFPS", appGetUpdateFPS, METH_VARARGS },
  996. { "GetRenderFPS", appGetRenderFPS, METH_VARARGS },
  997. { "RotateCamera", appRotateCamera, METH_VARARGS },
  998. { "PitchCamera", appPitchCamera, METH_VARARGS },
  999. { "ZoomCamera", appZoomCamera, METH_VARARGS },
  1000. { "MovieRotateCamera", appMovieRotateCamera, METH_VARARGS },
  1001. { "MoviePitchCamera", appMoviePitchCamera, METH_VARARGS },
  1002. { "MovieZoomCamera", appMovieZoomCamera, METH_VARARGS },
  1003. { "MovieResetCamera", appMovieResetCamera, METH_VARARGS },
  1004. { "GetAvailableTextureMemory", appGetAvaiableTextureMememory, METH_VARARGS },
  1005. { "GetRenderTime", appGetRenderTime, METH_VARARGS },
  1006. { "GetUpdateTime", appGetUpdateTime, METH_VARARGS },
  1007. { "GetLoad", appGetLoad, METH_VARARGS },
  1008. { "GetFaceSpeed", appGetFaceSpeed, METH_VARARGS },
  1009. { "GetFaceCount", appGetFaceCount, METH_VARARGS },
  1010. { "SetFPS", appSetFPS, METH_VARARGS },
  1011. { "SetGlobalCenterPosition", appSetGlobalCenterPosition, METH_VARARGS },
  1012. { "SetCenterPosition", appSetCenterPosition, METH_VARARGS },
  1013. { "GetCursorPosition", appGetCursorPosition, METH_VARARGS },
  1014. { "GetRandom", appGetRandom, METH_VARARGS },
  1015. { "RunPythonFile", appRunPythonFile, METH_VARARGS },
  1016. { "IsWebPageMode", appIsWebPageMode, METH_VARARGS },
  1017. { "ShowWebPage", appShowWebPage, METH_VARARGS },
  1018. { "MoveWebPage", appMoveWebPage, METH_VARARGS },
  1019. { "HideWebPage", appHideWebPage, METH_VARARGS },
  1020. { "IsPressed", appIsPressed, METH_VARARGS },
  1021. { "SetCursor", appSetCursor, METH_VARARGS },
  1022. { "GetCursor", appGetCursor, METH_VARARGS },
  1023. { "ShowCursor", appShowCursor, METH_VARARGS },
  1024. { "HideCursor", appHideCursor, METH_VARARGS },
  1025. { "IsShowCursor", appIsShowCursor, METH_VARARGS },
  1026. { "IsLiarCursorOn", appIsLiarCursorOn, METH_VARARGS },
  1027. { "SetSoftwareCursor", appSetSoftwareCursor, METH_VARARGS },
  1028. { "SetHardwareCursor", appSetHardwareCursor, METH_VARARGS },
  1029. { "SetConnectData", appSetConnectData, METH_VARARGS },
  1030. { "GetConnectData", appGetConnectData, METH_VARARGS },
  1031. { "GetRotatingDirection", appGetRotatingDirection, METH_VARARGS },
  1032. { "GetDegreeDifference", appGetDegreeDifference, METH_VARARGS },
  1033. { "Sleep", appSleep, METH_VARARGS },
  1034. { "SetDefaultFontName", appSetDefaultFontName, METH_VARARGS },
  1035. { "SetGuildSymbolPath", appSetGuildSymbolPath, METH_VARARGS },
  1036. { "EnableSpecialCameraMode", appEnableSpecialCameraMode, METH_VARARGS },
  1037. { "SetCameraSpeed", appSetCameraSpeed, METH_VARARGS },
  1038. { "SaveCameraSetting", appSaveCameraSetting, METH_VARARGS },
  1039. { "LoadCameraSetting", appLoadCameraSetting, METH_VARARGS },
  1040. { "SetDefaultCamera", appSetDefaultCamera, METH_VARARGS },
  1041. { "SetCameraSetting", appSetCameraSetting, METH_VARARGS },
  1042. { "SetSightRange", appSetSightRange, METH_VARARGS },
  1043. { "IsFileExist", appIsFileExist, METH_VARARGS },
  1044. { "OpenTextFile", appOpenTextFile, METH_VARARGS },
  1045. { "CloseTextFile", appCloseTextFile, METH_VARARGS },
  1046. { "GetTextFileLineCount", appGetTextFileLineCount, METH_VARARGS },
  1047. { "GetTextFileLine", appGetTextFileLine, METH_VARARGS },
  1048. // LOCALE
  1049. { "GetLocaleServiceName", appGetLocaleServiceName, METH_VARARGS },
  1050. { "GetLocaleName", appGetLocaleName, METH_VARARGS },
  1051. { "GetLocalePath", appGetLocalePath, METH_VARARGS },
  1052. { "ForceSetLocale", appForceSetLocale, METH_VARARGS },
  1053. // END_OF_LOCALE
  1054. // CHEONMA
  1055. { "LoadLocaleAddr", appLoadLocaleAddr, METH_VARARGS },
  1056. { "LoadLocaleData", appLoadLocaleData, METH_VARARGS },
  1057. { "SetCHEONMA", appSetCHEONMA, METH_VARARGS },
  1058. { "IsCHEONMA", appIsCHEONMA, METH_VARARGS },
  1059. // END_OF_CHEONMA
  1060. { "GetDefaultCodePage", appGetDefaultCodePage, METH_VARARGS },
  1061. { "SetControlFP", appSetControlFP, METH_VARARGS },
  1062. { "SetSpecularSpeed", appSetSpecularSpeed, METH_VARARGS },
  1063. { "testGetAccumulationTime", apptestGetAccumulationTime, METH_VARARGS },
  1064. { "testResetAccumulationTime", apptestResetAccumulationTime, METH_VARARGS },
  1065. { "testSetSpecularColor", apptestSetSpecularColor, METH_VARARGS },
  1066. { "SetVisibleNotice", appSetVisibleNotice, METH_VARARGS },
  1067. { "IsVisibleNotice", appIsVisibleNotice, METH_VARARGS },
  1068. { "EnableTestServerFlag", appEnableTestServerFlag, METH_VARARGS },
  1069. { "IsEnableTestServerFlag", appIsEnableTestServerFlag, METH_VARARGS },
  1070. { "SetGuildMarkPath", appSetGuildMarkPath, METH_VARARGS },
  1071. { "OnLogoUpdate", appLogoUpdate, METH_VARARGS },
  1072. { "OnLogoRender", appLogoRender, METH_VARARGS },
  1073. { "OnLogoOpen", appLogoOpen, METH_VARARGS },
  1074. { "OnLogoClose", appLogoClose, METH_VARARGS },
  1075. { "SetTitle", appSetTitle, METH_VARARGS },
  1076. { "FlashApplication", appFlashApplication, METH_VARARGS },
  1077. { NULL, NULL },
  1078. };
  1079. PyObject * poModule = Py_InitModule("app", s_methods);
  1080. PyModule_AddIntConstant(poModule, "INFO_ITEM", CPythonApplication::INFO_ITEM);
  1081. PyModule_AddIntConstant(poModule, "INFO_ACTOR", CPythonApplication::INFO_ACTOR);
  1082. PyModule_AddIntConstant(poModule, "INFO_EFFECT", CPythonApplication::INFO_EFFECT);
  1083. PyModule_AddIntConstant(poModule, "INFO_TEXTTAIL", CPythonApplication::INFO_TEXTTAIL);
  1084. PyModule_AddIntConstant(poModule, "DEGREE_DIRECTION_SAME", DEGREE_DIRECTION_SAME);
  1085. PyModule_AddIntConstant(poModule, "DEGREE_DIRECTION_RIGHT", DEGREE_DIRECTION_RIGHT);
  1086. PyModule_AddIntConstant(poModule, "DEGREE_DIRECTION_LEFT", DEGREE_DIRECTION_LEFT);
  1087. PyModule_AddIntConstant(poModule, "VK_LEFT", VK_LEFT);
  1088. PyModule_AddIntConstant(poModule, "VK_RIGHT", VK_RIGHT);
  1089. PyModule_AddIntConstant(poModule, "VK_UP", VK_UP);
  1090. PyModule_AddIntConstant(poModule, "VK_DOWN", VK_DOWN);
  1091. PyModule_AddIntConstant(poModule, "VK_HOME", VK_HOME);
  1092. PyModule_AddIntConstant(poModule, "VK_END", VK_END);
  1093. PyModule_AddIntConstant(poModule, "VK_DELETE", VK_DELETE);
  1094. PyModule_AddIntConstant(poModule, "DIK_ESCAPE", DIK_ESCAPE);
  1095. PyModule_AddIntConstant(poModule, "DIK_ESC", DIK_ESCAPE); // ÆíÀǸ¦ À§ÇØ
  1096. PyModule_AddIntConstant(poModule, "DIK_1", DIK_1);
  1097. PyModule_AddIntConstant(poModule, "DIK_2", DIK_2);
  1098. PyModule_AddIntConstant(poModule, "DIK_3", DIK_3);
  1099. PyModule_AddIntConstant(poModule, "DIK_4", DIK_4);
  1100. PyModule_AddIntConstant(poModule, "DIK_5", DIK_5);
  1101. PyModule_AddIntConstant(poModule, "DIK_6", DIK_6);
  1102. PyModule_AddIntConstant(poModule, "DIK_7", DIK_7);
  1103. PyModule_AddIntConstant(poModule, "DIK_8", DIK_8);
  1104. PyModule_AddIntConstant(poModule, "DIK_9", DIK_9);
  1105. PyModule_AddIntConstant(poModule, "DIK_0", DIK_0);
  1106. PyModule_AddIntConstant(poModule, "DIK_MINUS", DIK_MINUS); /* - on main keyboard */
  1107. PyModule_AddIntConstant(poModule, "DIK_EQUALS", DIK_EQUALS);
  1108. PyModule_AddIntConstant(poModule, "DIK_BACK", DIK_BACK); /* backspace */
  1109. PyModule_AddIntConstant(poModule, "DIK_TAB", DIK_TAB);
  1110. PyModule_AddIntConstant(poModule, "DIK_Q", DIK_Q);
  1111. PyModule_AddIntConstant(poModule, "DIK_W", DIK_W);
  1112. PyModule_AddIntConstant(poModule, "DIK_E", DIK_E);
  1113. PyModule_AddIntConstant(poModule, "DIK_R", DIK_R);
  1114. PyModule_AddIntConstant(poModule, "DIK_T", DIK_T);
  1115. PyModule_AddIntConstant(poModule, "DIK_Y", DIK_Y);
  1116. PyModule_AddIntConstant(poModule, "DIK_U", DIK_U);
  1117. PyModule_AddIntConstant(poModule, "DIK_I", DIK_I);
  1118. PyModule_AddIntConstant(poModule, "DIK_O", DIK_O);
  1119. PyModule_AddIntConstant(poModule, "DIK_P", DIK_P);
  1120. PyModule_AddIntConstant(poModule, "DIK_LBRACKET", DIK_LBRACKET);
  1121. PyModule_AddIntConstant(poModule, "DIK_RBRACKET", DIK_RBRACKET);
  1122. PyModule_AddIntConstant(poModule, "DIK_RETURN", DIK_RETURN); /* Enter on main keyboard */
  1123. PyModule_AddIntConstant(poModule, "DIK_LCONTROL", DIK_LCONTROL);
  1124. PyModule_AddIntConstant(poModule, "DIK_A", DIK_A);
  1125. PyModule_AddIntConstant(poModule, "DIK_S", DIK_S);
  1126. PyModule_AddIntConstant(poModule, "DIK_D", DIK_D);
  1127. PyModule_AddIntConstant(poModule, "DIK_F", DIK_F);
  1128. PyModule_AddIntConstant(poModule, "DIK_G", DIK_G);
  1129. PyModule_AddIntConstant(poModule, "DIK_H", DIK_H);
  1130. PyModule_AddIntConstant(poModule, "DIK_J", DIK_J);
  1131. PyModule_AddIntConstant(poModule, "DIK_K", DIK_K);
  1132. PyModule_AddIntConstant(poModule, "DIK_L", DIK_L);
  1133. PyModule_AddIntConstant(poModule, "DIK_SEMICOLON", DIK_SEMICOLON);
  1134. PyModule_AddIntConstant(poModule, "DIK_APOSTROPHE", DIK_APOSTROPHE);
  1135. PyModule_AddIntConstant(poModule, "DIK_GRAVE", DIK_GRAVE); /* accent grave */
  1136. PyModule_AddIntConstant(poModule, "DIK_LSHIFT", DIK_LSHIFT);
  1137. PyModule_AddIntConstant(poModule, "DIK_BACKSLASH", DIK_BACKSLASH);
  1138. PyModule_AddIntConstant(poModule, "DIK_Z", DIK_Z);
  1139. PyModule_AddIntConstant(poModule, "DIK_X", DIK_X);
  1140. PyModule_AddIntConstant(poModule, "DIK_C", DIK_C);
  1141. PyModule_AddIntConstant(poModule, "DIK_V", DIK_V);
  1142. PyModule_AddIntConstant(poModule, "DIK_B", DIK_B);
  1143. PyModule_AddIntConstant(poModule, "DIK_N", DIK_N);
  1144. PyModule_AddIntConstant(poModule, "DIK_M", DIK_M);
  1145. PyModule_AddIntConstant(poModule, "DIK_COMMA", DIK_COMMA);
  1146. PyModule_AddIntConstant(poModule, "DIK_PERIOD", DIK_PERIOD); /* . on main keyboard */
  1147. PyModule_AddIntConstant(poModule, "DIK_SLASH", DIK_SLASH); /* / on main keyboard */
  1148. PyModule_AddIntConstant(poModule, "DIK_RSHIFT", DIK_RSHIFT);
  1149. PyModule_AddIntConstant(poModule, "DIK_MULTIPLY", DIK_MULTIPLY); /* * on numeric keypad */
  1150. PyModule_AddIntConstant(poModule, "DIK_LALT", DIK_LMENU); /* left Alt */
  1151. PyModule_AddIntConstant(poModule, "DIK_SPACE", DIK_SPACE);
  1152. PyModule_AddIntConstant(poModule, "DIK_CAPITAL", DIK_CAPITAL);
  1153. PyModule_AddIntConstant(poModule, "DIK_F1", DIK_F1);
  1154. PyModule_AddIntConstant(poModule, "DIK_F2", DIK_F2);
  1155. PyModule_AddIntConstant(poModule, "DIK_F3", DIK_F3);
  1156. PyModule_AddIntConstant(poModule, "DIK_F4", DIK_F4);
  1157. PyModule_AddIntConstant(poModule, "DIK_F5", DIK_F5);
  1158. PyModule_AddIntConstant(poModule, "DIK_F6", DIK_F6);
  1159. PyModule_AddIntConstant(poModule, "DIK_F7", DIK_F7);
  1160. PyModule_AddIntConstant(poModule, "DIK_F8", DIK_F8);
  1161. PyModule_AddIntConstant(poModule, "DIK_F9", DIK_F9);
  1162. PyModule_AddIntConstant(poModule, "DIK_F10", DIK_F10);
  1163. PyModule_AddIntConstant(poModule, "DIK_NUMLOCK", DIK_NUMLOCK);
  1164. PyModule_AddIntConstant(poModule, "DIK_SCROLL", DIK_SCROLL); /* Scroll Lock */
  1165. PyModule_AddIntConstant(poModule, "DIK_NUMPAD7", DIK_NUMPAD7);
  1166. PyModule_AddIntConstant(poModule, "DIK_NUMPAD8", DIK_NUMPAD8);
  1167. PyModule_AddIntConstant(poModule, "DIK_NUMPAD9", DIK_NUMPAD9);
  1168. PyModule_AddIntConstant(poModule, "DIK_SUBTRACT", DIK_SUBTRACT); /* - on numeric keypad */
  1169. PyModule_AddIntConstant(poModule, "DIK_NUMPAD4", DIK_NUMPAD4);
  1170. PyModule_AddIntConstant(poModule, "DIK_NUMPAD5", DIK_NUMPAD5);
  1171. PyModule_AddIntConstant(poModule, "DIK_NUMPAD6", DIK_NUMPAD6);
  1172. PyModule_AddIntConstant(poModule, "DIK_ADD", DIK_ADD); /* + on numeric keypad */
  1173. PyModule_AddIntConstant(poModule, "DIK_NUMPAD1", DIK_NUMPAD1);
  1174. PyModule_AddIntConstant(poModule, "DIK_NUMPAD2", DIK_NUMPAD2);
  1175. PyModule_AddIntConstant(poModule, "DIK_NUMPAD3", DIK_NUMPAD3);
  1176. PyModule_AddIntConstant(poModule, "DIK_NUMPAD0", DIK_NUMPAD0);
  1177. PyModule_AddIntConstant(poModule, "DIK_DECIMAL", DIK_DECIMAL); /* . on numeric keypad */
  1178. PyModule_AddIntConstant(poModule, "DIK_F11", DIK_F11);
  1179. PyModule_AddIntConstant(poModule, "DIK_F12", DIK_F12);
  1180. PyModule_AddIntConstant(poModule, "DIK_NEXTTRACK", DIK_NEXTTRACK); /* Next Track */
  1181. PyModule_AddIntConstant(poModule, "DIK_NUMPADENTER", DIK_NUMPADENTER); /* Enter on numeric keypad */
  1182. PyModule_AddIntConstant(poModule, "DIK_RCONTROL", DIK_RCONTROL);
  1183. PyModule_AddIntConstant(poModule, "DIK_MUTE", DIK_MUTE); /* Mute */
  1184. PyModule_AddIntConstant(poModule, "DIK_CALCULATOR", DIK_CALCULATOR); /* Calculator */
  1185. PyModule_AddIntConstant(poModule, "DIK_PLAYPAUSE", DIK_PLAYPAUSE); /* Play / Pause */
  1186. PyModule_AddIntConstant(poModule, "DIK_MEDIASTOP", DIK_MEDIASTOP); /* Media Stop */
  1187. PyModule_AddIntConstant(poModule, "DIK_VOLUMEDOWN", DIK_VOLUMEDOWN); /* Volume - */
  1188. PyModule_AddIntConstant(poModule, "DIK_VOLUMEUP", DIK_VOLUMEUP); /* Volume + */
  1189. PyModule_AddIntConstant(poModule, "DIK_WEBHOME", DIK_WEBHOME); /* Web home */
  1190. PyModule_AddIntConstant(poModule, "DIK_NUMPADCOMMA", DIK_NUMPADCOMMA); /* , on numeric keypad (NEC PC98) */
  1191. PyModule_AddIntConstant(poModule, "DIK_DIVIDE", DIK_DIVIDE); /* / on numeric keypad */
  1192. PyModule_AddIntConstant(poModule, "DIK_SYSRQ", DIK_SYSRQ);
  1193. PyModule_AddIntConstant(poModule, "DIK_RALT", DIK_RMENU); /* right Alt */
  1194. PyModule_AddIntConstant(poModule, "DIK_PAUSE", DIK_PAUSE); /* Pause */
  1195. PyModule_AddIntConstant(poModule, "DIK_HOME", DIK_HOME); /* Home on arrow keypad */
  1196. PyModule_AddIntConstant(poModule, "DIK_UP", DIK_UP); /* UpArrow on arrow keypad */
  1197. PyModule_AddIntConstant(poModule, "DIK_PGUP", DIK_PRIOR); /* PgUp on arrow keypad */
  1198. PyModule_AddIntConstant(poModule, "DIK_LEFT", DIK_LEFT); /* LeftArrow on arrow keypad */
  1199. PyModule_AddIntConstant(poModule, "DIK_RIGHT", DIK_RIGHT); /* RightArrow on arrow keypad */
  1200. PyModule_AddIntConstant(poModule, "DIK_END", DIK_END); /* End on arrow keypad */
  1201. PyModule_AddIntConstant(poModule, "DIK_DOWN", DIK_DOWN); /* DownArrow on arrow keypad */
  1202. PyModule_AddIntConstant(poModule, "DIK_PGDN", DIK_NEXT); /* PgDn on arrow keypad */
  1203. PyModule_AddIntConstant(poModule, "DIK_INSERT", DIK_INSERT); /* Insert on arrow keypad */
  1204. PyModule_AddIntConstant(poModule, "DIK_DELETE", DIK_DELETE); /* Delete on arrow keypad */
  1205. PyModule_AddIntConstant(poModule, "DIK_LWIN", DIK_LWIN); /* Left Windows key */
  1206. PyModule_AddIntConstant(poModule, "DIK_RWIN", DIK_RWIN); /* Right Windows key */
  1207. PyModule_AddIntConstant(poModule, "DIK_APPS", DIK_APPS); /* AppMenu key */
  1208. // Cursor
  1209. PyModule_AddIntConstant(poModule, "NORMAL", CPythonApplication::CURSOR_SHAPE_NORMAL);
  1210. PyModule_AddIntConstant(poModule, "ATTACK", CPythonApplication::CURSOR_SHAPE_ATTACK);
  1211. PyModule_AddIntConstant(poModule, "TARGET", CPythonApplication::CURSOR_SHAPE_TARGET);
  1212. PyModule_AddIntConstant(poModule, "TALK", CPythonApplication::CURSOR_SHAPE_TALK);
  1213. PyModule_AddIntConstant(poModule, "CANT_GO", CPythonApplication::CURSOR_SHAPE_CANT_GO);
  1214. PyModule_AddIntConstant(poModule, "PICK", CPythonApplication::CURSOR_SHAPE_PICK);
  1215. PyModule_AddIntConstant(poModule, "DOOR", CPythonApplication::CURSOR_SHAPE_DOOR);
  1216. PyModule_AddIntConstant(poModule, "CHAIR", CPythonApplication::CURSOR_SHAPE_CHAIR);
  1217. PyModule_AddIntConstant(poModule, "MAGIC", CPythonApplication::CURSOR_SHAPE_MAGIC);
  1218. PyModule_AddIntConstant(poModule, "BUY", CPythonApplication::CURSOR_SHAPE_BUY);
  1219. PyModule_AddIntConstant(poModule, "SELL", CPythonApplication::CURSOR_SHAPE_SELL);
  1220. PyModule_AddIntConstant(poModule, "CAMERA_ROTATE", CPythonApplication::CURSOR_SHAPE_CAMERA_ROTATE);
  1221. PyModule_AddIntConstant(poModule, "HSIZE", CPythonApplication::CURSOR_SHAPE_HSIZE);
  1222. PyModule_AddIntConstant(poModule, "VSIZE", CPythonApplication::CURSOR_SHAPE_VSIZE);
  1223. PyModule_AddIntConstant(poModule, "HVSIZE", CPythonApplication::CURSOR_SHAPE_HVSIZE);
  1224. PyModule_AddIntConstant(poModule, "CAMERA_TO_POSITIVE", CPythonApplication::CAMERA_TO_POSITIVE);
  1225. PyModule_AddIntConstant(poModule, "CAMERA_TO_NEGATIVE", CPythonApplication::CAMERA_TO_NEGITIVE);
  1226. PyModule_AddIntConstant(poModule, "CAMERA_STOP", CPythonApplication::CAMERA_STOP);
  1227. #ifdef ENABLE_COSTUME_SYSTEM
  1228. PyModule_AddIntConstant(poModule, "ENABLE_COSTUME_SYSTEM", 1);
  1229. #else
  1230. PyModule_AddIntConstant(poModule, "ENABLE_COSTUME_SYSTEM", 0);
  1231. #endif
  1232. #if defined ENABLE_DBONE_EFFECTS
  1233. PyModule_AddIntConstant(poModule, "ENABLE_DBONE_EFFECTS", 1);
  1234. #else
  1235. PyModule_AddIntConstant(poModule, "ENABLE_DBONE_EFFECTS", 0);
  1236. #endif
  1237. #ifdef WJ_SHOW_ALL_CHANNEL
  1238. PyModule_AddIntConstant(poModule, "WJ_SHOW_ALL_CHANNEL", 1);
  1239. #else
  1240. PyModule_AddIntConstant(poModule, "WJ_SHOW_ALL_CHANNEL", 0);
  1241. #endif
  1242. #ifdef WJ_ELDER_ATTRIBUTE_SYSTEM
  1243. PyModule_AddIntConstant(poModule, "WJ_ELDER_ATTRIBUTE_SYSTEM", 1);
  1244. #else
  1245. PyModule_AddIntConstant(poModule, "WJ_ELDER_ATTRIBUTE_SYSTEM", 0);
  1246. #endif
  1247. #ifdef WJ_ENABLE_TRADABLE_ICON
  1248. PyModule_AddIntConstant(poModule, "WJ_ENABLE_TRADABLE_ICON", 1);
  1249. #else
  1250. PyModule_AddIntConstant(poModule, "WJ_ENABLE_TRADABLE_ICON", 0);
  1251. #endif
  1252. #ifdef ENABLE_ENERGY_SYSTEM
  1253. PyModule_AddIntConstant(poModule, "ENABLE_ENERGY_SYSTEM", 1);
  1254. #else
  1255. PyModule_AddIntConstant(poModule, "ENABLE_ENERGY_SYSTEM", 0);
  1256. #endif
  1257. #ifdef ENABLE_DRAGON_SOUL_SYSTEM
  1258. PyModule_AddIntConstant(poModule, "ENABLE_DRAGON_SOUL_SYSTEM", 1);
  1259. #else
  1260. PyModule_AddIntConstant(poModule, "ENABLE_DRAGON_SOUL_SYSTEM", 0);
  1261. #endif
  1262. #ifdef ENABLE_NEW_EQUIPMENT_SYSTEM
  1263. PyModule_AddIntConstant(poModule, "ENABLE_NEW_EQUIPMENT_SYSTEM", 1);
  1264. #else
  1265. PyModule_AddIntConstant(poModule, "ENABLE_NEW_EQUIPMENT_SYSTEM", 0);
  1266. #endif
  1267. #ifdef ENABLE_CHEQUE_SYSTEM
  1268. PyModule_AddIntConstant(poModule, "ENABLE_CHEQUE_SYSTEM", 1);
  1269. #else
  1270. PyModule_AddIntConstant(poModule, "ENABLE_CHEQUE_SYSTEM", 0);
  1271. #endif
  1272. #ifdef ENABLE_NEW_EXCHANGE_WINDOW
  1273. PyModule_AddIntConstant(poModule, "ENABLE_NEW_EXCHANGE_WINDOW", 1);
  1274. #else
  1275. PyModule_AddIntConstant(poModule, "ENABLE_NEW_EXCHANGE_WINDOW", 0);
  1276. #endif
  1277. }

PythonApplicationModule.cpp