Advertisement
bogdan1809

Untitled

Sep 15th, 2019
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 90.01 KB | None | 0 0
  1. #include "StdAfx.h"
  2. #include "PythonPlayer.h"
  3. #include "PythonApplication.h"
  4.  
  5. extern const DWORD c_iSkillIndex_Tongsol = 121;
  6. extern const DWORD c_iSkillIndex_Combo = 122;
  7. extern const DWORD c_iSkillIndex_Fishing = 123;
  8. extern const DWORD c_iSkillIndex_Mining = 124;
  9. extern const DWORD c_iSkillIndex_Making = 125;
  10. extern const DWORD c_iSkillIndex_Language1 = 126;
  11. extern const DWORD c_iSkillIndex_Language2 = 127;
  12. extern const DWORD c_iSkillIndex_Language3 = 128;
  13. extern const DWORD c_iSkillIndex_Polymorph = 129;
  14. extern const DWORD c_iSkillIndex_Riding = 130;
  15. extern const DWORD c_iSkillIndex_Summon = 131;
  16.  
  17. enum
  18. {
  19. EMOTION_CLAP = 1,
  20. EMOTION_CHEERS_1,
  21. EMOTION_CHEERS_2,
  22. EMOTION_DANCE_1,
  23. EMOTION_DANCE_2,
  24. EMOTION_DANCE_3,
  25. EMOTION_DANCE_4,
  26. EMOTION_DANCE_5,
  27. EMOTION_DANCE_6, // 강남스타일
  28. EMOTION_CONGRATULATION,
  29. EMOTION_FORGIVE,
  30. EMOTION_ANGRY,
  31.  
  32. EMOTION_ATTRACTIVE,
  33. EMOTION_SAD,
  34. EMOTION_SHY,
  35. EMOTION_CHEERUP,
  36. EMOTION_BANTER,
  37. EMOTION_JOY,
  38.  
  39. EMOTION_KISS = 51,
  40. EMOTION_FRENCH_KISS,
  41. EMOTION_SLAP,
  42.  
  43. };
  44.  
  45. std::map<int, CGraphicImage *> m_kMap_iEmotionIndex_pkIconImage;
  46.  
  47. extern int TWOHANDED_WEWAPON_ATT_SPEED_DECREASE_VALUE;
  48.  
  49. #ifdef ENABLE_FEATURES_REFINE_SYSTEM
  50. enum
  51. {
  52. REFINE_PERCENTAGE_LOW = 5,
  53. REFINE_PERCENTAGE_MEDIUM = 10,
  54. REFINE_PERCENTAGE_EXTRA = 15,
  55.  
  56. REFINE_VNUM_POTION_LOW = 56001,
  57. REFINE_VNUM_POTION_MEDIUM = 56002,
  58. REFINE_VNUM_POTION_EXTRA = 56003,
  59. };
  60. #endif
  61.  
  62. #ifdef ENABLE_NEW_EQUIPMENT_SYSTEM
  63. class CBeltInventoryHelper
  64. {
  65. public:
  66. typedef BYTE TGradeUnit;
  67.  
  68. static TGradeUnit GetBeltGradeByRefineLevel(int refineLevel)
  69. {
  70. static TGradeUnit beltGradeByLevelTable[] =
  71. {
  72. 0, // 벨트+0
  73. 1, // +1
  74. 1, // +2
  75. 2, // +3
  76. 2, // +4,
  77. 3, // +5
  78. 4, // +6,
  79. 5, // +7,
  80. 6, // +8,
  81. 7, // +9
  82. };
  83.  
  84. return beltGradeByLevelTable[refineLevel];
  85. }
  86.  
  87. // 현재 벨트 레벨을 기준으로, 어떤 셀들을 이용할 수 있는지 리턴
  88. static const TGradeUnit* GetAvailableRuleTableByGrade()
  89. {
  90. /**
  91. 벨트는 총 +0 ~ +9 레벨을 가질 수 있으며, 레벨에 따라 7단계 등급으로 구분되어 인벤토리가 활성 화 된다.
  92. 벨트 레벨에 따른 사용 가능한 셀은 아래 그림과 같음. 현재 등급 >= 활성가능 등급이면 사용 가능.
  93. (단, 현재 레벨이 0이면 무조건 사용 불가, 괄호 안의 숫자는 등급)
  94.  
  95. 2(1) 4(2) 6(4) 8(6)
  96. 5(3) 5(3) 6(4) 8(6)
  97. 7(5) 7(5) 7(5) 8(6)
  98. 9(7) 9(7) 9(7) 9(7)
  99.  
  100. 벨트 인벤토리의 크기는 4x4 (16칸)
  101. */
  102.  
  103. static TGradeUnit availableRuleByGrade[c_Belt_Inventory_Slot_Count] = {
  104. 1, 2, 4, 6,
  105. 3, 3, 4, 6,
  106. 5, 5, 5, 6,
  107. 7, 7, 7, 7
  108. };
  109.  
  110. return availableRuleByGrade;
  111. }
  112.  
  113. static bool IsAvailableCell(WORD cell, int beltGrade /*int beltLevel*/)
  114. {
  115. // 기획 또 바뀜.. 아놔...
  116. //const TGradeUnit beltGrade = GetBeltGradeByRefineLevel(beltLevel);
  117. const TGradeUnit* ruleTable = GetAvailableRuleTableByGrade();
  118.  
  119. return ruleTable[cell] <= beltGrade;
  120. }
  121.  
  122. };
  123. #endif
  124. PyObject * playerPickCloseItemVector(PyObject* poSelf, PyObject* poArgs)
  125. {
  126. CPythonPlayer::Instance().PickCloseItemVector();
  127. return Py_BuildNone();
  128. }
  129.  
  130. PyObject * playerPickCloseItem(PyObject* poSelf, PyObject* poArgs)
  131. {
  132. CPythonPlayer::Instance().PickCloseItem();
  133. return Py_BuildNone();
  134. }
  135.  
  136.  
  137. PyObject * playerSetGameWindow(PyObject* poSelf, PyObject* poArgs)
  138. {
  139. PyObject * pyHandle;
  140. if (!PyTuple_GetObject(poArgs, 0, &pyHandle))
  141. return Py_BadArgument();
  142.  
  143. CPythonPlayer & rkPlayer = CPythonPlayer::Instance();
  144. rkPlayer.SetGameWindow(pyHandle);
  145. return Py_BuildNone();
  146. }
  147.  
  148.  
  149. PyObject * playerSetQuickCameraMode(PyObject* poSelf, PyObject* poArgs)
  150. {
  151. int nIsEnable;
  152. if (!PyTuple_GetInteger(poArgs, 0, &nIsEnable))
  153. return Py_BadArgument();
  154.  
  155. CPythonPlayer & rkPlayer = CPythonPlayer::Instance();
  156. rkPlayer.SetQuickCameraMode(nIsEnable ? true : false);
  157.  
  158. return Py_BuildNone();
  159. }
  160.  
  161. // Test Code
  162. PyObject * playerSetMainCharacterIndex(PyObject* poSelf, PyObject* poArgs)
  163. {
  164. int iVID;
  165. if (!PyTuple_GetInteger(poArgs, 0, &iVID))
  166. return Py_BuildException();
  167.  
  168. CPythonPlayer::Instance().SetMainCharacterIndex(iVID);
  169. CPythonCharacterManager::Instance().SetMainInstance(iVID);
  170.  
  171. return Py_BuildNone();
  172. }
  173. // Test Code
  174.  
  175. PyObject * playerGetMainCharacterIndex(PyObject* poSelf, PyObject* poArgs)
  176. {
  177. return Py_BuildValue("i", CPythonPlayer::Instance().GetMainCharacterIndex());
  178. }
  179.  
  180. PyObject * playerGetMainCharacterName(PyObject* poSelf, PyObject* poArgs)
  181. {
  182. return Py_BuildValue("s", CPythonPlayer::Instance().GetName());
  183. }
  184.  
  185. PyObject * playerGetMainCharacterPosition(PyObject* poSelf, PyObject* poArgs)
  186. {
  187. TPixelPosition kPPosMainActor;
  188. CPythonPlayer & rkPlayer = CPythonPlayer::Instance();
  189. rkPlayer.NEW_GetMainActorPosition(&kPPosMainActor);
  190. return Py_BuildValue("fff", kPPosMainActor.x, kPPosMainActor.y, kPPosMainActor.z);
  191. }
  192.  
  193. PyObject * playerIsMainCharacterIndex(PyObject* poSelf, PyObject* poArgs)
  194. {
  195. int iVID;
  196. if (!PyTuple_GetInteger(poArgs, 0, &iVID))
  197. return Py_BuildException();
  198.  
  199. return Py_BuildValue("i", CPythonPlayer::Instance().IsMainCharacterIndex(iVID));
  200. }
  201.  
  202. PyObject * playerCanAttackInstance(PyObject* poSelf, PyObject* poArgs)
  203. {
  204. int iVID;
  205. if (!PyTuple_GetInteger(poArgs, 0, &iVID))
  206. return Py_BuildException();
  207.  
  208. CInstanceBase * pMainInstance = CPythonPlayer::Instance().NEW_GetMainActorPtr();
  209. CInstanceBase * pTargetInstance = CPythonCharacterManager::Instance().GetInstancePtr(iVID);
  210. if (!pMainInstance)
  211. return Py_BuildValue("i", 0);
  212. if (!pTargetInstance)
  213. return Py_BuildValue("i", 0);
  214.  
  215. return Py_BuildValue("i", pMainInstance->IsAttackableInstance(*pTargetInstance));
  216. }
  217.  
  218. PyObject * playerIsActingEmotion(PyObject* poSelf, PyObject* poArgs)
  219. {
  220. CInstanceBase * pMainInstance = CPythonPlayer::Instance().NEW_GetMainActorPtr();
  221. if (!pMainInstance)
  222. return Py_BuildValue("i", 0);
  223.  
  224. return Py_BuildValue("i", pMainInstance->IsActingEmotion());
  225. }
  226.  
  227. PyObject * playerIsPVPInstance(PyObject* poSelf, PyObject* poArgs)
  228. {
  229. int iVID;
  230. if (!PyTuple_GetInteger(poArgs, 0, &iVID))
  231. return Py_BuildException();
  232.  
  233. CInstanceBase * pMainInstance = CPythonPlayer::Instance().NEW_GetMainActorPtr();
  234. CInstanceBase * pTargetInstance = CPythonCharacterManager::Instance().GetInstancePtr(iVID);
  235. if (!pMainInstance)
  236. return Py_BuildValue("i", 0);
  237. if (!pTargetInstance)
  238. return Py_BuildValue("i", 0);
  239.  
  240. return Py_BuildValue("i", pMainInstance->IsPVPInstance(*pTargetInstance));
  241. }
  242.  
  243. PyObject * playerIsSameEmpire(PyObject* poSelf, PyObject* poArgs)
  244. {
  245. int iVID;
  246. if (!PyTuple_GetInteger(poArgs, 0, &iVID))
  247. return Py_BuildException();
  248.  
  249. CInstanceBase * pMainInstance = CPythonPlayer::Instance().NEW_GetMainActorPtr();
  250. CInstanceBase * pTargetInstance = CPythonCharacterManager::Instance().GetInstancePtr(iVID);
  251. if (!pMainInstance)
  252. return Py_BuildValue("i", FALSE);
  253. if (!pTargetInstance)
  254. return Py_BuildValue("i", FALSE);
  255.  
  256. return Py_BuildValue("i", pMainInstance->IsSameEmpire(*pTargetInstance));
  257. }
  258.  
  259. PyObject * playerIsChallengeInstance(PyObject* poSelf, PyObject* poArgs)
  260. {
  261. int iVID;
  262. if (!PyTuple_GetInteger(poArgs, 0, &iVID))
  263. return Py_BuildException();
  264.  
  265. return Py_BuildValue("i", CPythonPlayer::Instance().IsChallengeInstance(iVID));
  266. }
  267.  
  268. PyObject * playerIsRevengeInstance(PyObject* poSelf, PyObject* poArgs)
  269. {
  270. int iVID;
  271. if (!PyTuple_GetInteger(poArgs, 0, &iVID))
  272. return Py_BuildException();
  273.  
  274. return Py_BuildValue("i", CPythonPlayer::Instance().IsRevengeInstance(iVID));
  275. }
  276.  
  277. PyObject * playerIsCantFightInstance(PyObject* poSelf, PyObject* poArgs)
  278. {
  279. int iVID;
  280. if (!PyTuple_GetInteger(poArgs, 0, &iVID))
  281. return Py_BuildException();
  282.  
  283. return Py_BuildValue("i", CPythonPlayer::Instance().IsCantFightInstance(iVID));
  284. }
  285.  
  286. PyObject * playerGetCharacterDistance(PyObject* poSelf, PyObject* poArgs)
  287. {
  288. int iVID;
  289. if (!PyTuple_GetInteger(poArgs, 0, &iVID))
  290. return Py_BuildException();
  291.  
  292. CInstanceBase * pMainInstance = CPythonPlayer::Instance().NEW_GetMainActorPtr();
  293. CInstanceBase * pTargetInstance = CPythonCharacterManager::Instance().GetInstancePtr(iVID);
  294. if (!pMainInstance)
  295. return Py_BuildValue("f", -1.0f);
  296. if (!pTargetInstance)
  297. return Py_BuildValue("f", -1.0f);
  298.  
  299. return Py_BuildValue("f", pMainInstance->GetDistance(pTargetInstance));
  300. }
  301.  
  302. PyObject * playerIsInSafeArea(PyObject* poSelf, PyObject* poArgs)
  303. {
  304. CInstanceBase * pMainInstance = CPythonPlayer::Instance().NEW_GetMainActorPtr();
  305. if (!pMainInstance)
  306. return Py_BuildValue("i", FALSE);
  307.  
  308. return Py_BuildValue("i", pMainInstance->IsInSafe());
  309. }
  310.  
  311. PyObject * playerIsMountingHorse(PyObject* poSelf, PyObject* poArgs)
  312. {
  313. CInstanceBase * pMainInstance = CPythonPlayer::Instance().NEW_GetMainActorPtr();
  314. if (!pMainInstance)
  315. return Py_BuildValue("i", FALSE);
  316.  
  317. return Py_BuildValue("i", pMainInstance->IsMountingHorse());
  318. }
  319.  
  320. PyObject * playerIsObserverMode(PyObject* poSelf, PyObject* poArgs)
  321. {
  322. CPythonPlayer& rkPlayer=CPythonPlayer::Instance();
  323. return Py_BuildValue("i", rkPlayer.IsObserverMode());
  324. }
  325.  
  326. PyObject * playerActEmotion(PyObject* poSelf, PyObject* poArgs)
  327. {
  328. int iVID;
  329. if (!PyTuple_GetInteger(poArgs, 0, &iVID))
  330. return Py_BuildException();
  331.  
  332. CPythonPlayer& rkPlayer=CPythonPlayer::Instance();
  333. rkPlayer.ActEmotion(iVID);
  334. return Py_BuildNone();
  335. }
  336.  
  337. PyObject * playerShowPlayer(PyObject* poSelf, PyObject* poArgs)
  338. {
  339. CInstanceBase * pMainInstance = CPythonPlayer::Instance().NEW_GetMainActorPtr();
  340. if (pMainInstance)
  341. pMainInstance->GetGraphicThingInstanceRef().Show();
  342. return Py_BuildNone();
  343. }
  344.  
  345. PyObject * playerHidePlayer(PyObject* poSelf, PyObject* poArgs)
  346. {
  347. CInstanceBase * pMainInstance = CPythonPlayer::Instance().NEW_GetMainActorPtr();
  348. if (pMainInstance)
  349. pMainInstance->GetGraphicThingInstanceRef().Hide();
  350. return Py_BuildNone();
  351. }
  352.  
  353.  
  354. PyObject * playerComboAttack(PyObject* poSelf, PyObject* poArgs)
  355. {
  356. CPythonPlayer::Instance().NEW_Attack();
  357. return Py_BuildNone();
  358. }
  359.  
  360.  
  361. PyObject * playerRegisterEffect(PyObject* poSelf, PyObject* poArgs)
  362. {
  363. int iEft;
  364. if (!PyTuple_GetInteger(poArgs, 0, &iEft))
  365. return Py_BadArgument();
  366.  
  367. char* szFileName;
  368. if (!PyTuple_GetString(poArgs, 1, &szFileName))
  369. return Py_BadArgument();
  370.  
  371. CPythonPlayer & rkPlayer = CPythonPlayer::Instance();
  372. if (!rkPlayer.RegisterEffect(iEft, szFileName, false))
  373. return Py_BuildException("CPythonPlayer::RegisterEffect(eEft=%d, szFileName=%s", iEft, szFileName);
  374.  
  375. return Py_BuildNone();
  376. }
  377.  
  378. PyObject * playerRegisterCacheEffect(PyObject* poSelf, PyObject* poArgs)
  379. {
  380. int iEft;
  381. if (!PyTuple_GetInteger(poArgs, 0, &iEft))
  382. return Py_BadArgument();
  383.  
  384. char* szFileName;
  385. if (!PyTuple_GetString(poArgs, 1, &szFileName))
  386. return Py_BadArgument();
  387.  
  388. CPythonPlayer & rkPlayer = CPythonPlayer::Instance();
  389. if (!rkPlayer.RegisterEffect(iEft, szFileName, true))
  390. return Py_BuildException("CPythonPlayer::RegisterEffect(eEft=%d, szFileName=%s", iEft, szFileName);
  391.  
  392. return Py_BuildNone();
  393. }
  394.  
  395. PyObject * playerSetAttackKeyState(PyObject* poSelf, PyObject* poArgs)
  396. {
  397. int isPressed;
  398. if (!PyTuple_GetInteger(poArgs, 0, &isPressed))
  399. return Py_BuildException("playerSetAttackKeyState(isPressed) - There is no first argument");
  400.  
  401. CPythonPlayer & rkPlayer = CPythonPlayer::Instance();
  402. rkPlayer.SetAttackKeyState(isPressed ? true : false);
  403. return Py_BuildNone();
  404. }
  405.  
  406. PyObject * playerSetSingleDIKKeyState(PyObject* poSelf, PyObject* poArgs)
  407. {
  408. int eDIK;
  409. if (!PyTuple_GetInteger(poArgs, 0, &eDIK))
  410. return Py_BuildException("playerSetSingleDIKKeyState(eDIK, isPressed) - There is no first argument");
  411.  
  412. int isPressed;
  413. if (!PyTuple_GetInteger(poArgs, 1, &isPressed))
  414. return Py_BuildException("playerSetSingleDIKKeyState(eDIK, isPressed) - There is no second argument");
  415.  
  416. CPythonPlayer & rkPlayer = CPythonPlayer::Instance();
  417. rkPlayer.NEW_SetSingleDIKKeyState(eDIK, isPressed ? true : false);
  418. return Py_BuildNone();
  419. }
  420.  
  421. PyObject * playerEndKeyWalkingImmediately(PyObject* poSelf, PyObject* poArgs)
  422. {
  423. CPythonPlayer::Instance().NEW_Stop();
  424. return Py_BuildNone();
  425. }
  426.  
  427.  
  428. PyObject * playerStartMouseWalking(PyObject* poSelf, PyObject* poArgs)
  429. {
  430. return Py_BuildNone();
  431. }
  432.  
  433. PyObject * playerEndMouseWalking(PyObject* poSelf, PyObject* poArgs)
  434. {
  435. return Py_BuildNone();
  436. }
  437.  
  438. PyObject * playerResetCameraRotation(PyObject* poSelf, PyObject* poArgs)
  439. {
  440. CPythonPlayer::Instance().NEW_ResetCameraRotation();
  441. return Py_BuildNone();
  442. }
  443.  
  444. PyObject* playerSetAutoCameraRotationSpeed(PyObject* poSelf, PyObject* poArgs)
  445. {
  446. float fCmrRotSpd;
  447. if (!PyTuple_GetFloat(poArgs, 0, &fCmrRotSpd))
  448. return Py_BuildException();
  449.  
  450. CPythonPlayer& rkPlayer=CPythonPlayer::Instance();
  451. rkPlayer.NEW_SetAutoCameraRotationSpeed(fCmrRotSpd);
  452. return Py_BuildNone();
  453. }
  454.  
  455. PyObject* playerSetMouseState(PyObject* poSelf, PyObject* poArgs)
  456. {
  457. int eMBT;
  458. if (!PyTuple_GetInteger(poArgs, 0, &eMBT))
  459. return Py_BuildException();
  460.  
  461. int eMBS;
  462. if (!PyTuple_GetInteger(poArgs, 1, &eMBS))
  463. return Py_BuildException();
  464.  
  465. CPythonPlayer& rkPlayer=CPythonPlayer::Instance();
  466. rkPlayer.NEW_SetMouseState(eMBT, eMBS);
  467.  
  468. return Py_BuildNone();
  469. }
  470.  
  471. PyObject* playerSetMouseFunc(PyObject* poSelf, PyObject* poArgs)
  472. {
  473. int eMBT;
  474. if (!PyTuple_GetInteger(poArgs, 0, &eMBT))
  475. return Py_BuildException();
  476.  
  477. int eMBS;
  478. if (!PyTuple_GetInteger(poArgs, 1, &eMBS))
  479. return Py_BuildException();
  480.  
  481. CPythonPlayer& rkPlayer=CPythonPlayer::Instance();
  482. rkPlayer.NEW_SetMouseFunc(eMBT, eMBS);
  483.  
  484. return Py_BuildNone();
  485. }
  486.  
  487. PyObject* playerGetMouseFunc(PyObject* poSelf, PyObject* poArgs)
  488. {
  489. int eMBT;
  490. if (!PyTuple_GetInteger(poArgs, 0, &eMBT))
  491. return Py_BuildException();
  492.  
  493. CPythonPlayer& rkPlayer=CPythonPlayer::Instance();
  494. return Py_BuildValue("i", rkPlayer.NEW_GetMouseFunc(eMBT));
  495. }
  496.  
  497. PyObject* playerSetMouseMiddleButtonState(PyObject* poSelf, PyObject* poArgs)
  498. {
  499. int eMBS;
  500. if (!PyTuple_GetInteger(poArgs, 0, &eMBS))
  501. return Py_BuildException();
  502.  
  503. CPythonPlayer& rkPlayer=CPythonPlayer::Instance();
  504. rkPlayer.NEW_SetMouseMiddleButtonState(eMBS);
  505.  
  506. return Py_BuildNone();
  507. }
  508.  
  509. ///////////////////////////////////////////////////////////////////////////////////////////////////
  510.  
  511. PyObject * playerGetName(PyObject* poSelf, PyObject* poArgs)
  512. {
  513. return Py_BuildValue("s", CPythonPlayer::Instance().GetName());
  514. }
  515.  
  516. PyObject * playerGetRace(PyObject* poSelf, PyObject* poArgs)
  517. {
  518. return Py_BuildValue("i", CPythonPlayer::Instance().GetRace());
  519. }
  520.  
  521. PyObject * playerGetJob(PyObject* poSelf, PyObject* poArgs)
  522. {
  523. int race = CPythonPlayer::Instance().GetRace();
  524. int job = RaceToJob(race);
  525. return Py_BuildValue("i", job);
  526. }
  527.  
  528. PyObject * playerGetPlayTime(PyObject* poSelf, PyObject* poArgs)
  529. {
  530. return Py_BuildValue("i", CPythonPlayer::Instance().GetPlayTime());
  531. }
  532.  
  533. PyObject * playerSetPlayTime(PyObject* poSelf, PyObject* poArgs)
  534. {
  535. int iTime;
  536. if (!PyTuple_GetInteger(poArgs, 0, &iTime))
  537. return Py_BuildException();
  538.  
  539. CPythonPlayer::Instance().SetPlayTime(iTime);
  540. return Py_BuildNone();
  541. }
  542.  
  543. PyObject * playerIsSkillCoolTime(PyObject* poSelf, PyObject* poArgs)
  544. {
  545. int iSlotIndex;
  546. if (!PyTuple_GetInteger(poArgs, 0, &iSlotIndex))
  547. return Py_BuildException();
  548.  
  549. return Py_BuildValue("i", CPythonPlayer::Instance().IsSkillCoolTime(iSlotIndex));
  550. }
  551.  
  552. PyObject * playerGetItemTypeBySlot(PyObject * poSelf, PyObject * poArgs)
  553. {
  554. TItemPos Cell;
  555. switch (PyTuple_Size(poArgs))
  556. {
  557. case 1:
  558. if (!PyTuple_GetInteger(poArgs, 0, &Cell.cell))
  559. return Py_BadArgument();
  560. break;
  561. case 2:
  562. if (!PyTuple_GetByte(poArgs, 0, &Cell.window_type))
  563. return Py_BadArgument();
  564. if (!PyTuple_GetInteger(poArgs, 1, &Cell.cell))
  565. return Py_BadArgument();
  566. break;
  567. default:
  568. return Py_BuildException();
  569. }
  570.  
  571. return Py_BuildValue("i", CPythonPlayer::Instance().GetItemTypeBySlot(Cell));
  572. }
  573.  
  574. PyObject * playerGetSkillCoolTime(PyObject* poSelf, PyObject* poArgs)
  575. {
  576. int iSlotIndex;
  577. if (!PyTuple_GetInteger(poArgs, 0, &iSlotIndex))
  578. return Py_BuildException();
  579.  
  580. float fCoolTime = CPythonPlayer::Instance().GetSkillCoolTime(iSlotIndex);
  581. float fElapsedCoolTime = CPythonPlayer::Instance().GetSkillElapsedCoolTime(iSlotIndex);
  582. return Py_BuildValue("ff", fCoolTime, fElapsedCoolTime);
  583. }
  584.  
  585. PyObject * playerIsSkillActive(PyObject* poSelf, PyObject* poArgs)
  586. {
  587. int iSlotIndex;
  588. if (!PyTuple_GetInteger(poArgs, 0, &iSlotIndex))
  589. return Py_BuildException();
  590.  
  591. return Py_BuildValue("i", CPythonPlayer::Instance().IsSkillActive(iSlotIndex));
  592. }
  593.  
  594. PyObject * playerUseGuildSkill(PyObject* poSelf, PyObject* poArgs)
  595. {
  596. int iSkillSlotIndex;
  597. if (!PyTuple_GetInteger(poArgs, 0, &iSkillSlotIndex))
  598. return Py_BuildException();
  599.  
  600. CPythonPlayer::Instance().UseGuildSkill(iSkillSlotIndex);
  601. return Py_BuildNone();
  602. }
  603.  
  604. PyObject * playerAffectIndexToSkillIndex(PyObject* poSelf, PyObject* poArgs)
  605. {
  606. int iAffectIndex;
  607. if (!PyTuple_GetInteger(poArgs, 0, &iAffectIndex))
  608. return Py_BuildException();
  609.  
  610. DWORD dwSkillIndex;
  611. if (!CPythonPlayer::Instance().AffectIndexToSkillIndex(iAffectIndex, &dwSkillIndex))
  612. return Py_BuildValue("i", 0);
  613.  
  614. return Py_BuildValue("i", dwSkillIndex);
  615. }
  616.  
  617. PyObject * playerGetEXP(PyObject* poSelf, PyObject* poArgs)
  618. {
  619. DWORD dwEXP = CPythonPlayer::Instance().GetStatus(POINT_EXP);
  620. return Py_BuildValue("l", dwEXP);
  621. }
  622.  
  623. PyObject * playerGetStatus(PyObject* poSelf, PyObject* poArgs)
  624. {
  625. int iType;
  626. if (!PyTuple_GetInteger(poArgs, 0, &iType))
  627. return Py_BuildException();
  628.  
  629. long iValue = CPythonPlayer::Instance().GetStatus(iType);
  630.  
  631. if (POINT_ATT_SPEED == iType)
  632. {
  633. CInstanceBase * pInstance = CPythonPlayer::Instance().NEW_GetMainActorPtr();
  634. if (pInstance && (CItemData::WEAPON_TWO_HANDED == pInstance->GetWeaponType()))
  635. {
  636. iValue -= TWOHANDED_WEWAPON_ATT_SPEED_DECREASE_VALUE;
  637. }
  638. }
  639.  
  640. return Py_BuildValue("i", iValue);
  641. }
  642.  
  643. PyObject * playerSetStatus(PyObject* poSelf, PyObject* poArgs)
  644. {
  645. int iType;
  646. if (!PyTuple_GetInteger(poArgs, 0, &iType))
  647. return Py_BuildException();
  648.  
  649. int iValue;
  650. if (!PyTuple_GetInteger(poArgs, 1, &iValue))
  651. return Py_BuildException();
  652.  
  653. CPythonPlayer::Instance().SetStatus(iType, iValue);
  654. return Py_BuildNone();
  655. }
  656.  
  657. PyObject * playerGetElk(PyObject* poSelf, PyObject* poArgs)
  658. {
  659. return PyLong_FromLongLong(CPythonPlayer::Instance().GetStatus(POINT_GOLD));
  660. }
  661.  
  662. PyObject * playerGetGuildID(PyObject* poSelf, PyObject* poArgs)
  663. {
  664. CInstanceBase * pInstance = CPythonPlayer::Instance().NEW_GetMainActorPtr();
  665. if (!pInstance)
  666. return Py_BuildValue("i", 0);
  667. return Py_BuildValue("i", pInstance->GetGuildID());
  668. }
  669.  
  670. PyObject * playerGetGuildName(PyObject* poSelf, PyObject* poArgs)
  671. {
  672. CInstanceBase * pInstance = CPythonPlayer::Instance().NEW_GetMainActorPtr();
  673. if (pInstance)
  674. {
  675. DWORD dwID = pInstance->GetGuildID();
  676. std::string strName;
  677. if (CPythonGuild::Instance().GetGuildName(dwID, &strName))
  678. return Py_BuildValue("s", strName.c_str());
  679. }
  680. return Py_BuildValue("s", "");
  681. }
  682.  
  683. PyObject * playerGetAlignmentData(PyObject* poSelf, PyObject* poArgs)
  684. {
  685. CInstanceBase * pInstance = CPythonPlayer::Instance().NEW_GetMainActorPtr();
  686. int iAlignmentPoint = 0;
  687. int iAlignmentGrade = 4;
  688. if (pInstance)
  689. {
  690. iAlignmentPoint = pInstance->GetAlignment();
  691. iAlignmentGrade = pInstance->GetAlignmentGrade();
  692. }
  693. return Py_BuildValue("ii", iAlignmentPoint, iAlignmentGrade);
  694. }
  695.  
  696. PyObject * playerSetSkill(PyObject* poSelf, PyObject* poArgs)
  697. {
  698. int iSlotIndex;
  699. if (!PyTuple_GetInteger(poArgs, 0, &iSlotIndex))
  700. return Py_BuildException();
  701.  
  702. int iSkillIndex;
  703. if (!PyTuple_GetInteger(poArgs, 1, &iSkillIndex))
  704. return Py_BuildException();
  705.  
  706. CPythonPlayer::Instance().SetSkill(iSlotIndex, iSkillIndex);
  707. return Py_BuildNone();
  708. }
  709.  
  710. PyObject * playerGetSkillIndex(PyObject* poSelf, PyObject* poArgs)
  711. {
  712. int iSlotIndex;
  713. if (!PyTuple_GetInteger(poArgs, 0, &iSlotIndex))
  714. return Py_BuildException();
  715.  
  716. return Py_BuildValue("i", CPythonPlayer::Instance().GetSkillIndex(iSlotIndex));
  717. }
  718.  
  719. PyObject * playerGetSkillSlotIndex(PyObject* poSelf, PyObject* poArgs)
  720. {
  721. int iSkillIndex;
  722. if (!PyTuple_GetInteger(poArgs, 0, &iSkillIndex))
  723. return Py_BuildException();
  724.  
  725. DWORD dwSlotIndex;
  726. if (!CPythonPlayer::Instance().GetSkillSlotIndex(iSkillIndex, &dwSlotIndex))
  727. return Py_BuildException();
  728.  
  729. return Py_BuildValue("i", dwSlotIndex);
  730. }
  731.  
  732. PyObject * playerGetSkillGrade(PyObject* poSelf, PyObject* poArgs)
  733. {
  734. int iSlotIndex;
  735. if (!PyTuple_GetInteger(poArgs, 0, &iSlotIndex))
  736. return Py_BuildException();
  737.  
  738. return Py_BuildValue("i", CPythonPlayer::Instance().GetSkillGrade(iSlotIndex));
  739. }
  740.  
  741. PyObject * playerGetSkillLevel(PyObject* poSelf, PyObject* poArgs)
  742. {
  743. int iSlotIndex;
  744. if (!PyTuple_GetInteger(poArgs, 0, &iSlotIndex))
  745. return Py_BuildException();
  746.  
  747. return Py_BuildValue("i", CPythonPlayer::Instance().GetSkillLevel(iSlotIndex));
  748. }
  749.  
  750. PyObject * playerGetSkillCurrentEfficientPercentage(PyObject* poSelf, PyObject* poArgs)
  751. {
  752. int iSlotIndex;
  753. if (!PyTuple_GetInteger(poArgs, 0, &iSlotIndex))
  754. return Py_BuildException();
  755.  
  756. return Py_BuildValue("f", CPythonPlayer::Instance().GetSkillCurrentEfficientPercentage(iSlotIndex));
  757. }
  758. PyObject * playerGetSkillNextEfficientPercentage(PyObject* poSelf, PyObject* poArgs)
  759. {
  760. int iSlotIndex;
  761. if (!PyTuple_GetInteger(poArgs, 0, &iSlotIndex))
  762. return Py_BuildException();
  763.  
  764. return Py_BuildValue("f", CPythonPlayer::Instance().GetSkillNextEfficientPercentage(iSlotIndex));
  765. }
  766.  
  767. PyObject * playerClickSkillSlot(PyObject * poSelf, PyObject * poArgs)
  768. {
  769. int iSkillSlot;
  770. if (!PyTuple_GetInteger(poArgs, 0, &iSkillSlot))
  771. return Py_BadArgument();
  772.  
  773. CPythonPlayer::Instance().ClickSkillSlot(iSkillSlot);
  774.  
  775. return Py_BuildNone();
  776. }
  777.  
  778. PyObject * playerChangeCurrentSkillNumberOnly(PyObject * poSelf, PyObject * poArgs)
  779. {
  780. int iSlotIndex;
  781. if (!PyTuple_GetInteger(poArgs, 0, &iSlotIndex))
  782. return Py_BadArgument();
  783.  
  784. CPythonPlayer::Instance().ChangeCurrentSkillNumberOnly(iSlotIndex);
  785.  
  786. return Py_BuildNone();
  787. }
  788.  
  789. PyObject * playerClearSkillDict(PyObject * poSelf, PyObject * poArgs)
  790. {
  791. CPythonPlayer::Instance().ClearSkillDict();
  792. return Py_BuildNone();
  793. }
  794.  
  795. PyObject * playerMoveItem(PyObject* poSelf, PyObject* poArgs)
  796. {
  797. TItemPos srcCell;
  798. TItemPos dstCell;
  799. switch (PyTuple_Size(poArgs))
  800. {
  801. case 2:
  802. if (!PyTuple_GetInteger(poArgs, 0, &srcCell.cell))
  803. return Py_BuildException();
  804. if (!PyTuple_GetInteger(poArgs, 1, &dstCell.cell))
  805. return Py_BuildException();
  806. break;
  807. case 4:
  808. if (!PyTuple_GetByte(poArgs, 0, &srcCell.window_type))
  809. return Py_BuildException();
  810. if (!PyTuple_GetInteger(poArgs, 1, &srcCell.cell))
  811. return Py_BuildException();
  812. if (!PyTuple_GetByte(poArgs, 2, &dstCell.window_type))
  813. return Py_BuildException();
  814. if (!PyTuple_GetInteger(poArgs, 3, &dstCell.cell))
  815. return Py_BuildException();
  816. default:
  817. return Py_BuildException();
  818. }
  819.  
  820. CPythonPlayer::Instance().MoveItemData(srcCell, dstCell);
  821. return Py_BuildNone();
  822. }
  823.  
  824. PyObject * playerSendClickItemPacket(PyObject* poSelf, PyObject* poArgs)
  825. {
  826. int ivid;
  827. if (!PyTuple_GetInteger(poArgs, 0, &ivid))
  828. return Py_BuildException();
  829.  
  830. CPythonPlayer::Instance().SendClickItemPacket(ivid);
  831. return Py_BuildNone();
  832. }
  833.  
  834. PyObject * playerGetItemIndex(PyObject* poSelf, PyObject* poArgs)
  835. {
  836. switch (PyTuple_Size(poArgs))
  837. {
  838. case 1:
  839. {
  840. int iSlotIndex;
  841. if (!PyTuple_GetInteger(poArgs, 0, &iSlotIndex))
  842. return Py_BuildException();
  843.  
  844. int ItemIndex = CPythonPlayer::Instance().GetItemIndex(TItemPos (INVENTORY, iSlotIndex));
  845. return Py_BuildValue("i", ItemIndex);
  846. }
  847. case 2:
  848. {
  849. TItemPos Cell;
  850. if (!PyTuple_GetByte(poArgs, 0, &Cell.window_type))
  851. return Py_BuildException();
  852. if (!PyTuple_GetInteger(poArgs, 1, &Cell.cell))
  853. return Py_BuildException();
  854.  
  855. int ItemIndex = CPythonPlayer::Instance().GetItemIndex(Cell);
  856. return Py_BuildValue("i", ItemIndex);
  857. }
  858. default:
  859. return Py_BuildException();
  860.  
  861. }
  862. }
  863.  
  864. PyObject * playerGetItemFlags(PyObject* poSelf, PyObject* poArgs)
  865. {
  866. switch (PyTuple_Size(poArgs))
  867. {
  868. case 1:
  869. {
  870. int iSlotIndex;
  871. if (!PyTuple_GetInteger(poArgs, 0, &iSlotIndex))
  872. return Py_BuildException();
  873.  
  874. DWORD flags = CPythonPlayer::Instance().GetItemFlags(TItemPos(INVENTORY, iSlotIndex));
  875. return Py_BuildValue("i", flags);
  876. }
  877. case 2:
  878. {
  879. TItemPos Cell;
  880. if (!PyTuple_GetByte(poArgs, 0, &Cell.window_type))
  881. return Py_BuildException();
  882.  
  883. if (!PyTuple_GetInteger(poArgs, 1, &Cell.cell))
  884. return Py_BuildException();
  885.  
  886. DWORD flags = CPythonPlayer::Instance().GetItemFlags(Cell);
  887. return Py_BuildValue("i", flags);
  888. }
  889. default:
  890. return Py_BuildException();
  891. }
  892. }
  893.  
  894.  
  895. PyObject * playerGetItemCount(PyObject* poSelf, PyObject* poArgs)
  896. {
  897. switch (PyTuple_Size(poArgs))
  898. {
  899. case 1:
  900. {
  901. int iSlotIndex;
  902. if (!PyTuple_GetInteger(poArgs, 0, &iSlotIndex))
  903. return Py_BuildException();
  904.  
  905. int ItemNum = CPythonPlayer::Instance().GetItemCount(TItemPos (INVENTORY, iSlotIndex));
  906. return Py_BuildValue("i", ItemNum);
  907. }
  908. case 2:
  909. {
  910. TItemPos Cell;
  911. if (!PyTuple_GetByte(poArgs, 0, &Cell.window_type))
  912. return Py_BuildException();
  913.  
  914. if (!PyTuple_GetInteger(poArgs, 1, &Cell.cell))
  915. return Py_BuildException();
  916.  
  917. int ItemNum = CPythonPlayer::Instance().GetItemCount(Cell);
  918.  
  919. return Py_BuildValue("i", ItemNum);
  920. }
  921. default:
  922. return Py_BuildException();
  923.  
  924. }
  925. }
  926.  
  927. PyObject * playerSetItemCount(PyObject* poSelf, PyObject* poArgs)
  928. {
  929. switch (PyTuple_Size(poArgs))
  930. {
  931. case 2:
  932. {
  933. int iSlotIndex;
  934. if (!PyTuple_GetInteger(poArgs, 0, &iSlotIndex))
  935. return Py_BuildException();
  936.  
  937. WORD wCount;
  938. if (!PyTuple_GetInteger(poArgs, 1, &wCount))
  939. return Py_BuildException();
  940.  
  941. if (0 == wCount)
  942. return Py_BuildException();
  943.  
  944. CPythonPlayer::Instance().SetItemCount(TItemPos (INVENTORY, iSlotIndex), wCount);
  945. return Py_BuildNone();
  946. }
  947. case 3:
  948. {
  949. TItemPos Cell;
  950. if (!PyTuple_GetByte(poArgs, 0, &Cell.window_type))
  951. return Py_BuildException();
  952.  
  953. if (!PyTuple_GetInteger(poArgs, 1, &Cell.cell))
  954. return Py_BuildException();
  955.  
  956. WORD wCount;
  957. if (!PyTuple_GetInteger(poArgs, 2, &wCount))
  958. return Py_BuildException();
  959.  
  960. CPythonPlayer::Instance().SetItemCount(Cell, wCount);
  961.  
  962. return Py_BuildNone();
  963. }
  964. default:
  965. return Py_BuildException();
  966.  
  967. }
  968. }
  969.  
  970. PyObject * playerGetItemCountByVnum(PyObject* poSelf, PyObject* poArgs)
  971. {
  972. int ivnum;
  973. if (!PyTuple_GetInteger(poArgs, 0, &ivnum))
  974. return Py_BuildException();
  975.  
  976. int ItemNum = CPythonPlayer::Instance().GetItemCountByVnum(ivnum);
  977. return Py_BuildValue("i", ItemNum);
  978. }
  979.  
  980. PyObject * playerGetItemMetinSocket(PyObject* poSelf, PyObject* poArgs)
  981. {
  982. TItemPos Cell;
  983. int iMetinSocketIndex;
  984.  
  985. switch (PyTuple_Size(poArgs))
  986. {
  987. case 2:
  988. if (!PyTuple_GetInteger(poArgs, 0, &Cell.cell))
  989. return Py_BuildException();
  990.  
  991. if (!PyTuple_GetInteger(poArgs, 1, &iMetinSocketIndex))
  992. return Py_BuildException();
  993.  
  994. break;
  995. case 3:
  996. if (!PyTuple_GetByte(poArgs, 0, &Cell.window_type))
  997. return Py_BuildException();
  998. if (!PyTuple_GetInteger(poArgs, 1, &Cell.cell))
  999. return Py_BuildException();
  1000. if (!PyTuple_GetInteger(poArgs, 2, &iMetinSocketIndex))
  1001. return Py_BuildException();
  1002.  
  1003. break;
  1004.  
  1005. default:
  1006. return Py_BuildException();
  1007.  
  1008. }
  1009. int nMetinSocketValue = CPythonPlayer::Instance().GetItemMetinSocket(Cell, iMetinSocketIndex);
  1010. return Py_BuildValue("i", nMetinSocketValue);
  1011. }
  1012.  
  1013. PyObject * playerGetItemAttribute(PyObject* poSelf, PyObject* poArgs)
  1014. {
  1015. TItemPos Cell;
  1016. int iAttributeSlotIndex;
  1017. switch (PyTuple_Size(poArgs))
  1018. {
  1019. case 2:
  1020. if (!PyTuple_GetInteger(poArgs, 0, &Cell.cell))
  1021. return Py_BuildException();
  1022.  
  1023. if (!PyTuple_GetInteger(poArgs, 1, &iAttributeSlotIndex))
  1024. return Py_BuildException();
  1025.  
  1026. break;
  1027. case 3:
  1028. if (!PyTuple_GetByte(poArgs, 0, &Cell.window_type))
  1029. return Py_BuildException();
  1030.  
  1031. if (!PyTuple_GetInteger(poArgs, 1, &Cell.cell))
  1032. return Py_BuildException();
  1033.  
  1034. if (!PyTuple_GetInteger(poArgs, 2, &iAttributeSlotIndex))
  1035. return Py_BuildException();
  1036. break;
  1037. default:
  1038. return Py_BuildException();
  1039. }
  1040. BYTE byType;
  1041. short sValue;
  1042. CPythonPlayer::Instance().GetItemAttribute(Cell, iAttributeSlotIndex, &byType, &sValue);
  1043.  
  1044. return Py_BuildValue("ii", byType, sValue);
  1045. }
  1046.  
  1047. PyObject * playerGetItemLink(PyObject * poSelf, PyObject * poArgs)
  1048. {
  1049. TItemPos Cell;
  1050.  
  1051. switch (PyTuple_Size(poArgs))
  1052. {
  1053. case 1:
  1054. if (!PyTuple_GetInteger(poArgs, 0, &Cell.cell))
  1055. return Py_BuildException();
  1056. break;
  1057. case 2:
  1058. if (!PyTuple_GetByte(poArgs, 0, &Cell.window_type))
  1059. return Py_BuildException();
  1060. if (!PyTuple_GetInteger(poArgs, 1, &Cell.cell))
  1061. return Py_BuildException();
  1062. break;
  1063. default:
  1064. return Py_BuildException();
  1065. }
  1066. const TItemData * pPlayerItem = CPythonPlayer::Instance().GetItemData(Cell);
  1067. CItemData * pItemData = NULL;
  1068. char buf[1024];
  1069.  
  1070. if (pPlayerItem && CItemManager::Instance().GetItemDataPointer(pPlayerItem->vnum, &pItemData))
  1071. {
  1072. #ifdef ENABLE_CHANGELOOK_SYSTEM
  1073. char itemlink[256 + 12];
  1074. #else
  1075. char itemlink[256];
  1076. #endif
  1077. int len;
  1078. bool isAttr = false;
  1079.  
  1080. len = snprintf(itemlink, sizeof(itemlink), "item:%x:%x:%x:%x:%x",
  1081. pPlayerItem->vnum, pPlayerItem->flags,
  1082. pPlayerItem->alSockets[0], pPlayerItem->alSockets[1], pPlayerItem->alSockets[2]);
  1083.  
  1084. #ifdef ENABLE_CHANGELOOK_SYSTEM
  1085. len += snprintf(itemlink + len, sizeof(itemlink) - len, ":%x", pPlayerItem->transmutation);
  1086. #endif
  1087.  
  1088. for (int i = 0; i < ITEM_ATTRIBUTE_SLOT_MAX_NUM; ++i)
  1089. if (pPlayerItem->aAttr[i].bType != 0)
  1090. {
  1091. len += snprintf(itemlink + len, sizeof(itemlink) - len, ":%x:%d",
  1092. pPlayerItem->aAttr[i].bType, pPlayerItem->aAttr[i].sValue);
  1093. isAttr = true;
  1094. }
  1095.  
  1096.  
  1097. if( GetDefaultCodePage() == CP_ARABIC ) {
  1098. if (isAttr)
  1099. //"item:번호:플래그:소켓0:소켓1:소켓2"
  1100. snprintf(buf, sizeof(buf), " |h|r[%s]|cffffc700|H%s|h", pItemData->GetName(), itemlink);
  1101. else
  1102. snprintf(buf, sizeof(buf), " |h|r[%s]|cfff1e6c0|H%s|h", pItemData->GetName(), itemlink);
  1103. } else {
  1104. if (isAttr)
  1105. //"item:번호:플래그:소켓0:소켓1:소켓2"
  1106. snprintf(buf, sizeof(buf), "|cffffc700|H%s|h[%s]|h|r", itemlink, pItemData->GetName());
  1107. else
  1108. snprintf(buf, sizeof(buf), "|cfff1e6c0|H%s|h[%s]|h|r", itemlink, pItemData->GetName());
  1109. }
  1110. }
  1111. else
  1112. buf[0] = '\0';
  1113.  
  1114. return Py_BuildValue("s", buf);
  1115. }
  1116.  
  1117. PyObject * playerGetISellItemPrice(PyObject * poSelf, PyObject * poArgs)
  1118. {
  1119. TItemPos Cell;
  1120.  
  1121. switch (PyTuple_Size(poArgs))
  1122. {
  1123. case 1:
  1124. if (!PyTuple_GetInteger(poArgs, 0, &Cell.cell))
  1125. return Py_BuildException();
  1126. break;
  1127. case 2:
  1128. if (!PyTuple_GetByte(poArgs, 0, &Cell.window_type))
  1129. return Py_BuildException();
  1130. if (!PyTuple_GetInteger(poArgs, 1, &Cell.cell))
  1131. return Py_BuildException();
  1132. break;
  1133. default:
  1134. return Py_BuildException();
  1135. }
  1136. CItemData * pItemData;
  1137.  
  1138. if (!CItemManager::Instance().GetItemDataPointer(CPythonPlayer::Instance().GetItemIndex(Cell), &pItemData))
  1139. return Py_BuildValue("i", 0);
  1140.  
  1141. int iPrice;
  1142.  
  1143. if (pItemData->IsFlag(CItemData::ITEM_FLAG_COUNT_PER_1GOLD))
  1144. iPrice = CPythonPlayer::Instance().GetItemCount(Cell) / pItemData->GetISellItemPrice();
  1145. else
  1146. iPrice = pItemData->GetISellItemPrice() * CPythonPlayer::Instance().GetItemCount(Cell);
  1147.  
  1148. iPrice /= 1;
  1149. return Py_BuildValue("i", iPrice);
  1150. }
  1151.  
  1152. PyObject * playerGetQuickPage(PyObject* poSelf, PyObject* poArgs)
  1153. {
  1154. return Py_BuildValue("i", CPythonPlayer::Instance().GetQuickPage());
  1155. }
  1156.  
  1157. PyObject * playerSetQuickPage(PyObject* poSelf, PyObject* poArgs)
  1158. {
  1159. int iPageIndex;
  1160. if (!PyTuple_GetInteger(poArgs, 0, &iPageIndex))
  1161. return Py_BuildException();
  1162.  
  1163. CPythonPlayer::Instance().SetQuickPage(iPageIndex);
  1164. return Py_BuildNone();
  1165. }
  1166.  
  1167. PyObject * playerLocalQuickSlotIndexToGlobalQuickSlotIndex(PyObject* poSelf, PyObject* poArgs)
  1168. {
  1169. int iLocalSlotIndex;
  1170. if (!PyTuple_GetInteger(poArgs, 0, &iLocalSlotIndex))
  1171. return Py_BuildException();
  1172.  
  1173. CPythonPlayer& rkPlayer=CPythonPlayer::Instance();
  1174. return Py_BuildValue("i", rkPlayer.LocalQuickSlotIndexToGlobalQuickSlotIndex(iLocalSlotIndex));
  1175. }
  1176.  
  1177.  
  1178. PyObject * playerGetLocalQuickSlot(PyObject* poSelf, PyObject* poArgs)
  1179. {
  1180. int iSlotIndex;
  1181. if (!PyTuple_GetInteger(poArgs, 0, &iSlotIndex))
  1182. return Py_BuildException();
  1183.  
  1184. DWORD dwWndType;
  1185. DWORD dwWndItemPos;
  1186.  
  1187. CPythonPlayer& rkPlayer=CPythonPlayer::Instance();
  1188. rkPlayer.GetLocalQuickSlotData(iSlotIndex, &dwWndType, &dwWndItemPos);
  1189.  
  1190. return Py_BuildValue("ii", dwWndType, dwWndItemPos);
  1191. }
  1192.  
  1193. PyObject * playerGetGlobalQuickSlot(PyObject* poSelf, PyObject* poArgs)
  1194. {
  1195. int iSlotIndex;
  1196. if (!PyTuple_GetInteger(poArgs, 0, &iSlotIndex))
  1197. return Py_BuildException();
  1198.  
  1199. DWORD dwWndType;
  1200. DWORD dwWndItemPos;
  1201.  
  1202. CPythonPlayer& rkPlayer=CPythonPlayer::Instance();
  1203. rkPlayer.GetGlobalQuickSlotData(iSlotIndex, &dwWndType, &dwWndItemPos);
  1204.  
  1205. return Py_BuildValue("ii", dwWndType, dwWndItemPos);
  1206. }
  1207.  
  1208.  
  1209. PyObject * playerRequestAddLocalQuickSlot(PyObject * poSelf, PyObject * poArgs)
  1210. {
  1211. int nSlotIndex;
  1212. int nWndType;
  1213. int nWndItemPos;
  1214.  
  1215. if (!PyTuple_GetInteger(poArgs, 0, &nSlotIndex))
  1216. return Py_BuildException();
  1217.  
  1218. if (!PyTuple_GetInteger(poArgs, 1, &nWndType))
  1219. return Py_BuildException();
  1220.  
  1221. if (!PyTuple_GetInteger(poArgs, 2, &nWndItemPos))
  1222. return Py_BuildException();
  1223.  
  1224. CPythonPlayer& rkPlayer=CPythonPlayer::Instance();
  1225. rkPlayer.RequestAddLocalQuickSlot(nSlotIndex, nWndType, nWndItemPos);
  1226.  
  1227. return Py_BuildNone();
  1228. }
  1229.  
  1230. PyObject * playerRequestAddToEmptyLocalQuickSlot(PyObject* poSelf, PyObject* poArgs)
  1231. {
  1232. int nWndType;
  1233. if (!PyTuple_GetInteger(poArgs, 0, &nWndType))
  1234. return Py_BuildException();
  1235.  
  1236. int nWndItemPos;
  1237. if (!PyTuple_GetInteger(poArgs, 1, &nWndItemPos))
  1238. return Py_BuildException();
  1239.  
  1240. CPythonPlayer& rkPlayer=CPythonPlayer::Instance();
  1241. rkPlayer.RequestAddToEmptyLocalQuickSlot(nWndType, nWndItemPos);
  1242.  
  1243. return Py_BuildNone();
  1244. }
  1245.  
  1246. PyObject * playerRequestDeleteGlobalQuickSlot(PyObject * poSelf, PyObject * poArgs)
  1247. {
  1248. int nGlobalSlotIndex;
  1249. if (!PyTuple_GetInteger(poArgs, 0, &nGlobalSlotIndex))
  1250. return Py_BuildException();
  1251.  
  1252. CPythonPlayer& rkPlayer=CPythonPlayer::Instance();
  1253. rkPlayer.RequestDeleteGlobalQuickSlot(nGlobalSlotIndex);
  1254. return Py_BuildNone();
  1255. }
  1256.  
  1257. PyObject * playerRequestMoveGlobalQuickSlotToLocalQuickSlot(PyObject * poSelf, PyObject * poArgs)
  1258. {
  1259. int nGlobalSrcSlotIndex;
  1260. int nLocalDstSlotIndex;
  1261.  
  1262. if (!PyTuple_GetInteger(poArgs, 0, &nGlobalSrcSlotIndex))
  1263. return Py_BuildException();
  1264.  
  1265. if (!PyTuple_GetInteger(poArgs, 1, &nLocalDstSlotIndex))
  1266. return Py_BuildException();
  1267.  
  1268. CPythonPlayer& rkPlayer=CPythonPlayer::Instance();
  1269. rkPlayer.RequestMoveGlobalQuickSlotToLocalQuickSlot(nGlobalSrcSlotIndex, nLocalDstSlotIndex);
  1270. return Py_BuildNone();
  1271. }
  1272.  
  1273. PyObject * playerRequestUseLocalQuickSlot(PyObject* poSelf, PyObject* poArgs)
  1274. {
  1275. int iLocalPosition;
  1276. if (!PyTuple_GetInteger(poArgs, 0, &iLocalPosition))
  1277. return Py_BuildException();
  1278.  
  1279. CPythonPlayer::Instance().RequestUseLocalQuickSlot(iLocalPosition);
  1280.  
  1281. return Py_BuildNone();
  1282. }
  1283.  
  1284. PyObject * playerRemoveQuickSlotByValue(PyObject* poSelf, PyObject* poArgs)
  1285. {
  1286. int iType;
  1287. if (!PyTuple_GetInteger(poArgs, 0, &iType))
  1288. return Py_BuildException();
  1289.  
  1290. int iPosition;
  1291. if (!PyTuple_GetInteger(poArgs, 1, &iPosition))
  1292. return Py_BuildException();
  1293.  
  1294. CPythonPlayer::Instance().RemoveQuickSlotByValue(iType, iPosition);
  1295.  
  1296. return Py_BuildNone();
  1297. }
  1298.  
  1299. PyObject * playerisItem(PyObject* poSelf, PyObject* poArgs)
  1300. {
  1301. int iSlotIndex;
  1302. if (!PyTuple_GetInteger(poArgs, 0, &iSlotIndex))
  1303. return Py_BuildException();
  1304.  
  1305. char Flag = CPythonPlayer::Instance().IsItem(TItemPos(INVENTORY, iSlotIndex));
  1306.  
  1307. return Py_BuildValue("i", Flag);
  1308. }
  1309.  
  1310. #ifdef ENABLE_NEW_EQUIPMENT_SYSTEM
  1311. PyObject * playerIsBeltInventorySlot(PyObject* poSelf, PyObject* poArgs)
  1312. {
  1313. int iSlotIndex;
  1314. if (!PyTuple_GetInteger(poArgs, 0, &iSlotIndex))
  1315. return Py_BuildException();
  1316.  
  1317. char Flag = CPythonPlayer::Instance().IsBeltInventorySlot(TItemPos(INVENTORY, iSlotIndex));
  1318.  
  1319. return Py_BuildValue("i", Flag);
  1320. }
  1321. #endif
  1322.  
  1323. PyObject * playerIsEquipmentSlot(PyObject* poSelf, PyObject* poArgs)
  1324. {
  1325. int iSlotIndex;
  1326. if (!PyTuple_GetInteger(poArgs, 0, &iSlotIndex))
  1327. return Py_BuildException();
  1328.  
  1329. if (iSlotIndex >= c_Equipment_Start)
  1330. if (iSlotIndex <= c_DragonSoul_Equip_End)
  1331. return Py_BuildValue("i", 1);
  1332.  
  1333. return Py_BuildValue("i", 0);
  1334. }
  1335.  
  1336. PyObject * playerIsDSEquipmentSlot(PyObject* poSelf, PyObject* poArgs)
  1337. {
  1338. BYTE bWindowType;
  1339. if (!PyTuple_GetInteger(poArgs, 0, &bWindowType))
  1340. return Py_BuildException();
  1341. int iSlotIndex;
  1342. if (!PyTuple_GetInteger(poArgs, 1, &iSlotIndex))
  1343. return Py_BuildException();
  1344.  
  1345. if (INVENTORY == bWindowType)
  1346. if (iSlotIndex >= c_DragonSoul_Equip_Start)
  1347. if (iSlotIndex <= c_DragonSoul_Equip_End)
  1348. return Py_BuildValue("i", 1);
  1349.  
  1350. return Py_BuildValue("i", 0);
  1351.  
  1352. }
  1353.  
  1354. PyObject * playerIsCostumeSlot(PyObject* poSelf, PyObject* poArgs)
  1355. {
  1356. int iSlotIndex;
  1357. if (!PyTuple_GetInteger(poArgs, 0, &iSlotIndex))
  1358. return Py_BuildException();
  1359.  
  1360. #ifdef ENABLE_COSTUME_SYSTEM
  1361. if (iSlotIndex >= c_Costume_Slot_Start)
  1362. if (iSlotIndex <= c_Costume_Slot_End)
  1363. return Py_BuildValue("i", 1);
  1364. #endif
  1365.  
  1366. return Py_BuildValue("i", 0);
  1367. }
  1368.  
  1369. PyObject * playerIsOpenPrivateShop(PyObject* poSelf, PyObject* poArgs)
  1370. {
  1371. return Py_BuildValue("i", CPythonPlayer::Instance().IsOpenPrivateShop());
  1372. }
  1373.  
  1374. PyObject * playerIsValuableItem(PyObject* poSelf, PyObject* poArgs)
  1375. {
  1376. TItemPos SlotIndex;
  1377.  
  1378. switch (PyTuple_Size (poArgs))
  1379. {
  1380. case 1:
  1381. if (!PyTuple_GetInteger(poArgs, 0, &SlotIndex.cell))
  1382. return Py_BuildException();
  1383. break;
  1384. case 2:
  1385. if (!PyTuple_GetInteger(poArgs, 0, &SlotIndex.window_type))
  1386. return Py_BuildException();
  1387. if (!PyTuple_GetInteger(poArgs, 0, &SlotIndex.cell))
  1388. return Py_BuildException();
  1389. break;
  1390. default:
  1391. return Py_BuildException();
  1392. }
  1393.  
  1394. DWORD dwItemIndex = CPythonPlayer::Instance().GetItemIndex(SlotIndex);
  1395. CItemManager::Instance().SelectItemData(dwItemIndex);
  1396. CItemData * pItemData = CItemManager::Instance().GetSelectedItemDataPointer();
  1397. if (!pItemData)
  1398. return Py_BuildException("Can't find item data");
  1399.  
  1400. BOOL hasMetinSocket = FALSE;
  1401. BOOL isHighPrice = FALSE;
  1402.  
  1403. for (int i = 0; i < METIN_SOCKET_COUNT; ++i)
  1404. if (CPythonPlayer::METIN_SOCKET_TYPE_NONE != CPythonPlayer::Instance().GetItemMetinSocket(SlotIndex, i))
  1405. hasMetinSocket = TRUE;
  1406.  
  1407. DWORD dwValue = pItemData->GetISellItemPrice();
  1408. if (dwValue > 5000)
  1409. isHighPrice = TRUE;
  1410.  
  1411. return Py_BuildValue("i", hasMetinSocket || isHighPrice);
  1412. }
  1413.  
  1414. int GetItemGrade(const char * c_szItemName)
  1415. {
  1416. std::string strName = c_szItemName;
  1417. if (strName.empty())
  1418. return 0;
  1419.  
  1420. char chGrade = strName[strName.length() - 1];
  1421. if (chGrade < '0' || chGrade > '9')
  1422. chGrade = '0';
  1423.  
  1424. int iGrade = chGrade - '0';
  1425. return iGrade;
  1426. }
  1427.  
  1428. PyObject * playerGetItemGrade(PyObject* poSelf, PyObject* poArgs)
  1429. {
  1430. TItemPos SlotIndex;
  1431. switch (PyTuple_Size(poArgs))
  1432. {
  1433. case 1:
  1434. if (!PyTuple_GetInteger(poArgs, 0, &SlotIndex.cell))
  1435. return Py_BuildException();
  1436. break;
  1437. case 2:
  1438. if (!PyTuple_GetInteger(poArgs, 0, &SlotIndex.window_type))
  1439. return Py_BuildException();
  1440. if (!PyTuple_GetInteger(poArgs, 1, &SlotIndex.cell))
  1441. return Py_BuildException();
  1442. break;
  1443. default:
  1444. return Py_BuildException();
  1445. }
  1446.  
  1447. int iItemIndex = CPythonPlayer::Instance().GetItemIndex(SlotIndex);
  1448. CItemManager::Instance().SelectItemData(iItemIndex);
  1449. CItemData * pItemData = CItemManager::Instance().GetSelectedItemDataPointer();
  1450. if (!pItemData)
  1451. return Py_BuildException("Can't find item data");
  1452.  
  1453. return Py_BuildValue("i", GetItemGrade(pItemData->GetName()));
  1454. }
  1455.  
  1456. #if defined(GAIDEN)
  1457. PyObject * playerGetItemUnbindTime(PyObject* poSelf, PyObject* poArgs)
  1458. {
  1459. int iSlotIndex;
  1460. if (!PyTuple_GetInteger(poArgs, 0, &iSlotIndex))
  1461. return Py_BuildException();
  1462.  
  1463. return Py_BuildValue("i", (int) CPythonPlayer::instance().GetItemUnbindTime(iSlotIndex));
  1464. }
  1465. #endif
  1466.  
  1467. enum
  1468. {
  1469. REFINE_SCROLL_TYPE_MAKE_SOCKET = 1,
  1470. REFINE_SCROLL_TYPE_UP_GRADE = 2,
  1471. };
  1472.  
  1473. enum
  1474. {
  1475. REFINE_CANT,
  1476. REFINE_OK,
  1477. REFINE_ALREADY_MAX_SOCKET_COUNT,
  1478. REFINE_NEED_MORE_GOOD_SCROLL,
  1479. REFINE_CANT_MAKE_SOCKET_ITEM,
  1480. REFINE_NOT_NEXT_GRADE_ITEM,
  1481. REFINE_CANT_REFINE_METIN_TO_EQUIPMENT,
  1482. REFINE_CANT_REFINE_ROD,
  1483. };
  1484.  
  1485. PyObject * playerCanRefine(PyObject * poSelf, PyObject * poArgs)
  1486. {
  1487. int iScrollItemIndex;
  1488. TItemPos TargetSlotIndex;
  1489.  
  1490. switch (PyTuple_Size(poArgs))
  1491. {
  1492. case 2:
  1493. if (!PyTuple_GetInteger(poArgs, 0, &iScrollItemIndex))
  1494. return Py_BadArgument();
  1495. if (!PyTuple_GetInteger(poArgs, 1, &TargetSlotIndex.cell))
  1496. return Py_BadArgument();
  1497. break;
  1498. case 3:
  1499. if (!PyTuple_GetInteger(poArgs, 0, &iScrollItemIndex))
  1500. return Py_BadArgument();
  1501. if (!PyTuple_GetInteger(poArgs, 1, &TargetSlotIndex.window_type))
  1502. return Py_BadArgument();
  1503. if (!PyTuple_GetInteger(poArgs, 2, &TargetSlotIndex.cell))
  1504. return Py_BadArgument();
  1505. break;
  1506. default:
  1507. return Py_BadArgument();
  1508. }
  1509.  
  1510. if (CPythonPlayer::Instance().IsEquipmentSlot(TargetSlotIndex))
  1511. {
  1512. return Py_BuildValue("i", REFINE_CANT_REFINE_METIN_TO_EQUIPMENT);
  1513. }
  1514.  
  1515. // Scroll
  1516. CItemManager::Instance().SelectItemData(iScrollItemIndex);
  1517. CItemData * pScrollItemData = CItemManager::Instance().GetSelectedItemDataPointer();
  1518. if (!pScrollItemData)
  1519. return Py_BuildValue("i", REFINE_CANT);
  1520. int iScrollType = pScrollItemData->GetType();
  1521. int iScrollSubType = pScrollItemData->GetSubType();
  1522. if (iScrollType != CItemData::ITEM_TYPE_USE)
  1523. return Py_BuildValue("i", REFINE_CANT);
  1524. if (iScrollSubType != CItemData::USE_TUNING)
  1525. return Py_BuildValue("i", REFINE_CANT);
  1526.  
  1527. // Target Item
  1528. int iTargetItemIndex = CPythonPlayer::Instance().GetItemIndex(TargetSlotIndex);
  1529. CItemManager::Instance().SelectItemData(iTargetItemIndex);
  1530. CItemData * pTargetItemData = CItemManager::Instance().GetSelectedItemDataPointer();
  1531. if (!pTargetItemData)
  1532. return Py_BuildValue("i", REFINE_CANT);
  1533. int iTargetType = pTargetItemData->GetType();
  1534. //int iTargetSubType = pTargetItemData->GetSubType();
  1535. if (CItemData::ITEM_TYPE_ROD == iTargetType)
  1536. return Py_BuildValue("i", REFINE_CANT_REFINE_ROD);
  1537.  
  1538. if (pTargetItemData->HasNextGrade())
  1539. {
  1540. return Py_BuildValue("i", REFINE_OK);
  1541. }
  1542. else
  1543. {
  1544. return Py_BuildValue("i", REFINE_NOT_NEXT_GRADE_ITEM);
  1545. }
  1546.  
  1547. return Py_BuildValue("i", REFINE_CANT);
  1548. }
  1549.  
  1550. enum
  1551. {
  1552. ATTACH_METIN_CANT,
  1553. ATTACH_METIN_OK,
  1554. ATTACH_METIN_NOT_MATCHABLE_ITEM,
  1555. ATTACH_METIN_NO_MATCHABLE_SOCKET,
  1556. ATTACH_METIN_NOT_EXIST_GOLD_SOCKET,
  1557. ATTACH_METIN_CANT_ATTACH_TO_EQUIPMENT,
  1558. };
  1559.  
  1560. PyObject * playerCanAttachMetin(PyObject* poSelf, PyObject* poArgs)
  1561. {
  1562. int iMetinItemID;
  1563. TItemPos TargetSlotIndex;
  1564.  
  1565. switch (PyTuple_Size(poArgs))
  1566. {
  1567. case 2:
  1568. if (!PyTuple_GetInteger(poArgs, 0, &iMetinItemID))
  1569. return Py_BuildException();
  1570. if (!PyTuple_GetInteger(poArgs, 1, &TargetSlotIndex.cell))
  1571. return Py_BuildException();
  1572. break;
  1573. case 3:
  1574. if (!PyTuple_GetInteger(poArgs, 0, &iMetinItemID))
  1575. return Py_BuildException();
  1576. if (!PyTuple_GetInteger(poArgs, 1, &TargetSlotIndex.window_type))
  1577. return Py_BuildException();
  1578. if (!PyTuple_GetInteger(poArgs, 2, &TargetSlotIndex.cell))
  1579. return Py_BuildException();
  1580. break;
  1581. default:
  1582. return Py_BuildException();
  1583. }
  1584. if (CPythonPlayer::Instance().IsEquipmentSlot(TargetSlotIndex))
  1585. {
  1586. return Py_BuildValue("i", ATTACH_METIN_CANT_ATTACH_TO_EQUIPMENT);
  1587. }
  1588.  
  1589. CItemData * pMetinItemData;
  1590. if (!CItemManager::Instance().GetItemDataPointer(iMetinItemID, &pMetinItemData))
  1591. return Py_BuildException("can't find item data");
  1592.  
  1593. DWORD dwTargetItemIndex = CPythonPlayer::Instance().GetItemIndex(TargetSlotIndex);
  1594. CItemData * pTargetItemData;
  1595. if (!CItemManager::Instance().GetItemDataPointer(dwTargetItemIndex, &pTargetItemData))
  1596. return Py_BuildException("can't find item data");
  1597.  
  1598. DWORD dwMetinWearFlags = pMetinItemData->GetWearFlags();
  1599. DWORD dwTargetWearFlags = pTargetItemData->GetWearFlags();
  1600. if (0 == (dwMetinWearFlags & dwTargetWearFlags))
  1601. return Py_BuildValue("i", ATTACH_METIN_NOT_MATCHABLE_ITEM);
  1602. if (CItemData::ITEM_TYPE_ROD == pTargetItemData->GetType())
  1603. return Py_BuildValue("i", ATTACH_METIN_CANT);
  1604.  
  1605. BOOL bNotExistGoldSocket = FALSE;
  1606.  
  1607. int iSubType = pMetinItemData->GetSubType();
  1608. for (int i = 0; i < ITEM_SOCKET_SLOT_MAX_NUM; ++i)
  1609. {
  1610. DWORD dwSocketType = CPythonPlayer::Instance().GetItemMetinSocket(TargetSlotIndex, i);
  1611. if (CItemData::METIN_NORMAL == iSubType)
  1612. {
  1613. if (CPythonPlayer::METIN_SOCKET_TYPE_SILVER == dwSocketType ||
  1614. CPythonPlayer::METIN_SOCKET_TYPE_GOLD == dwSocketType)
  1615. {
  1616. return Py_BuildValue("i", ATTACH_METIN_OK);
  1617. }
  1618. }
  1619. else if (CItemData::METIN_GOLD == iSubType)
  1620. {
  1621. if (CPythonPlayer::METIN_SOCKET_TYPE_GOLD == dwSocketType)
  1622. {
  1623. return Py_BuildValue("i", ATTACH_METIN_OK);
  1624. }
  1625. else if (CPythonPlayer::METIN_SOCKET_TYPE_SILVER == dwSocketType)
  1626. {
  1627. bNotExistGoldSocket = TRUE;
  1628. }
  1629. }
  1630. }
  1631.  
  1632. if (bNotExistGoldSocket)
  1633. {
  1634. return Py_BuildValue("i", ATTACH_METIN_NOT_EXIST_GOLD_SOCKET);
  1635. }
  1636.  
  1637. return Py_BuildValue("i", ATTACH_METIN_NO_MATCHABLE_SOCKET);
  1638. }
  1639.  
  1640. enum
  1641. {
  1642. DETACH_METIN_CANT,
  1643. DETACH_METIN_OK,
  1644. };
  1645.  
  1646. PyObject * playerCanDetach(PyObject * poSelf, PyObject * poArgs)
  1647. {
  1648. int iScrollItemIndex;
  1649. TItemPos TargetSlotIndex;
  1650. switch (PyTuple_Size(poArgs))
  1651. {
  1652. case 2:
  1653. if (!PyTuple_GetInteger(poArgs, 0, &iScrollItemIndex))
  1654. return Py_BadArgument();
  1655. if (!PyTuple_GetInteger(poArgs, 1, &TargetSlotIndex.cell))
  1656. return Py_BadArgument();
  1657. break;
  1658. case 3:
  1659. if (!PyTuple_GetInteger(poArgs, 0, &iScrollItemIndex))
  1660. return Py_BadArgument();
  1661. if (!PyTuple_GetInteger(poArgs, 1, &TargetSlotIndex.window_type))
  1662. return Py_BadArgument();
  1663. if (!PyTuple_GetInteger(poArgs, 2, &TargetSlotIndex.cell))
  1664. return Py_BadArgument();
  1665. break;
  1666. default:
  1667. return Py_BadArgument();
  1668. }
  1669.  
  1670. CItemManager::Instance().SelectItemData(iScrollItemIndex);
  1671. CItemData * pScrollItemData = CItemManager::Instance().GetSelectedItemDataPointer();
  1672. if (!pScrollItemData)
  1673. return Py_BuildException("Can't find item data");
  1674. int iScrollType = pScrollItemData->GetType();
  1675. int iScrollSubType = pScrollItemData->GetSubType();
  1676. if (iScrollType != CItemData::ITEM_TYPE_USE)
  1677. return Py_BuildValue("i", DETACH_METIN_CANT);
  1678. if (iScrollSubType != CItemData::USE_DETACHMENT)
  1679. return Py_BuildValue("i", DETACH_METIN_CANT);
  1680.  
  1681. int iTargetItemIndex = CPythonPlayer::Instance().GetItemIndex(TargetSlotIndex);
  1682. CItemManager::Instance().SelectItemData(iTargetItemIndex);
  1683. CItemData * pTargetItemData = CItemManager::Instance().GetSelectedItemDataPointer();
  1684. if (!pTargetItemData)
  1685. return Py_BuildException("Can't find item data");
  1686.  
  1687. #ifdef ENABLE_SASH_SYSTEM
  1688. if (pScrollItemData->GetValue(0) == SASH_CLEAN_ATTR_VALUE0)
  1689. {
  1690. if ((pTargetItemData->GetType() != CItemData::ITEM_TYPE_COSTUME) || (pTargetItemData->GetSubType() != CItemData::COSTUME_SASH))
  1691. return Py_BuildValue("i", DETACH_METIN_CANT);
  1692.  
  1693. const TItemData * pPlayerItem = CPythonPlayer::Instance().GetItemData(TargetSlotIndex);
  1694. if (pPlayerItem)
  1695. {
  1696. if (pPlayerItem->alSockets[SASH_ABSORBED_SOCKET] > 0)
  1697. return Py_BuildValue("i", DETACH_METIN_OK);
  1698. else
  1699. return Py_BuildValue("i", DETACH_METIN_CANT);
  1700. }
  1701. else
  1702. return Py_BuildValue("i", DETACH_METIN_CANT);
  1703. }
  1704. #endif
  1705.  
  1706. #ifdef ENABLE_CHANGELOOK_SYSTEM
  1707. if (pScrollItemData->GetValue(0) == CL_CLEAN_ATTR_VALUE0)
  1708. {
  1709. const TItemData * pPlayerItem = CPythonPlayer::Instance().GetItemData(TargetSlotIndex);
  1710. if (pPlayerItem)
  1711. {
  1712. if (pPlayerItem->transmutation == 0)
  1713. return Py_BuildValue("i", DETACH_METIN_CANT);
  1714. else
  1715. return Py_BuildValue("i", DETACH_METIN_OK);
  1716. }
  1717. else
  1718. return Py_BuildValue("i", DETACH_METIN_OK);
  1719. }
  1720. #endif
  1721.  
  1722. if (pTargetItemData->IsFlag(CItemData::ITEM_FLAG_REFINEABLE))
  1723. {
  1724. for (int iSlotCount = 0; iSlotCount < METIN_SOCKET_COUNT; ++iSlotCount)
  1725. if (CPythonPlayer::Instance().GetItemMetinSocket(TargetSlotIndex, iSlotCount) > 2)
  1726. {
  1727. return Py_BuildValue("i", DETACH_METIN_OK);
  1728. }
  1729. }
  1730.  
  1731. return Py_BuildValue("i", DETACH_METIN_CANT);
  1732. }
  1733.  
  1734. PyObject * playerCanUnlock(PyObject * poSelf, PyObject * poArgs)
  1735. {
  1736. int iKeyItemIndex;
  1737. TItemPos TargetSlotIndex;
  1738. switch (PyTuple_Size(poArgs))
  1739. {
  1740. case 2:
  1741. if (!PyTuple_GetInteger(poArgs, 0, &iKeyItemIndex))
  1742. return Py_BadArgument();
  1743. if (!PyTuple_GetInteger(poArgs, 1, &TargetSlotIndex.cell))
  1744. return Py_BadArgument();
  1745. break;
  1746. case 3:
  1747. if (!PyTuple_GetInteger(poArgs, 0, &iKeyItemIndex))
  1748. return Py_BadArgument();
  1749. if (!PyTuple_GetInteger(poArgs, 1, &TargetSlotIndex.window_type))
  1750. return Py_BadArgument();
  1751. if (!PyTuple_GetInteger(poArgs, 2, &TargetSlotIndex.cell))
  1752. return Py_BadArgument();
  1753. break;
  1754. default:
  1755. return Py_BadArgument();
  1756. }
  1757.  
  1758. // Key
  1759. CItemManager::Instance().SelectItemData(iKeyItemIndex);
  1760. CItemData * pKeyItemData = CItemManager::Instance().GetSelectedItemDataPointer();
  1761. if (!pKeyItemData)
  1762. return Py_BuildException("Can't find item data");
  1763. int iKeyType = pKeyItemData->GetType();
  1764. if (iKeyType != CItemData::ITEM_TYPE_TREASURE_KEY)
  1765. return Py_BuildValue("i", FALSE);
  1766.  
  1767. // Target Item
  1768. int iTargetItemIndex = CPythonPlayer::Instance().GetItemIndex(TargetSlotIndex);
  1769. CItemManager::Instance().SelectItemData(iTargetItemIndex);
  1770. CItemData * pTargetItemData = CItemManager::Instance().GetSelectedItemDataPointer();
  1771. if (!pTargetItemData)
  1772. return Py_BuildException("Can't find item data");
  1773. int iTargetType = pTargetItemData->GetType();
  1774. if (iTargetType != CItemData::ITEM_TYPE_TREASURE_BOX)
  1775. return Py_BuildValue("i", FALSE);
  1776.  
  1777. return Py_BuildValue("i", TRUE);
  1778. }
  1779.  
  1780. PyObject * playerIsRefineGradeScroll(PyObject* poSelf, PyObject* poArgs)
  1781. {
  1782. TItemPos ScrollSlotIndex;
  1783. switch (PyTuple_Size(poArgs))
  1784. {
  1785. case 1:
  1786. if (!PyTuple_GetInteger(poArgs, 0, &ScrollSlotIndex.cell))
  1787. return Py_BuildException();
  1788. case 2:
  1789. if (!PyTuple_GetInteger(poArgs, 0, &ScrollSlotIndex.window_type))
  1790. return Py_BuildException();
  1791. if (!PyTuple_GetInteger(poArgs, 1, &ScrollSlotIndex.cell))
  1792. return Py_BuildException();
  1793. default:
  1794. return Py_BuildException();
  1795. }
  1796.  
  1797. int iScrollItemIndex = CPythonPlayer::Instance().GetItemIndex(ScrollSlotIndex);
  1798. CItemManager::Instance().SelectItemData(iScrollItemIndex);
  1799. CItemData * pScrollItemData = CItemManager::Instance().GetSelectedItemDataPointer();
  1800. if (!pScrollItemData)
  1801. return Py_BuildException("Can't find item data");
  1802.  
  1803. return Py_BuildValue("i", REFINE_SCROLL_TYPE_UP_GRADE == pScrollItemData->GetValue(0));
  1804. }
  1805.  
  1806. PyObject * playerUpdate(PyObject* poSelf, PyObject* poArgs)
  1807. {
  1808. CPythonPlayer::Instance().Update();
  1809. return Py_BuildNone();
  1810. }
  1811.  
  1812. PyObject * playerRender(PyObject* poSelf, PyObject* poArgs)
  1813. {
  1814. return Py_BuildNone();
  1815. }
  1816.  
  1817. PyObject * playerClear(PyObject* poSelf, PyObject* poArgs)
  1818. {
  1819. CPythonPlayer::Instance().Clear();
  1820. return Py_BuildNone();
  1821. }
  1822.  
  1823. PyObject * playerClearTarget(PyObject* poSelf, PyObject* poArgs)
  1824. {
  1825. CPythonPlayer::Instance().SetTarget(0);
  1826. return Py_BuildNone();
  1827. }
  1828.  
  1829. PyObject * playerSetTarget(PyObject* poSelf, PyObject* poArgs)
  1830. {
  1831. int iVID;
  1832. if (!PyTuple_GetInteger(poArgs, 0, &iVID))
  1833. return Py_BuildException();
  1834.  
  1835. CPythonPlayer::Instance().SetTarget(iVID);
  1836. return Py_BuildNone();
  1837. }
  1838.  
  1839. PyObject * playerOpenCharacterMenu(PyObject* poSelf, PyObject* poArgs)
  1840. {
  1841. int iVID;
  1842. if (!PyTuple_GetInteger(poArgs, 0, &iVID))
  1843. return Py_BuildException();
  1844.  
  1845. CPythonPlayer::Instance().OpenCharacterMenu(iVID);
  1846. return Py_BuildNone();
  1847. }
  1848.  
  1849. PyObject * playerIsPartyMember(PyObject* poSelf, PyObject* poArgs)
  1850. {
  1851. int iVID;
  1852. if (!PyTuple_GetInteger(poArgs, 0, &iVID))
  1853. return Py_BuildException();
  1854.  
  1855. return Py_BuildValue("i", CPythonPlayer::Instance().IsPartyMemberByVID(iVID));
  1856. }
  1857.  
  1858. PyObject * playerIsPartyLeader(PyObject* poSelf, PyObject* poArgs)
  1859. {
  1860. int iVID;
  1861. if (!PyTuple_GetInteger(poArgs, 0, &iVID))
  1862. return Py_BuildException();
  1863.  
  1864. DWORD dwPID;
  1865. if (!CPythonPlayer::Instance().PartyMemberVIDToPID(iVID, &dwPID))
  1866. return Py_BuildValue("i", FALSE);
  1867.  
  1868. CPythonPlayer::TPartyMemberInfo * pPartyMemberInfo;
  1869. if (!CPythonPlayer::Instance().GetPartyMemberPtr(dwPID, &pPartyMemberInfo))
  1870. return Py_BuildValue("i", FALSE);
  1871.  
  1872. return Py_BuildValue("i", CPythonPlayer::PARTY_ROLE_LEADER == pPartyMemberInfo->byState);
  1873. }
  1874.  
  1875. PyObject * playerIsPartyLeaderByPID(PyObject* poSelf, PyObject* poArgs)
  1876. {
  1877. int iPID;
  1878. if (!PyTuple_GetInteger(poArgs, 0, &iPID))
  1879. return Py_BuildException();
  1880.  
  1881. CPythonPlayer::TPartyMemberInfo * pPartyMemberInfo;
  1882. if (!CPythonPlayer::Instance().GetPartyMemberPtr(iPID, &pPartyMemberInfo))
  1883. return Py_BuildValue("i", FALSE);
  1884.  
  1885. return Py_BuildValue("i", CPythonPlayer::PARTY_ROLE_LEADER == pPartyMemberInfo->byState);
  1886. }
  1887.  
  1888. PyObject * playerGetPartyMemberHPPercentage(PyObject* poSelf, PyObject* poArgs)
  1889. {
  1890. int iPID;
  1891. if (!PyTuple_GetInteger(poArgs, 0, &iPID))
  1892. return Py_BuildException();
  1893.  
  1894. CPythonPlayer::TPartyMemberInfo * pPartyMemberInfo;
  1895. if (!CPythonPlayer::Instance().GetPartyMemberPtr(iPID, &pPartyMemberInfo))
  1896. return Py_BuildValue("i", FALSE);
  1897.  
  1898. return Py_BuildValue("i", pPartyMemberInfo->byHPPercentage);
  1899. }
  1900.  
  1901. PyObject * playerGetPartyMemberState(PyObject* poSelf, PyObject* poArgs)
  1902. {
  1903. int iPID;
  1904. if (!PyTuple_GetInteger(poArgs, 0, &iPID))
  1905. return Py_BuildException();
  1906.  
  1907. CPythonPlayer::TPartyMemberInfo * pPartyMemberInfo;
  1908. if (!CPythonPlayer::Instance().GetPartyMemberPtr(iPID, &pPartyMemberInfo))
  1909. return Py_BuildValue("i", FALSE);
  1910.  
  1911. return Py_BuildValue("i", pPartyMemberInfo->byState);
  1912. }
  1913.  
  1914. PyObject * playerGetPartyMemberAffects(PyObject* poSelf, PyObject* poArgs)
  1915. {
  1916. int iPID;
  1917. if (!PyTuple_GetInteger(poArgs, 0, &iPID))
  1918. return Py_BuildException();
  1919.  
  1920. CPythonPlayer::TPartyMemberInfo * pPartyMemberInfo;
  1921. if (!CPythonPlayer::Instance().GetPartyMemberPtr(iPID, &pPartyMemberInfo))
  1922. return Py_BuildValue("i", FALSE);
  1923.  
  1924. return Py_BuildValue("iiiiiii", pPartyMemberInfo->sAffects[0],
  1925. pPartyMemberInfo->sAffects[1],
  1926. pPartyMemberInfo->sAffects[2],
  1927. pPartyMemberInfo->sAffects[3],
  1928. pPartyMemberInfo->sAffects[4],
  1929. pPartyMemberInfo->sAffects[5],
  1930. pPartyMemberInfo->sAffects[6]);
  1931. }
  1932.  
  1933. PyObject * playerRemovePartyMember(PyObject* poSelf, PyObject* poArgs)
  1934. {
  1935. int iPID;
  1936. if (!PyTuple_GetInteger(poArgs, 0, &iPID))
  1937. return Py_BuildException();
  1938.  
  1939. CPythonPlayer::Instance().RemovePartyMember(iPID);
  1940. return Py_BuildNone();
  1941. }
  1942.  
  1943. PyObject * playerExitParty(PyObject* poSelf, PyObject* poArgs)
  1944. {
  1945. CPythonPlayer::Instance().ExitParty();
  1946. return Py_BuildNone();
  1947. }
  1948.  
  1949. PyObject * playerGetPKMode(PyObject* poSelf, PyObject* poArgs)
  1950. {
  1951. return Py_BuildValue("i", CPythonPlayer::Instance().GetPKMode());
  1952. }
  1953.  
  1954. PyObject * playerHasMobilePhoneNumber(PyObject* poSelf, PyObject* poArgs)
  1955. {
  1956. return Py_BuildValue("i", CPythonPlayer::Instance().HasMobilePhoneNumber());
  1957. }
  1958.  
  1959. PyObject * playerSetWeaponAttackBonusFlag(PyObject* poSelf, PyObject* poArgs)
  1960. {
  1961. int iFlag;
  1962. if (!PyTuple_GetInteger(poArgs, 0, &iFlag))
  1963. return Py_BuildException();
  1964.  
  1965. return Py_BuildNone();
  1966. }
  1967.  
  1968. PyObject * playerToggleCoolTime(PyObject* poSelf, PyObject* poArgs)
  1969. {
  1970. return Py_BuildValue("i", CPythonPlayer::Instance().__ToggleCoolTime());
  1971. }
  1972.  
  1973. PyObject * playerToggleLevelLimit(PyObject* poSelf, PyObject* poArgs)
  1974. {
  1975. return Py_BuildValue("i", CPythonPlayer::Instance().__ToggleLevelLimit());
  1976. }
  1977.  
  1978. PyObject * playerGetTargetVID(PyObject* poSelf, PyObject* poArgs)
  1979. {
  1980. return Py_BuildValue("i", CPythonPlayer::Instance().GetTargetVID());
  1981. }
  1982.  
  1983. PyObject * playerRegisterEmotionIcon(PyObject* poSelf, PyObject* poArgs)
  1984. {
  1985. int iIndex;
  1986. if (!PyTuple_GetInteger(poArgs, 0, &iIndex))
  1987. return Py_BuildException();
  1988. char * szFileName;
  1989. if (!PyTuple_GetString(poArgs, 1, &szFileName))
  1990. return Py_BuildException();
  1991.  
  1992. CGraphicImage * pImage = (CGraphicImage *)CResourceManager::Instance().GetResourcePointer(szFileName);
  1993. m_kMap_iEmotionIndex_pkIconImage.insert(make_pair(iIndex, pImage));
  1994.  
  1995. return Py_BuildNone();
  1996. }
  1997.  
  1998. PyObject * playerGetEmotionIconImage(PyObject* poSelf, PyObject* poArgs)
  1999. {
  2000. int iIndex;
  2001. if (!PyTuple_GetInteger(poArgs, 0, &iIndex))
  2002. return Py_BuildException();
  2003.  
  2004. if (m_kMap_iEmotionIndex_pkIconImage.end() == m_kMap_iEmotionIndex_pkIconImage.find(iIndex))
  2005. return Py_BuildValue("i", 0);
  2006.  
  2007. return Py_BuildValue("i", m_kMap_iEmotionIndex_pkIconImage[iIndex]);
  2008. }
  2009.  
  2010. PyObject * playerSetItemData(PyObject* poSelf, PyObject* poArgs)
  2011. {
  2012. int iSlotIndex;
  2013. if (!PyTuple_GetInteger(poArgs, 0, &iSlotIndex))
  2014. return Py_BuildException();
  2015.  
  2016. int iVirtualID;
  2017. if (!PyTuple_GetInteger(poArgs, 1, &iVirtualID))
  2018. return Py_BuildException();
  2019.  
  2020. int iNum;
  2021. if (!PyTuple_GetInteger(poArgs, 2, &iNum))
  2022. return Py_BuildException();
  2023.  
  2024. TItemData kItemInst;
  2025. ZeroMemory(&kItemInst, sizeof(kItemInst));
  2026. kItemInst.vnum=iVirtualID;
  2027. kItemInst.count=iNum;
  2028. CPythonPlayer::Instance().SetItemData(TItemPos(INVENTORY, iSlotIndex), kItemInst);
  2029. return Py_BuildNone();
  2030. }
  2031.  
  2032. PyObject * playerSetItemMetinSocket(PyObject* poSelf, PyObject* poArgs)
  2033. {
  2034. TItemPos ItemPos;
  2035. int iMetinSocketNumber;
  2036. int iNum;
  2037.  
  2038. switch (PyTuple_Size(poArgs))
  2039. {
  2040. case 3:
  2041. if (!PyTuple_GetInteger(poArgs, 0, &ItemPos.cell))
  2042. return Py_BuildException();
  2043.  
  2044. if (!PyTuple_GetInteger(poArgs, 1, &iMetinSocketNumber))
  2045. return Py_BuildException();
  2046.  
  2047. if (!PyTuple_GetInteger(poArgs, 2, &iNum))
  2048. return Py_BuildException();
  2049.  
  2050. break;
  2051. case 4:
  2052. if (!PyTuple_GetInteger(poArgs, 0, &ItemPos.window_type))
  2053. return Py_BuildException();
  2054. if (!PyTuple_GetInteger(poArgs, 1, &ItemPos.cell))
  2055. return Py_BuildException();
  2056. if (!PyTuple_GetInteger(poArgs, 2, &iMetinSocketNumber))
  2057. return Py_BuildException();
  2058. if (!PyTuple_GetInteger(poArgs, 3, &iNum))
  2059. return Py_BuildException();
  2060.  
  2061. break;
  2062. default:
  2063. return Py_BuildException();
  2064. }
  2065.  
  2066. CPythonPlayer::Instance().SetItemMetinSocket(ItemPos, iMetinSocketNumber, iNum);
  2067. return Py_BuildNone();
  2068. }
  2069.  
  2070. PyObject * playerSetItemAttribute(PyObject* poSelf, PyObject* poArgs)
  2071. {
  2072. TItemPos ItemPos;
  2073. int iAttributeSlotIndex;
  2074. int iAttributeType;
  2075. int iAttributeValue;
  2076.  
  2077. switch (PyTuple_Size(poArgs))
  2078. {
  2079. case 4:
  2080. if (!PyTuple_GetInteger(poArgs, 0, &ItemPos.cell))
  2081. return Py_BuildException();
  2082.  
  2083. if (!PyTuple_GetInteger(poArgs, 1, &iAttributeSlotIndex))
  2084. return Py_BuildException();
  2085.  
  2086. if (!PyTuple_GetInteger(poArgs, 2, &iAttributeType))
  2087. return Py_BuildException();
  2088.  
  2089. if (!PyTuple_GetInteger(poArgs, 3, &iAttributeValue))
  2090. return Py_BuildException();
  2091. break;
  2092. case 5:
  2093. if (!PyTuple_GetInteger(poArgs, 0, &ItemPos.window_type))
  2094. return Py_BuildException();
  2095.  
  2096. if (!PyTuple_GetInteger(poArgs, 1, &ItemPos.cell))
  2097. return Py_BuildException();
  2098.  
  2099. if (!PyTuple_GetInteger(poArgs, 2, &iAttributeSlotIndex))
  2100. return Py_BuildException();
  2101.  
  2102. if (!PyTuple_GetInteger(poArgs, 3, &iAttributeType))
  2103. return Py_BuildException();
  2104.  
  2105. if (!PyTuple_GetInteger(poArgs, 4, &iAttributeValue))
  2106. return Py_BuildException();
  2107. break;
  2108. }
  2109. CPythonPlayer::Instance().SetItemAttribute(ItemPos, iAttributeSlotIndex, iAttributeType, iAttributeValue);
  2110. return Py_BuildNone();
  2111. }
  2112.  
  2113. PyObject * playerSetAutoPotionInfo(PyObject* poSelf, PyObject* poArgs)
  2114. {
  2115. int potionType = 0;
  2116. if (!PyTuple_GetInteger(poArgs, 0, &potionType))
  2117. return Py_BadArgument();
  2118.  
  2119. CPythonPlayer* player = CPythonPlayer::InstancePtr();
  2120.  
  2121. CPythonPlayer::SAutoPotionInfo& potionInfo = player->GetAutoPotionInfo(potionType);
  2122.  
  2123. if (!PyTuple_GetBoolean(poArgs, 1, &potionInfo.bActivated))
  2124. return Py_BadArgument();
  2125.  
  2126. if (!PyTuple_GetLong(poArgs, 2, &potionInfo.currentAmount))
  2127. return Py_BadArgument();
  2128.  
  2129. if (!PyTuple_GetLong(poArgs, 3, &potionInfo.totalAmount))
  2130. return Py_BadArgument();
  2131.  
  2132. if (!PyTuple_GetLong(poArgs, 4, &potionInfo.inventorySlotIndex))
  2133. return Py_BadArgument();
  2134.  
  2135. return Py_BuildNone();
  2136. }
  2137.  
  2138. PyObject * playerGetAutoPotionInfo(PyObject* poSelf, PyObject* poArgs)
  2139. {
  2140. CPythonPlayer* player = CPythonPlayer::InstancePtr();
  2141.  
  2142. int potionType = 0;
  2143. if (!PyTuple_GetInteger(poArgs, 0, &potionType))
  2144. return Py_BadArgument();
  2145.  
  2146. CPythonPlayer::SAutoPotionInfo& potionInfo = player->GetAutoPotionInfo(potionType);
  2147.  
  2148. return Py_BuildValue("biii", potionInfo.bActivated, int(potionInfo.currentAmount), int(potionInfo.totalAmount), int(potionInfo.inventorySlotIndex));
  2149. }
  2150.  
  2151. PyObject * playerSlotTypeToInvenType(PyObject* poSelf, PyObject* poArgs)
  2152. {
  2153. int slotType = 0;
  2154. if (!PyTuple_GetInteger(poArgs, 0, &slotType))
  2155. return Py_BadArgument();
  2156.  
  2157. return Py_BuildValue("i", SlotTypeToInvenType((BYTE)slotType));
  2158. }
  2159.  
  2160. #ifdef ENABLE_NEW_EQUIPMENT_SYSTEM
  2161. // 플레이어가 벨트를 착용 중인지?
  2162. PyObject * playerIsEquippingBelt(PyObject* poSelf, PyObject* poArgs)
  2163. {
  2164. const CPythonPlayer* player = CPythonPlayer::InstancePtr();
  2165. bool bEquipping = false;
  2166.  
  2167. const TItemData* data = player->GetItemData(TItemPos(EQUIPMENT, c_Equipment_Belt));
  2168.  
  2169. if (NULL != data)
  2170. bEquipping = 0 < data->count;
  2171.  
  2172. return Py_BuildValue("b", bEquipping);
  2173.  
  2174. }
  2175.  
  2176. // 검사하려는 벨트 인벤토리 Cell이 사용 가능한 칸인지? (사용가능 여부는 착용 중인 벨트의 강화 정도에 따라 달라짐)
  2177. PyObject * playerIsAvailableBeltInventoryCell(PyObject* poSelf, PyObject* poArgs)
  2178. {
  2179. const CPythonPlayer* player = CPythonPlayer::InstancePtr();
  2180. const TItemData* pData = player->GetItemData(TItemPos(EQUIPMENT, c_Equipment_Belt));
  2181.  
  2182. if (NULL == pData || 0 == pData->count)
  2183. return Py_BuildValue("b", false);
  2184.  
  2185. CItemManager::Instance().SelectItemData(pData->vnum);
  2186. CItemData * pItem = CItemManager::Instance().GetSelectedItemDataPointer();
  2187.  
  2188. long beltGrade = pItem->GetValue(0);
  2189.  
  2190. int pos = 0;
  2191. if (!PyTuple_GetInteger(poArgs, 0, &pos))
  2192. return Py_BadArgument();
  2193.  
  2194. //return Py_BuildValue("b", CBeltInventoryHelper::IsAvailableCell(pos - c_Belt_Inventory_Slot_Start, GetItemGrade(pItem->GetName())));
  2195. return Py_BuildValue("b", CBeltInventoryHelper::IsAvailableCell(pos - c_Belt_Inventory_Slot_Start, beltGrade));
  2196. }
  2197. #endif
  2198.  
  2199.  
  2200. // 용혼석 강화
  2201. PyObject* playerSendDragonSoulRefine(PyObject* poSelf, PyObject* poArgs)
  2202. {
  2203. BYTE bSubHeader;
  2204. PyObject* pDic;
  2205. TItemPos RefineItemPoses[DS_REFINE_WINDOW_MAX_NUM];
  2206. if (!PyTuple_GetByte(poArgs, 0, &bSubHeader))
  2207. return Py_BuildException();
  2208. switch (bSubHeader)
  2209. {
  2210. case DS_SUB_HEADER_CLOSE:
  2211. break;
  2212. case DS_SUB_HEADER_DO_UPGRADE:
  2213. case DS_SUB_HEADER_DO_IMPROVEMENT:
  2214. case DS_SUB_HEADER_DO_REFINE:
  2215. {
  2216. if (!PyTuple_GetObject(poArgs, 1, &pDic))
  2217. return Py_BuildException();
  2218. int pos = 0;
  2219. PyObject* key, *value;
  2220. int size = PyDict_Size(pDic);
  2221.  
  2222. while (PyDict_Next(pDic, &pos, &key, &value))
  2223. {
  2224. int i = PyInt_AsLong(key);
  2225. if (i > DS_REFINE_WINDOW_MAX_NUM)
  2226. return Py_BuildException();
  2227.  
  2228. if (!PyTuple_GetByte(value, 0, &RefineItemPoses[i].window_type)
  2229. || !PyTuple_GetInteger(value, 1, &RefineItemPoses[i].cell))
  2230. {
  2231. return Py_BuildException();
  2232. }
  2233. }
  2234. }
  2235. break;
  2236. }
  2237.  
  2238. CPythonNetworkStream& rns=CPythonNetworkStream::Instance();
  2239. rns.SendDragonSoulRefinePacket(bSubHeader, RefineItemPoses);
  2240.  
  2241. return Py_BuildNone();
  2242. }
  2243.  
  2244. #ifdef ENABLE_CHANGELOOK_SYSTEM
  2245. PyObject * playerGetItemTransmutation(PyObject* poSelf, PyObject* poArgs)
  2246. {
  2247. switch (PyTuple_Size(poArgs))
  2248. {
  2249. case 1:
  2250. {
  2251. int iSlotIndex;
  2252. if (!PyTuple_GetInteger(poArgs, 0, &iSlotIndex))
  2253. return Py_BuildException();
  2254.  
  2255. DWORD dwTransmutation = CPythonPlayer::Instance().GetItemTransmutation(TItemPos(INVENTORY, iSlotIndex));
  2256. return Py_BuildValue("i", dwTransmutation);
  2257. }
  2258. case 2:
  2259. {
  2260. TItemPos Cell;
  2261. if (!PyTuple_GetByte(poArgs, 0, &Cell.window_type))
  2262. return Py_BuildException();
  2263.  
  2264. if (!PyTuple_GetInteger(poArgs, 1, &Cell.cell))
  2265. return Py_BuildException();
  2266.  
  2267. DWORD dwTransmutation = CPythonPlayer::Instance().GetItemTransmutation(Cell);
  2268. return Py_BuildValue("i", dwTransmutation);
  2269. }
  2270. default:
  2271. return Py_BuildException();
  2272. }
  2273. }
  2274. #endif
  2275.  
  2276. void initPlayer()
  2277. {
  2278. static PyMethodDef s_methods[] =
  2279. {
  2280. { "GetAutoPotionInfo", playerGetAutoPotionInfo, METH_VARARGS },
  2281. { "SetAutoPotionInfo", playerSetAutoPotionInfo, METH_VARARGS },
  2282.  
  2283. { "PickCloseItemVector", playerPickCloseItemVector, METH_VARARGS },
  2284. { "PickCloseItem", playerPickCloseItem, METH_VARARGS },
  2285. { "SetGameWindow", playerSetGameWindow, METH_VARARGS },
  2286. { "RegisterEffect", playerRegisterEffect, METH_VARARGS },
  2287. { "RegisterCacheEffect", playerRegisterCacheEffect, METH_VARARGS },
  2288. { "SetMouseState", playerSetMouseState, METH_VARARGS },
  2289. { "SetMouseFunc", playerSetMouseFunc, METH_VARARGS },
  2290. { "GetMouseFunc", playerGetMouseFunc, METH_VARARGS },
  2291. { "SetMouseMiddleButtonState", playerSetMouseMiddleButtonState, METH_VARARGS },
  2292. { "SetMainCharacterIndex", playerSetMainCharacterIndex, METH_VARARGS },
  2293. { "GetMainCharacterIndex", playerGetMainCharacterIndex, METH_VARARGS },
  2294. { "GetMainCharacterName", playerGetMainCharacterName, METH_VARARGS },
  2295. { "GetMainCharacterPosition", playerGetMainCharacterPosition, METH_VARARGS },
  2296. { "IsMainCharacterIndex", playerIsMainCharacterIndex, METH_VARARGS },
  2297. { "CanAttackInstance", playerCanAttackInstance, METH_VARARGS },
  2298. { "IsActingEmotion", playerIsActingEmotion, METH_VARARGS },
  2299. { "IsPVPInstance", playerIsPVPInstance, METH_VARARGS },
  2300. { "IsSameEmpire", playerIsSameEmpire, METH_VARARGS },
  2301. { "IsChallengeInstance", playerIsChallengeInstance, METH_VARARGS },
  2302. { "IsRevengeInstance", playerIsRevengeInstance, METH_VARARGS },
  2303. { "IsCantFightInstance", playerIsCantFightInstance, METH_VARARGS },
  2304. { "GetCharacterDistance", playerGetCharacterDistance, METH_VARARGS },
  2305. { "IsInSafeArea", playerIsInSafeArea, METH_VARARGS },
  2306. { "IsMountingHorse", playerIsMountingHorse, METH_VARARGS },
  2307. { "IsObserverMode", playerIsObserverMode, METH_VARARGS },
  2308. { "ActEmotion", playerActEmotion, METH_VARARGS },
  2309.  
  2310. { "ShowPlayer", playerShowPlayer, METH_VARARGS },
  2311. { "HidePlayer", playerHidePlayer, METH_VARARGS },
  2312.  
  2313. { "ComboAttack", playerComboAttack, METH_VARARGS },
  2314.  
  2315. { "SetAutoCameraRotationSpeed", playerSetAutoCameraRotationSpeed, METH_VARARGS },
  2316. { "SetAttackKeyState", playerSetAttackKeyState, METH_VARARGS },
  2317. { "SetSingleDIKKeyState", playerSetSingleDIKKeyState, METH_VARARGS },
  2318. { "EndKeyWalkingImmediately", playerEndKeyWalkingImmediately, METH_VARARGS },
  2319. { "StartMouseWalking", playerStartMouseWalking, METH_VARARGS },
  2320. { "EndMouseWalking", playerEndMouseWalking, METH_VARARGS },
  2321. { "ResetCameraRotation", playerResetCameraRotation, METH_VARARGS },
  2322. { "SetQuickCameraMode", playerSetQuickCameraMode, METH_VARARGS },
  2323.  
  2324. ///////////////////////////////////////////////////////////////////////////////////////////
  2325.  
  2326. { "SetSkill", playerSetSkill, METH_VARARGS },
  2327. { "GetSkillIndex", playerGetSkillIndex, METH_VARARGS },
  2328. { "GetSkillSlotIndex", playerGetSkillSlotIndex, METH_VARARGS },
  2329. { "GetSkillGrade", playerGetSkillGrade, METH_VARARGS },
  2330. { "GetSkillLevel", playerGetSkillLevel, METH_VARARGS },
  2331. { "GetSkillCurrentEfficientPercentage", playerGetSkillCurrentEfficientPercentage, METH_VARARGS },
  2332. { "GetSkillNextEfficientPercentage", playerGetSkillNextEfficientPercentage, METH_VARARGS },
  2333. { "ClickSkillSlot", playerClickSkillSlot, METH_VARARGS },
  2334. { "ChangeCurrentSkillNumberOnly", playerChangeCurrentSkillNumberOnly, METH_VARARGS },
  2335. { "ClearSkillDict", playerClearSkillDict, METH_VARARGS },
  2336.  
  2337. { "GetItemIndex", playerGetItemIndex, METH_VARARGS },
  2338. { "GetItemFlags", playerGetItemFlags, METH_VARARGS },
  2339. { "GetItemCount", playerGetItemCount, METH_VARARGS },
  2340. { "GetItemCountByVnum", playerGetItemCountByVnum, METH_VARARGS },
  2341. { "GetItemMetinSocket", playerGetItemMetinSocket, METH_VARARGS },
  2342. { "GetItemAttribute", playerGetItemAttribute, METH_VARARGS },
  2343. #if defined(GAIDEN)
  2344. { "GetItemUnbindTime", playerGetItemUnbindTime, METH_VARARGS },
  2345. #endif
  2346. { "GetISellItemPrice", playerGetISellItemPrice, METH_VARARGS },
  2347. { "MoveItem", playerMoveItem, METH_VARARGS },
  2348. { "SendClickItemPacket", playerSendClickItemPacket, METH_VARARGS },
  2349.  
  2350. ///////////////////////////////////////////////////////////////////////////////////////////
  2351.  
  2352. { "GetName", playerGetName, METH_VARARGS },
  2353. { "GetJob", playerGetJob, METH_VARARGS },
  2354. { "GetRace", playerGetRace, METH_VARARGS },
  2355. { "GetPlayTime", playerGetPlayTime, METH_VARARGS },
  2356. { "SetPlayTime", playerSetPlayTime, METH_VARARGS },
  2357.  
  2358.  
  2359. { "IsSkillCoolTime", playerIsSkillCoolTime, METH_VARARGS },
  2360. { "GetSkillCoolTime", playerGetSkillCoolTime, METH_VARARGS },
  2361. { "IsSkillActive", playerIsSkillActive, METH_VARARGS },
  2362. { "UseGuildSkill", playerUseGuildSkill, METH_VARARGS },
  2363. { "AffectIndexToSkillIndex", playerAffectIndexToSkillIndex, METH_VARARGS },
  2364. { "GetEXP", playerGetEXP, METH_VARARGS },
  2365. { "GetStatus", playerGetStatus, METH_VARARGS },
  2366. { "SetStatus", playerSetStatus, METH_VARARGS },
  2367. { "GetElk", playerGetElk, METH_VARARGS },
  2368. { "GetMoney", playerGetElk, METH_VARARGS },
  2369. { "GetGuildID", playerGetGuildID, METH_VARARGS },
  2370. { "GetGuildName", playerGetGuildName, METH_VARARGS },
  2371. { "GetAlignmentData", playerGetAlignmentData, METH_VARARGS },
  2372. { "RequestAddLocalQuickSlot", playerRequestAddLocalQuickSlot, METH_VARARGS },
  2373. { "RequestAddToEmptyLocalQuickSlot", playerRequestAddToEmptyLocalQuickSlot, METH_VARARGS },
  2374. { "RequestDeleteGlobalQuickSlot", playerRequestDeleteGlobalQuickSlot, METH_VARARGS },
  2375. { "RequestMoveGlobalQuickSlotToLocalQuickSlot", playerRequestMoveGlobalQuickSlotToLocalQuickSlot, METH_VARARGS },
  2376. { "RequestUseLocalQuickSlot", playerRequestUseLocalQuickSlot, METH_VARARGS },
  2377. { "LocalQuickSlotIndexToGlobalQuickSlotIndex", playerLocalQuickSlotIndexToGlobalQuickSlotIndex, METH_VARARGS },
  2378.  
  2379. { "GetQuickPage", playerGetQuickPage, METH_VARARGS },
  2380. { "SetQuickPage", playerSetQuickPage, METH_VARARGS },
  2381. { "GetLocalQuickSlot", playerGetLocalQuickSlot, METH_VARARGS },
  2382. { "GetGlobalQuickSlot", playerGetGlobalQuickSlot, METH_VARARGS },
  2383. { "RemoveQuickSlotByValue", playerRemoveQuickSlotByValue, METH_VARARGS },
  2384.  
  2385. { "isItem", playerisItem, METH_VARARGS },
  2386. { "IsEquipmentSlot", playerIsEquipmentSlot, METH_VARARGS },
  2387. { "IsDSEquipmentSlot", playerIsDSEquipmentSlot, METH_VARARGS },
  2388. { "IsCostumeSlot", playerIsCostumeSlot, METH_VARARGS },
  2389. { "IsValuableItem", playerIsValuableItem, METH_VARARGS },
  2390. { "IsOpenPrivateShop", playerIsOpenPrivateShop, METH_VARARGS },
  2391.  
  2392. #ifdef ENABLE_NEW_EQUIPMENT_SYSTEM
  2393. { "IsBeltInventorySlot", playerIsBeltInventorySlot, METH_VARARGS },
  2394. { "IsEquippingBelt", playerIsEquippingBelt, METH_VARARGS },
  2395. { "IsAvailableBeltInventoryCell", playerIsAvailableBeltInventoryCell, METH_VARARGS },
  2396. #endif
  2397.  
  2398. // Refine
  2399. { "GetItemGrade", playerGetItemGrade, METH_VARARGS },
  2400. { "CanRefine", playerCanRefine, METH_VARARGS },
  2401. { "CanDetach", playerCanDetach, METH_VARARGS },
  2402. { "CanUnlock", playerCanUnlock, METH_VARARGS },
  2403. { "CanAttachMetin", playerCanAttachMetin, METH_VARARGS },
  2404. { "IsRefineGradeScroll", playerIsRefineGradeScroll, METH_VARARGS },
  2405.  
  2406. { "ClearTarget", playerClearTarget, METH_VARARGS },
  2407. { "SetTarget", playerSetTarget, METH_VARARGS },
  2408. { "OpenCharacterMenu", playerOpenCharacterMenu, METH_VARARGS },
  2409.  
  2410. { "Update", playerUpdate, METH_VARARGS },
  2411. { "Render", playerRender, METH_VARARGS },
  2412. { "Clear", playerClear, METH_VARARGS },
  2413.  
  2414. // Party
  2415. { "IsPartyMember", playerIsPartyMember, METH_VARARGS },
  2416. { "IsPartyLeader", playerIsPartyLeader, METH_VARARGS },
  2417. { "IsPartyLeaderByPID", playerIsPartyLeaderByPID, METH_VARARGS },
  2418. { "GetPartyMemberHPPercentage", playerGetPartyMemberHPPercentage, METH_VARARGS },
  2419. { "GetPartyMemberState", playerGetPartyMemberState, METH_VARARGS },
  2420. { "GetPartyMemberAffects", playerGetPartyMemberAffects, METH_VARARGS },
  2421. { "RemovePartyMember", playerRemovePartyMember, METH_VARARGS },
  2422. { "ExitParty", playerExitParty, METH_VARARGS },
  2423.  
  2424. // PK Mode
  2425. { "GetPKMode", playerGetPKMode, METH_VARARGS },
  2426.  
  2427. // Mobile
  2428. { "HasMobilePhoneNumber", playerHasMobilePhoneNumber, METH_VARARGS },
  2429.  
  2430. // Emotion
  2431. { "RegisterEmotionIcon", playerRegisterEmotionIcon, METH_VARARGS },
  2432. { "GetEmotionIconImage", playerGetEmotionIconImage, METH_VARARGS },
  2433.  
  2434. // For System
  2435. { "SetWeaponAttackBonusFlag", playerSetWeaponAttackBonusFlag, METH_VARARGS },
  2436. { "ToggleCoolTime", playerToggleCoolTime, METH_VARARGS },
  2437. { "ToggleLevelLimit", playerToggleLevelLimit, METH_VARARGS },
  2438. { "GetTargetVID", playerGetTargetVID, METH_VARARGS },
  2439.  
  2440. { "SetItemData", playerSetItemData, METH_VARARGS },
  2441. { "SetItemMetinSocket", playerSetItemMetinSocket, METH_VARARGS },
  2442. { "SetItemAttribute", playerSetItemAttribute, METH_VARARGS },
  2443. { "SetItemCount", playerSetItemCount, METH_VARARGS },
  2444.  
  2445. { "GetItemLink", playerGetItemLink, METH_VARARGS },
  2446. { "SlotTypeToInvenType", playerSlotTypeToInvenType, METH_VARARGS },
  2447. { "SendDragonSoulRefine", playerSendDragonSoulRefine, METH_VARARGS },
  2448.  
  2449. { "GetItemTypeBySlot", playerGetItemTypeBySlot, METH_VARARGS },
  2450. #ifdef ENABLE_CHANGELOOK_SYSTEM
  2451. {"GetItemTransmutation", playerGetItemTransmutation, METH_VARARGS},
  2452. #endif
  2453.  
  2454. { NULL, NULL, NULL },
  2455. };
  2456.  
  2457. PyObject* poModule = Py_InitModule("player", s_methods);
  2458. PyModule_AddIntConstant(poModule, "LEVEL", POINT_LEVEL);
  2459. PyModule_AddIntConstant(poModule, "VOICE", POINT_VOICE);
  2460. PyModule_AddIntConstant(poModule, "EXP", POINT_EXP);
  2461. PyModule_AddIntConstant(poModule, "NEXT_EXP", POINT_NEXT_EXP);
  2462. PyModule_AddIntConstant(poModule, "HP", POINT_HP);
  2463. PyModule_AddIntConstant(poModule, "MAX_HP", POINT_MAX_HP);
  2464. PyModule_AddIntConstant(poModule, "SP", POINT_SP);
  2465. PyModule_AddIntConstant(poModule, "MAX_SP", POINT_MAX_SP);
  2466. PyModule_AddIntConstant(poModule, "STAMINA", POINT_STAMINA);
  2467. PyModule_AddIntConstant(poModule, "MAX_STAMINA", POINT_MAX_STAMINA);
  2468. PyModule_AddIntConstant(poModule, "ELK", POINT_GOLD);
  2469. PyModule_AddIntConstant(poModule, "ST", POINT_ST);
  2470. PyModule_AddIntConstant(poModule, "HT", POINT_HT);
  2471. PyModule_AddIntConstant(poModule, "DX", POINT_DX);
  2472. PyModule_AddIntConstant(poModule, "IQ", POINT_IQ);
  2473. PyModule_AddIntConstant(poModule, "ATT_POWER", POINT_ATT_POWER);
  2474. PyModule_AddIntConstant(poModule, "ATT_MIN", POINT_MIN_ATK);
  2475. PyModule_AddIntConstant(poModule, "ATT_MAX", POINT_MAX_ATK);
  2476. PyModule_AddIntConstant(poModule, "MIN_MAGIC_WEP", POINT_MIN_MAGIC_WEP);
  2477. PyModule_AddIntConstant(poModule, "MAX_MAGIC_WEP", POINT_MAX_MAGIC_WEP);
  2478. PyModule_AddIntConstant(poModule, "ATT_SPEED", POINT_ATT_SPEED);
  2479. PyModule_AddIntConstant(poModule, "ATT_BONUS", POINT_ATT_GRADE_BONUS);
  2480. PyModule_AddIntConstant(poModule, "EVADE_RATE", POINT_EVADE_RATE);
  2481. PyModule_AddIntConstant(poModule, "MOVING_SPEED", POINT_MOV_SPEED);
  2482. PyModule_AddIntConstant(poModule, "DEF_GRADE", POINT_DEF_GRADE);
  2483. PyModule_AddIntConstant(poModule, "DEF_BONUS", POINT_DEF_GRADE_BONUS);
  2484. PyModule_AddIntConstant(poModule, "CASTING_SPEED", POINT_CASTING_SPEED);
  2485. PyModule_AddIntConstant(poModule, "MAG_ATT", POINT_MAGIC_ATT_GRADE);
  2486. PyModule_AddIntConstant(poModule, "MAG_DEF", POINT_MAGIC_DEF_GRADE);
  2487. PyModule_AddIntConstant(poModule, "EMPIRE_POINT", POINT_EMPIRE_POINT);
  2488. PyModule_AddIntConstant(poModule, "STAT", POINT_STAT);
  2489. PyModule_AddIntConstant(poModule, "SKILL_PASSIVE", POINT_SUB_SKILL);
  2490. PyModule_AddIntConstant(poModule, "SKILL_SUPPORT", POINT_SUB_SKILL);
  2491. PyModule_AddIntConstant(poModule, "SKILL_ACTIVE", POINT_SKILL);
  2492. PyModule_AddIntConstant(poModule, "SKILL_HORSE", POINT_HORSE_SKILL);
  2493. PyModule_AddIntConstant(poModule, "PLAYTIME", POINT_PLAYTIME);
  2494. PyModule_AddIntConstant(poModule, "BOW_DISTANCE", POINT_BOW_DISTANCE);
  2495. PyModule_AddIntConstant(poModule, "HP_RECOVERY", POINT_HP_RECOVERY);
  2496. PyModule_AddIntConstant(poModule, "SP_RECOVERY", POINT_SP_RECOVERY);
  2497. PyModule_AddIntConstant(poModule, "ATTACKER_BONUS", POINT_PARTY_ATT_GRADE);
  2498. PyModule_AddIntConstant(poModule, "MAX_NUM", POINT_MAX_NUM);
  2499. ////
  2500. PyModule_AddIntConstant(poModule, "POINT_CRITICAL_PCT", POINT_CRITICAL_PCT);
  2501. PyModule_AddIntConstant(poModule, "POINT_PENETRATE_PCT", POINT_PENETRATE_PCT);
  2502. PyModule_AddIntConstant(poModule, "POINT_MALL_ATTBONUS", POINT_MALL_ATTBONUS);
  2503. PyModule_AddIntConstant(poModule, "POINT_MALL_DEFBONUS", POINT_MALL_DEFBONUS);
  2504. PyModule_AddIntConstant(poModule, "POINT_MALL_EXPBONUS", POINT_MALL_EXPBONUS);
  2505. PyModule_AddIntConstant(poModule, "POINT_MALL_ITEMBONUS", POINT_MALL_ITEMBONUS);
  2506. PyModule_AddIntConstant(poModule, "POINT_MALL_GOLDBONUS", POINT_MALL_GOLDBONUS);
  2507. PyModule_AddIntConstant(poModule, "POINT_MAX_HP_PCT", POINT_MAX_HP_PCT);
  2508. PyModule_AddIntConstant(poModule, "POINT_MAX_SP_PCT", POINT_MAX_SP_PCT);
  2509.  
  2510. PyModule_AddIntConstant(poModule, "POINT_SKILL_DAMAGE_BONUS", POINT_SKILL_DAMAGE_BONUS);
  2511. PyModule_AddIntConstant(poModule, "POINT_NORMAL_HIT_DAMAGE_BONUS", POINT_NORMAL_HIT_DAMAGE_BONUS);
  2512. PyModule_AddIntConstant(poModule, "POINT_SKILL_DEFEND_BONUS", POINT_SKILL_DEFEND_BONUS);
  2513. PyModule_AddIntConstant(poModule, "POINT_NORMAL_HIT_DEFEND_BONUS", POINT_NORMAL_HIT_DEFEND_BONUS);
  2514.  
  2515. PyModule_AddIntConstant(poModule, "ENERGY", POINT_ENERGY);
  2516. PyModule_AddIntConstant(poModule, "ENERGY_END_TIME", POINT_ENERGY_END_TIME);
  2517.  
  2518. PyModule_AddIntConstant(poModule, "SKILL_GRADE_NORMAL", CPythonPlayer::SKILL_NORMAL);
  2519. PyModule_AddIntConstant(poModule, "SKILL_GRADE_MASTER", CPythonPlayer::SKILL_MASTER);
  2520. PyModule_AddIntConstant(poModule, "SKILL_GRADE_GRAND_MASTER", CPythonPlayer::SKILL_GRAND_MASTER);
  2521. PyModule_AddIntConstant(poModule, "SKILL_GRADE_PERFECT_MASTER", CPythonPlayer::SKILL_PERFECT_MASTER);
  2522.  
  2523. PyModule_AddIntConstant(poModule, "CATEGORY_ACTIVE", CPythonPlayer::CATEGORY_ACTIVE);
  2524. PyModule_AddIntConstant(poModule, "CATEGORY_PASSIVE", CPythonPlayer::CATEGORY_PASSIVE);
  2525.  
  2526. PyModule_AddIntConstant(poModule, "INVENTORY_PAGE_SIZE", c_Inventory_Page_Size);
  2527. PyModule_AddIntConstant(poModule, "INVENTORY_PAGE_COUNT", c_Inventory_Page_Count);
  2528. PyModule_AddIntConstant(poModule, "INVENTORY_SLOT_COUNT", c_Inventory_Count);
  2529. PyModule_AddIntConstant(poModule, "EQUIPMENT_SLOT_START", c_Equipment_Start);
  2530. PyModule_AddIntConstant(poModule, "EQUIPMENT_PAGE_COUNT", c_Equipment_Count);
  2531.  
  2532. #ifdef ENABLE_NEW_EQUIPMENT_SYSTEM
  2533. PyModule_AddIntConstant(poModule, "NEW_EQUIPMENT_SLOT_START", c_New_Equipment_Start);
  2534. PyModule_AddIntConstant(poModule, "NEW_EQUIPMENT_SLOT_COUNT", c_New_Equipment_Count);
  2535. #endif
  2536.  
  2537. PyModule_AddIntConstant(poModule, "MBF_SKILL", CPythonPlayer::MBF_SKILL);
  2538. PyModule_AddIntConstant(poModule, "MBF_ATTACK", CPythonPlayer::MBF_ATTACK);
  2539. PyModule_AddIntConstant(poModule, "MBF_CAMERA", CPythonPlayer::MBF_CAMERA);
  2540. PyModule_AddIntConstant(poModule, "MBF_SMART", CPythonPlayer::MBF_SMART);
  2541. PyModule_AddIntConstant(poModule, "MBF_MOVE", CPythonPlayer::MBF_MOVE);
  2542. PyModule_AddIntConstant(poModule, "MBF_AUTO", CPythonPlayer::MBF_AUTO);
  2543. PyModule_AddIntConstant(poModule, "MBS_PRESS", CPythonPlayer::MBS_PRESS);
  2544. PyModule_AddIntConstant(poModule, "MBS_CLICK", CPythonPlayer::MBS_CLICK);
  2545. PyModule_AddIntConstant(poModule, "MBT_RIGHT", CPythonPlayer::MBT_RIGHT);
  2546. PyModule_AddIntConstant(poModule, "MBT_LEFT", CPythonPlayer::MBT_LEFT);
  2547.  
  2548. // Public code with server
  2549. PyModule_AddIntConstant(poModule, "SLOT_TYPE_NONE", SLOT_TYPE_NONE);
  2550. PyModule_AddIntConstant(poModule, "SLOT_TYPE_INVENTORY", SLOT_TYPE_INVENTORY);
  2551. PyModule_AddIntConstant(poModule, "SLOT_TYPE_SKILL", SLOT_TYPE_SKILL);
  2552. // Special indecies for client
  2553. PyModule_AddIntConstant(poModule, "SLOT_TYPE_SHOP", SLOT_TYPE_SHOP);
  2554. PyModule_AddIntConstant(poModule, "SLOT_TYPE_EXCHANGE_OWNER", SLOT_TYPE_EXCHANGE_OWNER);
  2555. PyModule_AddIntConstant(poModule, "SLOT_TYPE_EXCHANGE_TARGET", SLOT_TYPE_EXCHANGE_TARGET);
  2556. PyModule_AddIntConstant(poModule, "SLOT_TYPE_QUICK_SLOT", SLOT_TYPE_QUICK_SLOT);
  2557. PyModule_AddIntConstant(poModule, "SLOT_TYPE_SAFEBOX", SLOT_TYPE_SAFEBOX);
  2558. PyModule_AddIntConstant(poModule, "SLOT_TYPE_PRIVATE_SHOP", SLOT_TYPE_PRIVATE_SHOP);
  2559. PyModule_AddIntConstant(poModule, "SLOT_TYPE_MALL", SLOT_TYPE_MALL);
  2560. PyModule_AddIntConstant(poModule, "SLOT_TYPE_EMOTION", SLOT_TYPE_EMOTION);
  2561. PyModule_AddIntConstant(poModule, "SLOT_TYPE_DRAGON_SOUL_INVENTORY", SLOT_TYPE_DRAGON_SOUL_INVENTORY);
  2562.  
  2563. PyModule_AddIntConstant(poModule, "RESERVED_WINDOW", RESERVED_WINDOW);
  2564. PyModule_AddIntConstant(poModule, "INVENTORY", INVENTORY);
  2565. PyModule_AddIntConstant(poModule, "EQUIPMENT", EQUIPMENT);
  2566. PyModule_AddIntConstant(poModule, "SAFEBOX", SAFEBOX);
  2567. PyModule_AddIntConstant(poModule, "MALL", MALL);
  2568. PyModule_AddIntConstant(poModule, "DRAGON_SOUL_INVENTORY", DRAGON_SOUL_INVENTORY);
  2569. PyModule_AddIntConstant(poModule, "GROUND", GROUND);
  2570.  
  2571. PyModule_AddIntConstant(poModule, "ITEM_MONEY", -1);
  2572.  
  2573. PyModule_AddIntConstant(poModule, "SKILL_SLOT_COUNT", SKILL_MAX_NUM);
  2574.  
  2575. PyModule_AddIntConstant(poModule, "EFFECT_PICK", CPythonPlayer::EFFECT_PICK);
  2576.  
  2577. PyModule_AddIntConstant(poModule, "METIN_SOCKET_TYPE_NONE", CPythonPlayer::METIN_SOCKET_TYPE_NONE);
  2578. PyModule_AddIntConstant(poModule, "METIN_SOCKET_TYPE_SILVER", CPythonPlayer::METIN_SOCKET_TYPE_SILVER);
  2579. PyModule_AddIntConstant(poModule, "METIN_SOCKET_TYPE_GOLD", CPythonPlayer::METIN_SOCKET_TYPE_GOLD);
  2580. PyModule_AddIntConstant(poModule, "METIN_SOCKET_MAX_NUM", ITEM_SOCKET_SLOT_MAX_NUM);
  2581. PyModule_AddIntConstant(poModule, "ATTRIBUTE_SLOT_MAX_NUM", ITEM_ATTRIBUTE_SLOT_MAX_NUM);
  2582.  
  2583. PyModule_AddIntConstant(poModule, "REFINE_CANT", REFINE_CANT);
  2584. PyModule_AddIntConstant(poModule, "REFINE_OK", REFINE_OK);
  2585. PyModule_AddIntConstant(poModule, "REFINE_ALREADY_MAX_SOCKET_COUNT", REFINE_ALREADY_MAX_SOCKET_COUNT);
  2586. PyModule_AddIntConstant(poModule, "REFINE_NEED_MORE_GOOD_SCROLL", REFINE_NEED_MORE_GOOD_SCROLL);
  2587. PyModule_AddIntConstant(poModule, "REFINE_CANT_MAKE_SOCKET_ITEM", REFINE_CANT_MAKE_SOCKET_ITEM);
  2588. PyModule_AddIntConstant(poModule, "REFINE_NOT_NEXT_GRADE_ITEM", REFINE_NOT_NEXT_GRADE_ITEM);
  2589. PyModule_AddIntConstant(poModule, "REFINE_CANT_REFINE_METIN_TO_EQUIPMENT", REFINE_CANT_REFINE_METIN_TO_EQUIPMENT);
  2590. PyModule_AddIntConstant(poModule, "REFINE_CANT_REFINE_ROD", REFINE_CANT_REFINE_ROD);
  2591. PyModule_AddIntConstant(poModule, "ATTACH_METIN_CANT", ATTACH_METIN_CANT);
  2592. PyModule_AddIntConstant(poModule, "ATTACH_METIN_OK", ATTACH_METIN_OK);
  2593. PyModule_AddIntConstant(poModule, "ATTACH_METIN_NOT_MATCHABLE_ITEM", ATTACH_METIN_NOT_MATCHABLE_ITEM);
  2594. PyModule_AddIntConstant(poModule, "ATTACH_METIN_NO_MATCHABLE_SOCKET", ATTACH_METIN_NO_MATCHABLE_SOCKET);
  2595. PyModule_AddIntConstant(poModule, "ATTACH_METIN_NOT_EXIST_GOLD_SOCKET", ATTACH_METIN_NOT_EXIST_GOLD_SOCKET);
  2596. PyModule_AddIntConstant(poModule, "ATTACH_METIN_CANT_ATTACH_TO_EQUIPMENT", ATTACH_METIN_CANT_ATTACH_TO_EQUIPMENT);
  2597. PyModule_AddIntConstant(poModule, "DETACH_METIN_CANT", DETACH_METIN_CANT);
  2598. PyModule_AddIntConstant(poModule, "DETACH_METIN_OK", DETACH_METIN_OK);
  2599.  
  2600. // Party
  2601. PyModule_AddIntConstant(poModule, "PARTY_STATE_NORMAL", CPythonPlayer::PARTY_ROLE_NORMAL);
  2602. PyModule_AddIntConstant(poModule, "PARTY_STATE_LEADER", CPythonPlayer::PARTY_ROLE_LEADER);
  2603. PyModule_AddIntConstant(poModule, "PARTY_STATE_ATTACKER", CPythonPlayer::PARTY_ROLE_ATTACKER);
  2604. PyModule_AddIntConstant(poModule, "PARTY_STATE_TANKER", CPythonPlayer::PARTY_ROLE_TANKER);
  2605. PyModule_AddIntConstant(poModule, "PARTY_STATE_BUFFER", CPythonPlayer::PARTY_ROLE_BUFFER);
  2606. PyModule_AddIntConstant(poModule, "PARTY_STATE_SKILL_MASTER", CPythonPlayer::PARTY_ROLE_SKILL_MASTER);
  2607. PyModule_AddIntConstant(poModule, "PARTY_STATE_BERSERKER", CPythonPlayer::PARTY_ROLE_BERSERKER);
  2608. PyModule_AddIntConstant(poModule, "PARTY_STATE_DEFENDER", CPythonPlayer::PARTY_ROLE_DEFENDER);
  2609. PyModule_AddIntConstant(poModule, "PARTY_STATE_MAX_NUM", CPythonPlayer::PARTY_ROLE_MAX_NUM);
  2610.  
  2611. // Skill Index
  2612. PyModule_AddIntConstant(poModule, "SKILL_INDEX_TONGSOL", c_iSkillIndex_Tongsol);
  2613. PyModule_AddIntConstant(poModule, "SKILL_INDEX_FISHING", c_iSkillIndex_Fishing);
  2614. PyModule_AddIntConstant(poModule, "SKILL_INDEX_MINING", c_iSkillIndex_Mining);
  2615. PyModule_AddIntConstant(poModule, "SKILL_INDEX_MAKING", c_iSkillIndex_Making);
  2616. PyModule_AddIntConstant(poModule, "SKILL_INDEX_COMBO", c_iSkillIndex_Combo);
  2617. PyModule_AddIntConstant(poModule, "SKILL_INDEX_LANGUAGE1", c_iSkillIndex_Language1);
  2618. PyModule_AddIntConstant(poModule, "SKILL_INDEX_LANGUAGE2", c_iSkillIndex_Language2);
  2619. PyModule_AddIntConstant(poModule, "SKILL_INDEX_LANGUAGE3", c_iSkillIndex_Language3);
  2620. PyModule_AddIntConstant(poModule, "SKILL_INDEX_POLYMORPH", c_iSkillIndex_Polymorph);
  2621. PyModule_AddIntConstant(poModule, "SKILL_INDEX_RIDING", c_iSkillIndex_Riding);
  2622. PyModule_AddIntConstant(poModule, "SKILL_INDEX_SUMMON", c_iSkillIndex_Summon);
  2623.  
  2624. // PK Mode
  2625. PyModule_AddIntConstant(poModule, "PK_MODE_PEACE", PK_MODE_PEACE);
  2626. PyModule_AddIntConstant(poModule, "PK_MODE_REVENGE", PK_MODE_REVENGE);
  2627. PyModule_AddIntConstant(poModule, "PK_MODE_FREE", PK_MODE_FREE);
  2628. PyModule_AddIntConstant(poModule, "PK_MODE_PROTECT", PK_MODE_PROTECT);
  2629. PyModule_AddIntConstant(poModule, "PK_MODE_GUILD", PK_MODE_GUILD);
  2630. PyModule_AddIntConstant(poModule, "PK_MODE_MAX_NUM", PK_MODE_MAX_NUM);
  2631.  
  2632. #ifdef ENABLE_FEATURES_REFINE_SYSTEM
  2633. PyModule_AddIntConstant(poModule, "REFINE_PERCENTAGE_LOW", REFINE_PERCENTAGE_LOW);
  2634. PyModule_AddIntConstant(poModule, "REFINE_PERCENTAGE_MEDIUM", REFINE_PERCENTAGE_MEDIUM);
  2635. PyModule_AddIntConstant(poModule, "REFINE_PERCENTAGE_EXTRA", REFINE_PERCENTAGE_EXTRA);
  2636.  
  2637. PyModule_AddIntConstant(poModule, "REFINE_VNUM_POTION_LOW", REFINE_VNUM_POTION_LOW);
  2638. PyModule_AddIntConstant(poModule, "REFINE_VNUM_POTION_MEDIUM", REFINE_VNUM_POTION_MEDIUM);
  2639. PyModule_AddIntConstant(poModule, "REFINE_VNUM_POTION_EXTRA", REFINE_VNUM_POTION_EXTRA);
  2640. #endif
  2641.  
  2642. // Block Mode
  2643. PyModule_AddIntConstant(poModule, "BLOCK_EXCHANGE", BLOCK_EXCHANGE);
  2644. PyModule_AddIntConstant(poModule, "BLOCK_PARTY", BLOCK_PARTY_INVITE);
  2645. PyModule_AddIntConstant(poModule, "BLOCK_GUILD", BLOCK_GUILD_INVITE);
  2646. PyModule_AddIntConstant(poModule, "BLOCK_WHISPER", BLOCK_WHISPER);
  2647. PyModule_AddIntConstant(poModule, "BLOCK_FRIEND", BLOCK_MESSENGER_INVITE);
  2648. PyModule_AddIntConstant(poModule, "BLOCK_PARTY_REQUEST", BLOCK_PARTY_REQUEST);
  2649.  
  2650. // Party
  2651. PyModule_AddIntConstant(poModule, "PARTY_EXP_NON_DISTRIBUTION", PARTY_EXP_DISTRIBUTION_NON_PARITY);
  2652. PyModule_AddIntConstant(poModule, "PARTY_EXP_DISTRIBUTION_PARITY", PARTY_EXP_DISTRIBUTION_PARITY);
  2653.  
  2654. // Emotion
  2655. PyModule_AddIntConstant(poModule, "EMOTION_CLAP", EMOTION_CLAP);
  2656. PyModule_AddIntConstant(poModule, "EMOTION_CHEERS_1", EMOTION_CHEERS_1);
  2657. PyModule_AddIntConstant(poModule, "EMOTION_CHEERS_2", EMOTION_CHEERS_2);
  2658. PyModule_AddIntConstant(poModule, "EMOTION_DANCE_1", EMOTION_DANCE_1);
  2659. PyModule_AddIntConstant(poModule, "EMOTION_DANCE_2", EMOTION_DANCE_2);
  2660. PyModule_AddIntConstant(poModule, "EMOTION_DANCE_3", EMOTION_DANCE_3);
  2661. PyModule_AddIntConstant(poModule, "EMOTION_DANCE_4", EMOTION_DANCE_4);
  2662. PyModule_AddIntConstant(poModule, "EMOTION_DANCE_5", EMOTION_DANCE_5);
  2663. PyModule_AddIntConstant(poModule, "EMOTION_DANCE_6", EMOTION_DANCE_6); // PSY 강남스타일
  2664. PyModule_AddIntConstant(poModule, "EMOTION_CONGRATULATION", EMOTION_CONGRATULATION);
  2665. PyModule_AddIntConstant(poModule, "EMOTION_FORGIVE", EMOTION_FORGIVE);
  2666. PyModule_AddIntConstant(poModule, "EMOTION_ANGRY", EMOTION_ANGRY);
  2667. PyModule_AddIntConstant(poModule, "EMOTION_ATTRACTIVE", EMOTION_ATTRACTIVE);
  2668. PyModule_AddIntConstant(poModule, "EMOTION_SAD", EMOTION_SAD);
  2669. PyModule_AddIntConstant(poModule, "EMOTION_SHY", EMOTION_SHY);
  2670. PyModule_AddIntConstant(poModule, "EMOTION_CHEERUP", EMOTION_CHEERUP);
  2671. PyModule_AddIntConstant(poModule, "EMOTION_BANTER", EMOTION_BANTER);
  2672. PyModule_AddIntConstant(poModule, "EMOTION_JOY", EMOTION_JOY);
  2673.  
  2674. PyModule_AddIntConstant(poModule, "EMOTION_KISS", EMOTION_KISS);
  2675. PyModule_AddIntConstant(poModule, "EMOTION_FRENCH_KISS", EMOTION_FRENCH_KISS);
  2676. PyModule_AddIntConstant(poModule, "EMOTION_SLAP", EMOTION_SLAP);
  2677.  
  2678. //// 자동물약 타입
  2679. PyModule_AddIntConstant(poModule, "AUTO_POTION_TYPE_HP", CPythonPlayer::AUTO_POTION_TYPE_HP);
  2680. PyModule_AddIntConstant(poModule, "AUTO_POTION_TYPE_SP", CPythonPlayer::AUTO_POTION_TYPE_SP);
  2681.  
  2682. // 용혼석
  2683. PyModule_AddIntConstant(poModule, "DRAGON_SOUL_PAGE_SIZE", c_DragonSoul_Inventory_Box_Size);
  2684. PyModule_AddIntConstant(poModule, "DRAGON_SOUL_PAGE_COUNT", DRAGON_SOUL_GRADE_MAX);
  2685. PyModule_AddIntConstant(poModule, "DRAGON_SOUL_SLOT_COUNT", c_DragonSoul_Inventory_Count);
  2686. PyModule_AddIntConstant(poModule, "DRAGON_SOUL_EQUIPMENT_SLOT_START", c_DragonSoul_Equip_Start);
  2687. PyModule_AddIntConstant(poModule, "DRAGON_SOUL_EQUIPMENT_PAGE_COUNT", DS_DECK_MAX_NUM);
  2688. PyModule_AddIntConstant(poModule, "DRAGON_SOUL_EQUIPMENT_FIRST_SIZE", c_DragonSoul_Equip_Slot_Max);
  2689.  
  2690. #ifdef ENABLE_SPECIAL_STORAGE
  2691. PyModule_AddIntConstant(poModule, "SLOT_TYPE_UPGRADE_INVENTORY", SLOT_TYPE_UPGRADE_INVENTORY);
  2692. PyModule_AddIntConstant(poModule, "SLOT_TYPE_BOOK_INVENTORY", SLOT_TYPE_BOOK_INVENTORY);
  2693. PyModule_AddIntConstant(poModule, "SLOT_TYPE_STONE_INVENTORY", SLOT_TYPE_STONE_INVENTORY);
  2694. PyModule_AddIntConstant(poModule, "SLOT_TYPE_CHEST_INVENTORY", SLOT_TYPE_CHEST_INVENTORY);
  2695. PyModule_AddIntConstant(poModule, "UPGRADE_INVENTORY", UPGRADE_INVENTORY);
  2696. PyModule_AddIntConstant(poModule, "BOOK_INVENTORY", BOOK_INVENTORY);
  2697. PyModule_AddIntConstant(poModule, "STONE_INVENTORY", STONE_INVENTORY);
  2698. PyModule_AddIntConstant(poModule, "CHEST_INVENTORY", CHEST_INVENTORY);
  2699. PyModule_AddIntConstant(poModule, "SPECIAL_PAGE_SIZE", c_Special_Inventory_Page_Size);
  2700. PyModule_AddIntConstant(poModule, "SPECIAL_PAGE_COUNT", c_Special_Inventory_Page_Count);
  2701. PyModule_AddIntConstant(poModule, "SPECIAL_SLOT_COUNT", c_Special_ItemSlot_Count);
  2702. #endif
  2703.  
  2704. PyModule_AddIntConstant(poModule, "DRAGON_SOUL_REFINE_CLOSE", DS_SUB_HEADER_CLOSE);
  2705. PyModule_AddIntConstant(poModule, "DS_SUB_HEADER_DO_UPGRADE", DS_SUB_HEADER_DO_UPGRADE);
  2706. PyModule_AddIntConstant(poModule, "DS_SUB_HEADER_DO_IMPROVEMENT", DS_SUB_HEADER_DO_IMPROVEMENT);
  2707. PyModule_AddIntConstant(poModule, "DS_SUB_HEADER_DO_REFINE", DS_SUB_HEADER_DO_REFINE);
  2708.  
  2709. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement