Advertisement
Guest User

Untitled

a guest
Aug 28th, 2020
30
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 75.90 KB | None
  1.  
  2. #include "stdafx.h"
  3.  
  4. #include "config.h"
  5. #include "questmanager.h"
  6. #include "sectree_manager.h"
  7. #include "char.h"
  8. #include "char_manager.h"
  9. #include "affect.h"
  10. #include "item.h"
  11. #include "item_manager.h"
  12. #include "guild_manager.h"
  13. #include "war_map.h"
  14. #include "start_position.h"
  15. #include "marriage.h"
  16. #include "mining.h"
  17. #include "p2p.h"
  18. #include "polymorph.h"
  19. #include "desc_client.h"
  20. #include "messenger_manager.h"
  21. #include "log.h"
  22. #include "utils.h"
  23. #include "unique_item.h"
  24. #include "mob_manager.h"
  25.  
  26. #include <cctype>
  27. #undef sys_err
  28. #ifndef __WIN32__
  29. #define sys_err(fmt, args...) quest::CQuestManager::instance().QuestError(__FUNCTION__, __LINE__, fmt, ##args)
  30. #else
  31. #define sys_err(fmt, ...) quest::CQuestManager::instance().QuestError(__FUNCTION__, __LINE__, fmt, __VA_ARGS__)
  32. #endif
  33.  
  34. extern int g_nPortalLimitTime;
  35. extern LPCLIENT_DESC db_clientdesc;
  36. const int ITEM_BROKEN_METIN_VNUM = 28960;
  37.  
  38. namespace quest
  39. {
  40. //
  41. // "pc" Lua functions
  42. //
  43. int pc_has_master_skill(lua_State* L)
  44. {
  45. LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
  46. bool bHasMasterSkill = false;
  47. for (int i=0; i< SKILL_MAX_NUM; i++)
  48. if (ch->GetSkillMasterType(i) >= SKILL_MASTER && ch->GetSkillLevel(i) >= 21)
  49. {
  50. bHasMasterSkill = true;
  51. break;
  52. }
  53.  
  54. lua_pushboolean(L, bHasMasterSkill);
  55. return 1;
  56. }
  57.  
  58. int pc_remove_skill_book_no_delay(lua_State* L)
  59. {
  60. LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
  61. ch->RemoveAffect(AFFECT_SKILL_NO_BOOK_DELAY);
  62. return 0;
  63. }
  64.  
  65. int pc_is_skill_book_no_delay(lua_State* L)
  66. {
  67. LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
  68.  
  69. lua_pushboolean(L, ch->FindAffect(AFFECT_SKILL_NO_BOOK_DELAY) ? true : false);
  70. return 1;
  71. }
  72.  
  73. int pc_learn_grand_master_skill(lua_State* L)
  74. {
  75. LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
  76.  
  77. if (!lua_isnumber(L, 1))
  78. {
  79. sys_err("wrong skill index");
  80. return 0;
  81. }
  82.  
  83. lua_pushboolean(L, ch->LearnGrandMasterSkill((long)lua_tonumber(L, 1)));
  84. return 1;
  85. }
  86.  
  87. int pc_set_warp_location(lua_State * L)
  88. {
  89. LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
  90.  
  91. if (!lua_isnumber(L, 1))
  92. {
  93. sys_err("wrong map index");
  94. return 0;
  95. }
  96.  
  97. if (!lua_isnumber(L, 2) || !lua_isnumber(L, 3))
  98. {
  99. sys_err("wrong coodinate");
  100. return 0;
  101. }
  102.  
  103. ch->SetWarpLocation((long)lua_tonumber(L,1), (long)lua_tonumber(L,2), (long)lua_tonumber(L,3));
  104. return 0;
  105. }
  106.  
  107. int pc_set_warp_location_local(lua_State * L)
  108. {
  109. LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
  110.  
  111. if (!lua_isnumber(L, 1))
  112. {
  113. sys_err("wrong map index");
  114. return 0;
  115. }
  116.  
  117. if (!lua_isnumber(L, 2) || !lua_isnumber(L, 3))
  118. {
  119. sys_err("wrong coodinate");
  120. return 0;
  121. }
  122.  
  123. long lMapIndex = (long) lua_tonumber(L, 1);
  124. const TMapRegion * region = SECTREE_MANAGER::instance().GetMapRegion(lMapIndex);
  125.  
  126. if (!region)
  127. {
  128. sys_err("invalid map index %d", lMapIndex);
  129. return 0;
  130. }
  131.  
  132. int x = (int) lua_tonumber(L, 2);
  133. int y = (int) lua_tonumber(L, 3);
  134.  
  135. if (x > region->ex - region->sx)
  136. {
  137. sys_err("x coordinate overflow max: %d input: %d", region->ex - region->sx, x);
  138. return 0;
  139. }
  140.  
  141. if (y > region->ey - region->sy)
  142. {
  143. sys_err("y coordinate overflow max: %d input: %d", region->ey - region->sy, y);
  144. return 0;
  145. }
  146.  
  147. ch->SetWarpLocation(lMapIndex, x, y);
  148. return 0;
  149. }
  150.  
  151. int pc_get_start_location(lua_State * L)
  152. {
  153. LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
  154.  
  155. lua_pushnumber(L, g_start_map[ch->GetEmpire()]);
  156. lua_pushnumber(L, g_start_position[ch->GetEmpire()][0] / 100);
  157. lua_pushnumber(L, g_start_position[ch->GetEmpire()][1] / 100);
  158. return 3;
  159. }
  160.  
  161. int pc_warp(lua_State * L)
  162. {
  163. LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
  164.  
  165. if (!lua_isnumber(L, 1) || !lua_isnumber(L, 2))
  166. {
  167. lua_pushboolean(L, false);
  168. return 1;
  169. }
  170.  
  171. long map_index = 0;
  172.  
  173. if (lua_isnumber(L, 3))
  174. map_index = (int) lua_tonumber(L,3);
  175.  
  176. //PREVENT_HACK
  177. if ( ch->IsHack() )
  178. {
  179. lua_pushboolean(L, false);
  180. return 1;
  181. }
  182. //END_PREVENT_HACK
  183.  
  184. if ( test_server )
  185. ch->ChatPacket( CHAT_TYPE_INFO, "pc_warp %d %d %d",(int)lua_tonumber(L,1),
  186. (int)lua_tonumber(L,2),map_index );
  187. ch->WarpSet((int)lua_tonumber(L, 1), (int)lua_tonumber(L, 2), map_index);
  188.  
  189. lua_pushboolean(L, true);
  190.  
  191. return 1;
  192. }
  193.  
  194. int pc_warp_local(lua_State * L)
  195. {
  196. if (!lua_isnumber(L, 1))
  197. {
  198. sys_err("no map index argument");
  199. return 0;
  200. }
  201.  
  202. if (!lua_isnumber(L, 2) || !lua_isnumber(L, 3))
  203. {
  204. sys_err("no coodinate argument");
  205. return 0;
  206. }
  207.  
  208. long lMapIndex = (long) lua_tonumber(L, 1);
  209. const TMapRegion * region = SECTREE_MANAGER::instance().GetMapRegion(lMapIndex);
  210.  
  211. if (!region)
  212. {
  213. sys_err("invalid map index %d", lMapIndex);
  214. return 0;
  215. }
  216.  
  217. int x = (int) lua_tonumber(L, 2);
  218. int y = (int) lua_tonumber(L, 3);
  219.  
  220. if (x > region->ex - region->sx)
  221. {
  222. sys_err("x coordinate overflow max: %d input: %d", region->ex - region->sx, x);
  223. return 0;
  224. }
  225.  
  226. if (y > region->ey - region->sy)
  227. {
  228. sys_err("y coordinate overflow max: %d input: %d", region->ey - region->sy, y);
  229. return 0;
  230. }
  231.  
  232. /*
  233. int iPulse = thecore_pulse();
  234. if ( pkChr->GetExchange() || pkChr->GetMyShop() || pkChr->GetShopOwner() || pkChr->IsOpenSafebox() )
  235. {
  236. pkChr->ChatPacket( CHAT_TYPE_INFO, LC_TEXT("°Ĺ·ˇĂ˘,â°í µîŔ» ż¬ »óĹÂżˇĽ­´Â ´Ů¸Ą°÷Ŕ¸·Î Ŕ̵żÇŇĽö ľř˝Ŕ´Ď´Ů" ));
  237.  
  238. return;
  239. }
  240. //PREVENT_PORTAL_AFTER_EXCHANGE
  241. //±łČŻ ČÄ ˝Ă°ŁĂĽĹ©
  242. if ( iPulse - pkChr->GetExchangeTime() < PASSES_PER_SEC(60) )
  243. {
  244. pkChr->ChatPacket( CHAT_TYPE_INFO, LC_TEXT("°Ĺ·ˇ ČÄ 1şĐ ŔĚł»żˇ´Â ´Ů¸ĄÁöżŞŔ¸·Î Ŕ̵ż ÇŇ Ľö ľř˝Ŕ´Ď´Ů." ) );
  245. return;
  246. }
  247. //END_PREVENT_PORTAL_AFTER_EXCHANGE
  248. //PREVENT_ITEM_COPY
  249. {
  250. if ( iPulse - pkChr->GetMyShopTime() < PASSES_PER_SEC(60) )
  251. {
  252. pkChr->ChatPacket( CHAT_TYPE_INFO, LC_TEXT("°Ĺ·ˇ ČÄ 1şĐ ŔĚł»żˇ´Â ´Ů¸ĄÁöżŞŔ¸·Î Ŕ̵ż ÇŇ Ľö ľř˝Ŕ´Ď´Ů." ) );
  253. return;
  254. }
  255.  
  256. }
  257. //END_PREVENT_ITEM_COPY
  258. */
  259.  
  260. CQuestManager::instance().GetCurrentCharacterPtr()->WarpSet(region->sx + x, region->sy + y);
  261. return 0;
  262. }
  263.  
  264. int pc_warp_exit(lua_State * L)
  265. {
  266. CQuestManager::instance().GetCurrentCharacterPtr()->ExitToSavedLocation();
  267. return 0;
  268. }
  269.  
  270. int pc_in_dungeon(lua_State * L)
  271. {
  272. LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
  273. lua_pushboolean(L, ch->GetDungeon()?1:0);
  274. return 1;
  275. }
  276.  
  277. int pc_hasguild(lua_State * L)
  278. {
  279. LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
  280. lua_pushboolean(L, ch->GetGuild() ? 1 : 0);
  281. return 1;
  282. }
  283.  
  284. int pc_getguild(lua_State * L)
  285. {
  286. LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
  287. lua_pushnumber(L, ch->GetGuild() ? ch->GetGuild()->GetID() : 0);
  288. return 1;
  289. }
  290.  
  291. int pc_isguildmaster(lua_State * L)
  292. {
  293. LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
  294. CGuild * g = ch->GetGuild();
  295.  
  296. if (g)
  297. lua_pushboolean(L, (ch->GetPlayerID() == g->GetMasterPID()));
  298. else
  299. lua_pushboolean(L, 0);
  300.  
  301. return 1;
  302. }
  303.  
  304. int pc_destroy_guild(lua_State * L)
  305. {
  306. LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
  307. CGuild * g = ch->GetGuild();
  308.  
  309. if (g)
  310. g->RequestDisband(ch->GetPlayerID());
  311.  
  312. return 0;
  313. }
  314.  
  315. int pc_remove_from_guild(lua_State* L)
  316. {
  317. LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
  318. CGuild * g = ch->GetGuild();
  319.  
  320. if (g)
  321. g->RequestRemoveMember(ch->GetPlayerID());
  322.  
  323. return 0;
  324. }
  325.  
  326. int pc_give_gold(lua_State* L)
  327. {
  328. LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
  329.  
  330. if (!lua_isnumber(L, 1))
  331. {
  332. sys_err("QUEST : wrong argument");
  333. return 0;
  334. }
  335.  
  336. int iAmount = (int) lua_tonumber(L, 1);
  337.  
  338. if (iAmount <= 0)
  339. {
  340. sys_err("QUEST : gold amount less then zero");
  341. return 0;
  342. }
  343.  
  344. DBManager::instance().SendMoneyLog(MONEY_LOG_QUEST, ch->GetPlayerID(), iAmount);
  345. ch->PointChange(POINT_GOLD, iAmount, true);
  346. return 0;
  347. }
  348.  
  349. int pc_warp_to_guild_war_observer_position(lua_State* L)
  350. {
  351. luaL_checknumber(L, 1);
  352. luaL_checknumber(L, 2);
  353.  
  354. DWORD gid1 = (DWORD)lua_tonumber(L, 1);
  355. DWORD gid2 = (DWORD)lua_tonumber(L, 2);
  356.  
  357. CGuild* g1 = CGuildManager::instance().FindGuild(gid1);
  358. CGuild* g2 = CGuildManager::instance().FindGuild(gid2);
  359.  
  360. if (!g1 || !g2)
  361. {
  362. luaL_error(L, "no such guild with id %d %d", gid1, gid2);
  363. }
  364.  
  365. PIXEL_POSITION pos;
  366.  
  367. DWORD dwMapIndex = g1->GetGuildWarMapIndex(gid2);
  368.  
  369. if (!CWarMapManager::instance().GetStartPosition(dwMapIndex, 2, pos))
  370. {
  371. luaL_error(L, "not under warp guild war between guild %d %d", gid1, gid2);
  372. return 0;
  373. }
  374.  
  375. LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
  376.  
  377. //PREVENT_HACK
  378. if ( ch->IsHack() )
  379. return 0;
  380. //END_PREVENT_HACK
  381.  
  382. ch->SetQuestFlag("war.is_war_member", 0);
  383. ch->SaveExitLocation();
  384. ch->WarpSet(pos.x, pos.y, dwMapIndex);
  385. return 0;
  386. }
  387.  
  388. int pc_give_item_from_special_item_group(lua_State* L)
  389. {
  390. luaL_checknumber(L, 1);
  391.  
  392. LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
  393.  
  394. DWORD dwGroupVnum = (DWORD) lua_tonumber(L,1);
  395.  
  396. std::vector <DWORD> dwVnums;
  397. std::vector <DWORD> dwCounts;
  398. std::vector <LPITEM> item_gets;
  399. int count = 0;
  400.  
  401. ch->GiveItemFromSpecialItemGroup(dwGroupVnum, dwVnums, dwCounts, item_gets, count);
  402.  
  403. for (int i = 0; i < count; i++)
  404. {
  405. if (!item_gets[i])
  406. {
  407. if (dwVnums[i] == 1)
  408. {
  409. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("µ· %d łÉŔ» ČąµćÇß˝Ŕ´Ď´Ů."), dwCounts[i]);
  410. }
  411. else if (dwVnums[i] == 2)
  412. {
  413. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("łŞą«żˇĽ­ şÎĹÍ ˝ĹşńÇŃ şűŔĚ łŞżÉ´Ď´Ů."));
  414. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("%dŔÇ °ćÇčġ¸¦ ČąµćÇß˝Ŕ´Ď´Ů."), dwCounts[i]);
  415. }
  416. }
  417. }
  418. return 0;
  419. }
  420.  
  421. int pc_enough_inventory(lua_State* L)
  422. {
  423. LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
  424. if (!lua_isnumber(L, 1))
  425. {
  426. lua_pushboolean(L, 0);
  427. return 1;
  428. }
  429.  
  430. DWORD item_vnum = (DWORD)lua_tonumber(L, 1);
  431. TItemTable * pTable = ITEM_MANAGER::instance().GetTable(item_vnum);
  432. if (!pTable)
  433. {
  434. lua_pushboolean(L, 0);
  435. return 1;
  436. }
  437.  
  438. bool bEnoughInventoryForItem = ch->GetEmptyInventory(pTable->bSize) != -1;
  439. lua_pushboolean(L, bEnoughInventoryForItem);
  440. return 1;
  441. }
  442.  
  443. int pc_give_item(lua_State* L)
  444. {
  445. PC* pPC = CQuestManager::instance().GetCurrentPC();
  446. LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
  447.  
  448. if (!lua_isstring(L, 1) || !(lua_isstring(L, 2)||lua_isnumber(L, 2)))
  449. {
  450. sys_err("QUEST : wrong argument");
  451. return 0;
  452. }
  453.  
  454. DWORD dwVnum;
  455.  
  456. if (lua_isnumber(L,2)) // ąřČŁŔΰćżě ąřČŁ·Î ÁŘ´Ů.
  457. dwVnum = (int) lua_tonumber(L, 2);
  458. else if (!ITEM_MANAGER::instance().GetVnum(lua_tostring(L, 2), dwVnum))
  459. {
  460. sys_err("QUEST Make item call error : wrong item name : %s", lua_tostring(L,1));
  461. return 0;
  462. }
  463.  
  464. int icount = 1;
  465.  
  466. if (lua_isnumber(L, 3) && lua_tonumber(L, 3) > 0)
  467. {
  468. icount = (int)rint(lua_tonumber(L, 3));
  469.  
  470. if (icount <= 0)
  471. {
  472. sys_err("QUEST Make item call error : wrong item count : %g", lua_tonumber(L, 2));
  473. return 0;
  474. }
  475. }
  476.  
  477. pPC->GiveItem(lua_tostring(L, 1), dwVnum, icount);
  478.  
  479. LogManager::instance().QuestRewardLog(pPC->GetCurrentQuestName().c_str(), ch->GetPlayerID(), ch->GetLevel(), dwVnum, icount);
  480. return 0;
  481. }
  482.  
  483. int pc_give_or_drop_item(lua_State* L)
  484. {
  485. LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
  486.  
  487. if (!lua_isstring(L, 1) && !lua_isnumber(L, 1))
  488. {
  489. sys_err("QUEST Make item call error : wrong argument");
  490. lua_pushnumber (L, 0);
  491. return 1;
  492. }
  493.  
  494. DWORD dwVnum;
  495.  
  496. if (lua_isnumber(L, 1)) // ąřČŁŔΰćżě ąřČŁ·Î ÁŘ´Ů.
  497. {
  498. dwVnum = (int) lua_tonumber(L, 1);
  499. }
  500. else if (!ITEM_MANAGER::instance().GetVnum(lua_tostring(L, 1), dwVnum))
  501. {
  502. sys_err("QUEST Make item call error : wrong item name : %s", lua_tostring(L,1));
  503. lua_pushnumber (L, 0);
  504.  
  505. return 1;
  506. }
  507.  
  508. int icount = 1;
  509. if (lua_isnumber(L,2) && lua_tonumber(L,2)>0)
  510. {
  511. icount = (int)rint(lua_tonumber(L,2));
  512. if (icount<=0)
  513. {
  514. sys_err("QUEST Make item call error : wrong item count : %g", lua_tonumber(L,2));
  515. lua_pushnumber (L, 0);
  516. return 1;
  517. }
  518. }
  519.  
  520. sys_log(0, "QUEST [REWARD] item %s to %s", lua_tostring(L, 1), ch->GetName());
  521.  
  522. PC* pPC = CQuestManager::instance().GetCurrentPC();
  523.  
  524. LogManager::instance().QuestRewardLog(pPC->GetCurrentQuestName().c_str(), ch->GetPlayerID(), ch->GetLevel(), dwVnum, icount);
  525.  
  526. LPITEM item = ch->AutoGiveItem(dwVnum, icount);
  527.  
  528. if ( dwVnum >= 80003 && dwVnum <= 80007 )
  529. {
  530. LogManager::instance().GoldBarLog(ch->GetPlayerID(), item->GetID(), QUEST, "quest: give_item2");
  531. }
  532.  
  533. if (NULL != item)
  534. lua_pushnumber (L, item->GetID());
  535. else
  536. lua_pushnumber (L, 0);
  537. return 1;
  538. }
  539.  
  540. int pc_give_or_drop_item_and_select(lua_State* L)
  541. {
  542. LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
  543.  
  544. if (!lua_isstring(L, 1) && !lua_isnumber(L, 1))
  545. {
  546. sys_err("QUEST Make item call error : wrong argument");
  547. return 0;
  548. }
  549.  
  550. DWORD dwVnum;
  551.  
  552. if (lua_isnumber(L, 1)) // ąřČŁŔΰćżě ąřČŁ·Î ÁŘ´Ů.
  553. {
  554. dwVnum = (int) lua_tonumber(L, 1);
  555. }
  556. else if (!ITEM_MANAGER::instance().GetVnum(lua_tostring(L, 1), dwVnum))
  557. {
  558. sys_err("QUEST Make item call error : wrong item name : %s", lua_tostring(L,1));
  559. return 0;
  560. }
  561.  
  562. int icount = 1;
  563. if (lua_isnumber(L,2) && lua_tonumber(L,2)>0)
  564. {
  565. icount = (int)rint(lua_tonumber(L,2));
  566. if (icount<=0)
  567. {
  568. sys_err("QUEST Make item call error : wrong item count : %g", lua_tonumber(L,2));
  569. return 0;
  570. }
  571. }
  572.  
  573. sys_log(0, "QUEST [REWARD] item %s to %s", lua_tostring(L, 1), ch->GetName());
  574.  
  575. PC* pPC = CQuestManager::instance().GetCurrentPC();
  576.  
  577. LogManager::instance().QuestRewardLog(pPC->GetCurrentQuestName().c_str(), ch->GetPlayerID(), ch->GetLevel(), dwVnum, icount);
  578.  
  579. LPITEM item = ch->AutoGiveItem(dwVnum, icount);
  580.  
  581. if (NULL != item)
  582. CQuestManager::Instance().SetCurrentItem(item);
  583.  
  584. if ( dwVnum >= 80003 && dwVnum <= 80007 )
  585. {
  586. LogManager::instance().GoldBarLog(ch->GetPlayerID(), item->GetID(), QUEST, "quest: give_item2");
  587. }
  588.  
  589. return 0;
  590. }
  591.  
  592. int pc_get_current_map_index(lua_State* L)
  593. {
  594. lua_pushnumber(L, CQuestManager::instance().GetCurrentCharacterPtr()->GetMapIndex());
  595. return 1;
  596. }
  597.  
  598. int pc_get_x(lua_State* L)
  599. {
  600. LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
  601. lua_pushnumber(L, ch->GetX()/100);
  602. return 1;
  603. }
  604.  
  605. int pc_get_y(lua_State* L)
  606. {
  607. LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
  608. lua_pushnumber(L, ch->GetY()/100);
  609. return 1;
  610. }
  611.  
  612. int pc_get_local_x(lua_State* L)
  613. {
  614. LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
  615. LPSECTREE_MAP pMap = SECTREE_MANAGER::instance().GetMap(ch->GetMapIndex());
  616.  
  617. if (pMap)
  618. lua_pushnumber(L, (ch->GetX() - pMap->m_setting.iBaseX) / 100);
  619. else
  620. lua_pushnumber(L, ch->GetX() / 100);
  621.  
  622. return 1;
  623. }
  624.  
  625. int pc_get_local_y(lua_State* L)
  626. {
  627. LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
  628. LPSECTREE_MAP pMap = SECTREE_MANAGER::instance().GetMap(ch->GetMapIndex());
  629.  
  630. if (pMap)
  631. lua_pushnumber(L, (ch->GetY() - pMap->m_setting.iBaseY) / 100);
  632. else
  633. lua_pushnumber(L, ch->GetY() / 100);
  634.  
  635. return 1;
  636. }
  637.  
  638. int pc_count_item(lua_State* L)
  639. {
  640. if (lua_isnumber(L, -1))
  641. lua_pushnumber(L,CQuestManager::instance().GetCurrentCharacterPtr()->CountSpecifyItem((DWORD)lua_tonumber(L, -1)));
  642. else if (lua_isstring(L, -1))
  643. {
  644. DWORD item_vnum;
  645.  
  646. if (!ITEM_MANAGER::instance().GetVnum(lua_tostring(L,1), item_vnum))
  647. {
  648. sys_err("QUEST count_item call error : wrong item name : %s", lua_tostring(L,1));
  649. lua_pushnumber(L, 0);
  650. }
  651. else
  652. {
  653. lua_pushnumber(L, CQuestManager::instance().GetCurrentCharacterPtr()->CountSpecifyItem(item_vnum));
  654. }
  655. }
  656. else
  657. lua_pushnumber(L, 0);
  658.  
  659. return 1;
  660. }
  661.  
  662. int pc_remove_item(lua_State* L)
  663. {
  664. if (lua_gettop(L) == 1)
  665. {
  666. DWORD item_vnum;
  667.  
  668. if (lua_isnumber(L,1))
  669. {
  670. item_vnum = (DWORD)lua_tonumber(L, 1);
  671. }
  672. else if (lua_isstring(L,1))
  673. {
  674. if (!ITEM_MANAGER::instance().GetVnum(lua_tostring(L,1), item_vnum))
  675. {
  676. sys_err("QUEST remove_item call error : wrong item name : %s", lua_tostring(L,1));
  677. return 0;
  678. }
  679. }
  680. else
  681. {
  682. sys_err("QUEST remove_item wrong argument");
  683. return 0;
  684. }
  685.  
  686. sys_log(0,"QUEST remove a item vnum %d of %s[%d]", item_vnum, CQuestManager::instance().GetCurrentCharacterPtr()->GetName(), CQuestManager::instance().GetCurrentCharacterPtr()->GetPlayerID());
  687. CQuestManager::instance().GetCurrentCharacterPtr()->RemoveSpecifyItem(item_vnum);
  688. }
  689. else if (lua_gettop(L) == 2)
  690. {
  691. DWORD item_vnum;
  692.  
  693. if (lua_isnumber(L, 1))
  694. {
  695. item_vnum = (DWORD)lua_tonumber(L, 1);
  696. }
  697. else if (lua_isstring(L, 1))
  698. {
  699. if (!ITEM_MANAGER::instance().GetVnum(lua_tostring(L,1), item_vnum))
  700. {
  701. sys_err("QUEST remove_item call error : wrong item name : %s", lua_tostring(L,1));
  702. return 0;
  703. }
  704. }
  705. else
  706. {
  707. sys_err("QUEST remove_item wrong argument");
  708. return 0;
  709. }
  710.  
  711. DWORD item_count = (DWORD) lua_tonumber(L, 2);
  712. sys_log(0, "QUEST remove items(vnum %d) count %d of %s[%d]",
  713. item_vnum,
  714. item_count,
  715. CQuestManager::instance().GetCurrentCharacterPtr()->GetName(),
  716. CQuestManager::instance().GetCurrentCharacterPtr()->GetPlayerID());
  717.  
  718. CQuestManager::instance().GetCurrentCharacterPtr()->RemoveSpecifyItem(item_vnum, item_count);
  719. }
  720. return 0;
  721. }
  722.  
  723. int pc_get_leadership(lua_State * L)
  724. {
  725. lua_pushnumber(L, CQuestManager::instance().GetCurrentCharacterPtr()->GetLeadershipSkillLevel());
  726. return 1;
  727. }
  728.  
  729. int pc_reset_point(lua_State * L)
  730. {
  731. CQuestManager::instance().GetCurrentCharacterPtr()->ResetPoint(CQuestManager::instance().GetCurrentCharacterPtr()->GetLevel());
  732. return 0;
  733. }
  734.  
  735. int pc_get_playtime(lua_State* L)
  736. {
  737. lua_pushnumber(L, CQuestManager::instance().GetCurrentCharacterPtr()->GetRealPoint(POINT_PLAYTIME));
  738. return 1;
  739. }
  740.  
  741. int pc_get_vid(lua_State* L)
  742. {
  743. lua_pushnumber(L, CQuestManager::instance().GetCurrentCharacterPtr()->GetVID());
  744. return 1;
  745. }
  746. int pc_get_name(lua_State* L)
  747. {
  748. lua_pushstring(L, CQuestManager::instance().GetCurrentCharacterPtr()->GetName());
  749. return 1;
  750. }
  751.  
  752. int pc_get_next_exp(lua_State* L)
  753. {
  754. lua_pushnumber(L, CQuestManager::instance().GetCurrentCharacterPtr()->GetNextExp());
  755. return 1;
  756. }
  757.  
  758. int pc_get_exp(lua_State* L)
  759. {
  760. lua_pushnumber(L, CQuestManager::instance().GetCurrentCharacterPtr()->GetExp());
  761. return 1;
  762. }
  763.  
  764. int pc_get_race(lua_State* L)
  765. {
  766. lua_pushnumber(L, CQuestManager::instance().GetCurrentCharacterPtr()->GetRaceNum());
  767. return 1;
  768. }
  769.  
  770. int pc_change_sex(lua_State* L)
  771. {
  772. lua_pushnumber(L, CQuestManager::instance().GetCurrentCharacterPtr()->ChangeSex());
  773. return 1;
  774. }
  775.  
  776. int pc_get_job(lua_State* L)
  777. {
  778. lua_pushnumber(L, CQuestManager::instance().GetCurrentCharacterPtr()->GetJob());
  779. return 1;
  780. }
  781.  
  782. int pc_get_max_sp(lua_State* L)
  783. {
  784. lua_pushnumber(L, CQuestManager::instance().GetCurrentCharacterPtr()->GetMaxSP());
  785. return 1;
  786. }
  787.  
  788. int pc_get_sp(lua_State * L)
  789. {
  790. lua_pushnumber(L, CQuestManager::instance().GetCurrentCharacterPtr()->GetSP());
  791. return 1;
  792. }
  793.  
  794. int pc_change_sp(lua_State * L)
  795. {
  796. if (!lua_isnumber(L, 1))
  797. {
  798. sys_err("invalid argument");
  799. lua_pushboolean(L, 0);
  800. return 1;
  801. }
  802.  
  803. long val = (long) lua_tonumber(L, 1);
  804.  
  805. if (val == 0)
  806. {
  807. lua_pushboolean(L, 0);
  808. return 1;
  809. }
  810.  
  811. LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
  812.  
  813. if (val > 0) // Áő°ˇ˝ĂĹ°´Â °ÍŔ̹ǷΠą«Á¶°Ç Ľş°ř ¸®ĹĎ
  814. ch->PointChange(POINT_SP, val);
  815. else if (val < 0)
  816. {
  817. if (ch->GetSP() < -val)
  818. {
  819. lua_pushboolean(L, 0);
  820. return 1;
  821. }
  822.  
  823. ch->PointChange(POINT_SP, val);
  824. }
  825.  
  826. lua_pushboolean(L, 1);
  827. return 1;
  828. }
  829.  
  830. int pc_get_max_hp(lua_State * L)
  831. {
  832. lua_pushnumber(L, CQuestManager::instance().GetCurrentCharacterPtr()->GetMaxHP());
  833. return 1;
  834. }
  835.  
  836. int pc_get_hp(lua_State * L)
  837. {
  838. lua_pushnumber(L, CQuestManager::instance().GetCurrentCharacterPtr()->GetHP());
  839. return 1;
  840. }
  841.  
  842. int pc_get_level(lua_State * L)
  843. {
  844. lua_pushnumber(L, CQuestManager::instance().GetCurrentCharacterPtr()->GetLevel());
  845. return 1;
  846. }
  847.  
  848. int pc_set_level(lua_State * L)
  849. {
  850. if (!lua_isnumber(L, 1))
  851. {
  852. sys_err("invalid argument");
  853. return 0;
  854. }
  855. else
  856. {
  857. int newLevel = lua_tonumber(L, 1);
  858. LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
  859.  
  860.  
  861. sys_log(0,"QUEST [LEVEL] %s jumpint to level %d", ch->GetName(), (int)rint(lua_tonumber(L,1)));
  862.  
  863. PC* pPC = CQuestManager::instance().GetCurrentPC();
  864. LogManager::instance().QuestRewardLog(pPC->GetCurrentQuestName().c_str(), ch->GetPlayerID(), ch->GetLevel(), newLevel, 0);
  865.  
  866. //Ć÷ŔÎĆ® : ˝şĹł, Ľ­şę˝şĹł, ˝şĹČ
  867. ch->PointChange(POINT_SKILL, newLevel - ch->GetLevel());
  868. ch->PointChange(POINT_SUB_SKILL, newLevel < 10 ? 0 : newLevel - MAX(ch->GetLevel(), 9));
  869. ch->PointChange(POINT_STAT, ((MINMAX(1, newLevel, 90) - ch->GetLevel()) * 3) + ch->GetPoint(POINT_LEVEL_STEP));
  870. //·ąş§
  871. ch->PointChange(POINT_LEVEL, newLevel - ch->GetLevel());
  872. //HP, SP
  873. ch->SetRandomHP((newLevel - 1) * number(JobInitialPoints[ch->GetJob()].hp_per_lv_begin, JobInitialPoints[ch->GetJob()].hp_per_lv_end));
  874. ch->SetRandomSP((newLevel - 1) * number(JobInitialPoints[ch->GetJob()].sp_per_lv_begin, JobInitialPoints[ch->GetJob()].sp_per_lv_end));
  875.  
  876.  
  877. // ȸşą
  878. ch->PointChange(POINT_HP, ch->GetMaxHP() - ch->GetHP());
  879. ch->PointChange(POINT_SP, ch->GetMaxSP() - ch->GetSP());
  880.  
  881. ch->ComputePoints();
  882. ch->PointsPacket();
  883. ch->SkillLevelPacket();
  884.  
  885. return 0;
  886. }
  887. }
  888.  
  889. int pc_get_weapon(lua_State * L)
  890. {
  891. LPITEM item = CQuestManager::instance().GetCurrentCharacterPtr()->GetWear(WEAR_WEAPON);
  892.  
  893. if (!item)
  894. lua_pushnumber(L, 0);
  895. else
  896. lua_pushnumber(L, item->GetVnum());
  897.  
  898. return 1;
  899. }
  900.  
  901. int pc_get_armor(lua_State * L)
  902. {
  903. LPITEM item = CQuestManager::instance().GetCurrentCharacterPtr()->GetWear(WEAR_BODY);
  904.  
  905. if (!item)
  906. lua_pushnumber(L, 0);
  907. else
  908. lua_pushnumber(L, item->GetVnum());
  909.  
  910. return 1;
  911. }
  912.  
  913. int pc_get_wear(lua_State * L)
  914. {
  915. if (!lua_isnumber(L, 1))
  916. {
  917. sys_err("QUEST wrong set flag");
  918. return 0;
  919. }
  920.  
  921. BYTE bCell = (BYTE)lua_tonumber(L, 1);
  922.  
  923. LPITEM item = CQuestManager::instance().GetCurrentCharacterPtr()->GetWear(bCell);
  924.  
  925.  
  926. if (!item)
  927. lua_pushnil(L);
  928. else
  929. lua_pushnumber(L, item->GetVnum());
  930.  
  931. return 1;
  932. }
  933.  
  934. int pc_get_money(lua_State * L)
  935. {
  936. lua_pushnumber(L, CQuestManager::instance().GetCurrentCharacterPtr()->GetGold());
  937. return 1;
  938. }
  939.  
  940. // 20050725.myevan.ŔşµĐŔÇ ¸ÁĹä »çżëÁß ČĄĽ® Ľö·Ă˝Ă Ľ±ľÇġ°ˇ µÎąč ĽŇ¸đµÇ´Â ąö±×°ˇ ąß»ýÇŘ
  941. // ˝ÇÁ¦ Ľ±ľÇġ¸¦ ŔĚżëÇŘ °č»ęŔ» ÇĎ°Ô ÇŃ´Ů.
  942. int pc_get_real_alignment(lua_State* L)
  943. {
  944. lua_pushnumber(L, CQuestManager::instance().GetCurrentCharacterPtr()->GetRealAlignment()/10);
  945. return 1;
  946. }
  947.  
  948. int pc_get_alignment(lua_State* L)
  949. {
  950. lua_pushnumber(L, CQuestManager::instance().GetCurrentCharacterPtr()->GetAlignment()/10);
  951. return 1;
  952. }
  953.  
  954. int pc_change_alignment(lua_State * L)
  955. {
  956. int alignment = (int)(lua_tonumber(L, 1)*10);
  957. LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
  958.  
  959. ch->UpdateAlignment(alignment);
  960. return 0;
  961. }
  962.  
  963. int pc_change_money(lua_State * L)
  964. {
  965. int gold = (int)lua_tonumber(L, -1);
  966.  
  967. LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
  968.  
  969. if (gold + ch->GetGold() < 0)
  970. sys_err("QUEST wrong ChangeGold %d (now %d)", gold, ch->GetGold());
  971. else
  972. {
  973. DBManager::instance().SendMoneyLog(MONEY_LOG_QUEST, ch->GetPlayerID(), gold);
  974. ch->PointChange(POINT_GOLD, gold, true);
  975. }
  976.  
  977. return 0;
  978. }
  979.  
  980. int pc_set_another_quest_flag(lua_State* L)
  981. {
  982. if (!lua_isstring(L, 1) || !lua_isstring(L, 2) || !lua_isnumber(L, 3))
  983. {
  984. sys_err("QUEST wrong set flag");
  985. return 0;
  986. }
  987. else
  988. {
  989. const char * sz = lua_tostring(L, 1);
  990. const char * sz2 = lua_tostring(L, 2);
  991. CQuestManager & q = CQuestManager::Instance();
  992. PC * pPC = q.GetCurrentPC();
  993. pPC->SetFlag(string(sz)+"."+sz2, int(rint(lua_tonumber(L,3))));
  994. return 0;
  995. }
  996. }
  997.  
  998. int pc_get_another_quest_flag(lua_State* L)
  999. {
  1000. if (!lua_isstring(L,1) || !lua_isstring(L,2))
  1001. {
  1002. sys_err("QUEST wrong get flag");
  1003. return 0;
  1004. }
  1005. else
  1006. {
  1007. const char* sz = lua_tostring(L,1);
  1008. const char* sz2 = lua_tostring(L,2);
  1009. CQuestManager& q = CQuestManager::Instance();
  1010. PC* pPC = q.GetCurrentPC();
  1011. if (!pPC)
  1012. {
  1013. return 0;
  1014. }
  1015. lua_pushnumber(L,pPC->GetFlag(string(sz)+"."+sz2));
  1016. return 1;
  1017. }
  1018. }
  1019.  
  1020. int pc_get_flag(lua_State* L)
  1021. {
  1022. if (!lua_isstring(L,-1))
  1023. {
  1024. sys_err("QUEST wrong get flag");
  1025. return 0;
  1026. }
  1027. else
  1028. {
  1029. const char* sz = lua_tostring(L,-1);
  1030. CQuestManager& q = CQuestManager::Instance();
  1031. PC* pPC = q.GetCurrentPC();
  1032. lua_pushnumber(L,pPC->GetFlag(sz));
  1033. return 1;
  1034. }
  1035. }
  1036.  
  1037. int pc_get_quest_flag(lua_State* L)
  1038. {
  1039. if (!lua_isstring(L,-1))
  1040. {
  1041. sys_err("QUEST wrong get flag");
  1042. return 0;
  1043. }
  1044. else
  1045. {
  1046. const char* sz = lua_tostring(L,-1);
  1047. CQuestManager& q = CQuestManager::Instance();
  1048. PC* pPC = q.GetCurrentPC();
  1049. lua_pushnumber(L,pPC->GetFlag(pPC->GetCurrentQuestName() + "."+sz));
  1050. if ( test_server )
  1051. sys_log( 0 ,"GetQF ( %s . %s )", pPC->GetCurrentQuestName().c_str(), sz );
  1052. }
  1053. return 1;
  1054. }
  1055.  
  1056. int pc_set_flag(lua_State* L)
  1057. {
  1058. if (!lua_isstring(L,1) || !lua_isnumber(L,2))
  1059. {
  1060. sys_err("QUEST wrong set flag");
  1061. }
  1062. else
  1063. {
  1064. const char* sz = lua_tostring(L,1);
  1065. CQuestManager& q = CQuestManager::Instance();
  1066. PC* pPC = q.GetCurrentPC();
  1067. pPC->SetFlag(sz, int(rint(lua_tonumber(L,2))));
  1068. }
  1069. return 0;
  1070. }
  1071.  
  1072. int pc_set_quest_flag(lua_State* L)
  1073. {
  1074. if (!lua_isstring(L,1) || !lua_isnumber(L,2))
  1075. {
  1076. sys_err("QUEST wrong set flag");
  1077. }
  1078. else
  1079. {
  1080. const char* sz = lua_tostring(L,1);
  1081. CQuestManager& q = CQuestManager::Instance();
  1082. PC* pPC = q.GetCurrentPC();
  1083. pPC->SetFlag(pPC->GetCurrentQuestName()+"."+sz, int(rint(lua_tonumber(L,2))));
  1084. }
  1085. return 0;
  1086. }
  1087.  
  1088. int pc_del_quest_flag(lua_State *L)
  1089. {
  1090. if (!lua_isstring(L, 1))
  1091. {
  1092. sys_err("argument error");
  1093. return 0;
  1094. }
  1095.  
  1096. const char * sz = lua_tostring(L, 1);
  1097. PC * pPC = CQuestManager::instance().GetCurrentPC();
  1098. pPC->DeleteFlag(pPC->GetCurrentQuestName()+"."+sz);
  1099. return 0;
  1100. }
  1101.  
  1102. int pc_give_exp2(lua_State* L)
  1103. {
  1104. CQuestManager& q = CQuestManager::instance();
  1105. LPCHARACTER ch = q.GetCurrentCharacterPtr();
  1106. if (!lua_isnumber(L,1))
  1107. return 0;
  1108.  
  1109. sys_log(0,"QUEST [REWARD] %s give exp2 %d", ch->GetName(), (int)rint(lua_tonumber(L,1)));
  1110.  
  1111. DWORD exp = (DWORD)rint(lua_tonumber(L,1));
  1112.  
  1113. PC* pPC = CQuestManager::instance().GetCurrentPC();
  1114. LogManager::instance().QuestRewardLog(pPC->GetCurrentQuestName().c_str(), ch->GetPlayerID(), ch->GetLevel(), exp, 0);
  1115. ch->PointChange(POINT_EXP, exp);
  1116. return 0;
  1117. }
  1118.  
  1119. int pc_give_exp(lua_State* L)
  1120. {
  1121. if (!lua_isstring(L,1) || !lua_isnumber(L,2))
  1122. return 0;
  1123.  
  1124. CQuestManager& q = CQuestManager::instance();
  1125. LPCHARACTER ch = q.GetCurrentCharacterPtr();
  1126.  
  1127. sys_log(0,"QUEST [REWARD] %s give exp %s %d", ch->GetName(), lua_tostring(L,1), (int)rint(lua_tonumber(L,2)));
  1128.  
  1129. DWORD exp = (DWORD)rint(lua_tonumber(L,2));
  1130.  
  1131. PC* pPC = CQuestManager::instance().GetCurrentPC();
  1132.  
  1133. LogManager::instance().QuestRewardLog(pPC->GetCurrentQuestName().c_str(), ch->GetPlayerID(), ch->GetLevel(), exp, 0);
  1134.  
  1135. pPC->GiveExp(lua_tostring(L,1), exp);
  1136. return 0;
  1137. }
  1138.  
  1139. int pc_give_exp_perc(lua_State* L)
  1140. {
  1141. CQuestManager & q = CQuestManager::instance();
  1142. LPCHARACTER ch = q.GetCurrentCharacterPtr();
  1143.  
  1144. if (!ch || !lua_isstring(L, 1) || !lua_isnumber(L, 2) || !lua_isnumber(L, 3))
  1145. return 0;
  1146.  
  1147. int lev = (int)rint(lua_tonumber(L,2));
  1148. double proc = (lua_tonumber(L,3));
  1149.  
  1150. sys_log(0, "QUEST [REWARD] %s give exp %s lev %d percent %g%%", ch->GetName(), lua_tostring(L, 1), lev, proc);
  1151.  
  1152. DWORD exp = (DWORD)((exp_table[MINMAX(0, lev, PLAYER_EXP_TABLE_MAX)] * proc) / 100);
  1153. PC * pPC = CQuestManager::instance().GetCurrentPC();
  1154.  
  1155. LogManager::instance().QuestRewardLog(pPC->GetCurrentQuestName().c_str(), ch->GetPlayerID(), ch->GetLevel(), exp, 0);
  1156.  
  1157. pPC->GiveExp(lua_tostring(L, 1), exp);
  1158. return 0;
  1159. }
  1160.  
  1161. int pc_get_empire(lua_State* L)
  1162. {
  1163. lua_pushnumber(L, CQuestManager::instance().GetCurrentCharacterPtr()->GetEmpire());
  1164. return 1;
  1165. }
  1166.  
  1167. int pc_get_part(lua_State* L)
  1168. {
  1169. CQuestManager& q = CQuestManager::instance();
  1170. LPCHARACTER ch = q.GetCurrentCharacterPtr();
  1171. if (!lua_isnumber(L,1))
  1172. {
  1173. lua_pushnumber(L, 0);
  1174. return 1;
  1175. }
  1176. int part_idx = (int)lua_tonumber(L, 1);
  1177. lua_pushnumber(L, ch->GetPart(part_idx));
  1178. return 1;
  1179. }
  1180.  
  1181. int pc_set_part(lua_State* L)
  1182. {
  1183. CQuestManager& q = CQuestManager::instance();
  1184. LPCHARACTER ch = q.GetCurrentCharacterPtr();
  1185. if (!lua_isnumber(L,1) || !lua_isnumber(L,2))
  1186. {
  1187. return 0;
  1188. }
  1189. int part_idx = (int)lua_tonumber(L, 1);
  1190. int part_value = (int)lua_tonumber(L, 2);
  1191. ch->SetPart(part_idx, part_value);
  1192. ch->UpdatePacket();
  1193. return 0;
  1194. }
  1195.  
  1196. int pc_get_skillgroup(lua_State* L)
  1197. {
  1198. lua_pushnumber(L, CQuestManager::instance().GetCurrentCharacterPtr()->GetSkillGroup());
  1199. return 1;
  1200. }
  1201.  
  1202. int pc_set_skillgroup(lua_State* L)
  1203. {
  1204. if (!lua_isnumber(L, 1))
  1205. sys_err("QUEST wrong skillgroup number");
  1206. else
  1207. {
  1208. CQuestManager & q = CQuestManager::Instance();
  1209. LPCHARACTER ch = q.GetCurrentCharacterPtr();
  1210.  
  1211. ch->SetSkillGroup((BYTE) rint(lua_tonumber(L, 1)));
  1212. }
  1213. return 0;
  1214. }
  1215.  
  1216. int pc_is_polymorphed(lua_State* L)
  1217. {
  1218. LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
  1219. lua_pushboolean(L, ch->IsPolymorphed());
  1220. return 1;
  1221. }
  1222.  
  1223. int pc_remove_polymorph(lua_State* L)
  1224. {
  1225. LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
  1226. ch->RemoveAffect(AFFECT_POLYMORPH);
  1227. ch->SetPolymorph(0);
  1228. return 0;
  1229. }
  1230.  
  1231. int pc_polymorph(lua_State* L)
  1232. {
  1233. LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
  1234. DWORD dwVnum = (DWORD) lua_tonumber(L, 1);
  1235. int iDuration = (int) lua_tonumber(L, 2);
  1236. ch->AddAffect(AFFECT_POLYMORPH, POINT_POLYMORPH, dwVnum, AFF_POLYMORPH, iDuration, 0, true);
  1237. return 0;
  1238. }
  1239.  
  1240. int pc_is_mount(lua_State* L)
  1241. {
  1242. LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
  1243. lua_pushboolean(L, ch->GetMountVnum());
  1244. return 1;
  1245. }
  1246.  
  1247. int pc_mount(lua_State* L)
  1248. {
  1249. if (!lua_isnumber(L, 1))
  1250. return 0;
  1251.  
  1252. int length = 60;
  1253.  
  1254. if (lua_isnumber(L, 2))
  1255. length = (int)lua_tonumber(L, 2);
  1256.  
  1257. DWORD mount_vnum = (DWORD)lua_tonumber(L, 1);
  1258.  
  1259. if (length < 0)
  1260. length = 60;
  1261.  
  1262. LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
  1263.  
  1264. ch->RemoveAffect(AFFECT_MOUNT);
  1265. ch->RemoveAffect(AFFECT_MOUNT_BONUS);
  1266.  
  1267. // ¸»ŔĚ ĽŇČŻµÇľî µű¶ó´Ů´Ď´Â »óŶó¸é ¸»şÎĹÍ ľřľÚ
  1268. if (ch->GetHorse())
  1269. ch->HorseSummon(false);
  1270.  
  1271. if (mount_vnum)
  1272. {
  1273. ch->AddAffect(AFFECT_MOUNT, POINT_MOUNT, mount_vnum, AFF_NONE, length, 0, true);
  1274. switch (mount_vnum)
  1275. {
  1276. case 20201:
  1277. case 20202:
  1278. case 20203:
  1279. case 20204:
  1280. case 20213:
  1281. case 20216:
  1282. ch->AddAffect(AFFECT_MOUNT, POINT_MOV_SPEED, 30, AFF_NONE, length, 0, true, true);
  1283. break;
  1284.  
  1285. case 20205:
  1286. case 20206:
  1287. case 20207:
  1288. case 20208:
  1289. case 20214:
  1290. case 20217:
  1291. ch->AddAffect(AFFECT_MOUNT, POINT_MOV_SPEED, 40, AFF_NONE, length, 0, true, true);
  1292. break;
  1293.  
  1294. case 20209:
  1295. case 20210:
  1296. case 20211:
  1297. case 20212:
  1298. case 20215:
  1299. case 20218:
  1300. ch->AddAffect(AFFECT_MOUNT, POINT_MOV_SPEED, 50, AFF_NONE, length, 0, true, true);
  1301. break;
  1302.  
  1303. }
  1304. }
  1305.  
  1306. return 0;
  1307. }
  1308.  
  1309. int pc_mount_bonus(lua_State* L)
  1310. {
  1311. BYTE applyOn = static_cast<BYTE>(lua_tonumber(L, 1));
  1312. long value = static_cast<long>(lua_tonumber(L, 2));
  1313. long duration = static_cast<long>(lua_tonumber(L, 3));
  1314.  
  1315. LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
  1316.  
  1317. if( NULL != ch )
  1318. {
  1319. ch->RemoveAffect(AFFECT_MOUNT_BONUS);
  1320. ch->AddAffect(AFFECT_MOUNT_BONUS, aApplyInfo[applyOn].bPointType, value, AFF_NONE, duration, 0, false);
  1321. }
  1322.  
  1323. return 0;
  1324. }
  1325.  
  1326. int pc_unmount(lua_State* L)
  1327. {
  1328. LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
  1329. ch->RemoveAffect(AFFECT_MOUNT);
  1330. ch->RemoveAffect(AFFECT_MOUNT_BONUS);
  1331. if (ch->IsHorseRiding())
  1332. ch->StopRiding();
  1333. return 0;
  1334. }
  1335.  
  1336. int pc_get_horse_level(lua_State* L)
  1337. {
  1338. LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
  1339. lua_pushnumber(L, ch->GetHorseLevel());
  1340. return 1;
  1341. }
  1342.  
  1343. int pc_get_horse_hp(lua_State* L)
  1344. {
  1345. LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
  1346. if (ch->GetHorseLevel())
  1347. lua_pushnumber(L, ch->GetHorseHealth());
  1348. else
  1349. lua_pushnumber(L, 0);
  1350.  
  1351. return 1;
  1352. }
  1353.  
  1354. int pc_get_horse_stamina(lua_State* L)
  1355. {
  1356. LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
  1357. if (ch->GetHorseLevel())
  1358. lua_pushnumber(L, ch->GetHorseStamina());
  1359. else
  1360. lua_pushnumber(L, 0);
  1361.  
  1362. return 1;
  1363. }
  1364.  
  1365. int pc_is_horse_alive(lua_State* L)
  1366. {
  1367. LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
  1368. lua_pushboolean(L, ch->GetHorseLevel() > 0 && ch->GetHorseHealth()>0);
  1369. return 1;
  1370. }
  1371.  
  1372. int pc_revive_horse(lua_State* L)
  1373. {
  1374. LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
  1375. ch->ReviveHorse();
  1376. return 0;
  1377. }
  1378.  
  1379. int pc_have_map_scroll(lua_State* L)
  1380. {
  1381. if (!lua_isstring(L, 1))
  1382. {
  1383. lua_pushboolean(L, 0);
  1384. return 1;
  1385. }
  1386.  
  1387. const char * szMapName = lua_tostring(L, 1);
  1388. const TMapRegion * region = SECTREE_MANAGER::instance().FindRegionByPartialName(szMapName);
  1389.  
  1390. if (!region)
  1391. {
  1392. lua_pushboolean(L, 0);
  1393. return 1;
  1394. }
  1395.  
  1396. LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
  1397.  
  1398. bool bFind = false;
  1399. for (int iCell = 0; iCell < INVENTORY_MAX_NUM; iCell++)
  1400. {
  1401. LPITEM item = ch->GetInventoryItem(iCell);
  1402. if (!item)
  1403. continue;
  1404.  
  1405. if (item->GetType() == ITEM_USE &&
  1406. item->GetSubType() == USE_TALISMAN &&
  1407. (item->GetValue(0) == 1 || item->GetValue(0) == 2))
  1408. {
  1409. int x = item->GetSocket(0);
  1410. int y = item->GetSocket(1);
  1411. //if ((x-item_x)*(x-item_x)+(y-item_y)*(y-item_y)<r*r)
  1412. if (region->sx <=x && region->sy <= y && x <= region->ex && y <= region->ey)
  1413. {
  1414. bFind = true;
  1415. break;
  1416. }
  1417. }
  1418. }
  1419.  
  1420. lua_pushboolean(L, bFind);
  1421. return 1;
  1422. }
  1423.  
  1424. int pc_get_war_map(lua_State* L)
  1425. {
  1426. LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
  1427. lua_pushnumber(L, ch->GetWarMap() ? ch->GetWarMap()->GetMapIndex() : 0);
  1428. return 1;
  1429. }
  1430.  
  1431. int pc_have_pos_scroll(lua_State* L)
  1432. {
  1433. LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
  1434.  
  1435. if (!lua_isnumber(L,1) || !lua_isnumber(L,2))
  1436. {
  1437. sys_err("invalid x y position");
  1438. lua_pushboolean(L, 0);
  1439. return 1;
  1440. }
  1441.  
  1442. if (!lua_isnumber(L,2))
  1443. {
  1444. sys_err("invalid radius");
  1445. lua_pushboolean(L, 0);
  1446. return 1;
  1447. }
  1448.  
  1449. int x = (int)lua_tonumber(L, 1);
  1450. int y = (int)lua_tonumber(L, 2);
  1451. float r = (float)lua_tonumber(L, 3);
  1452.  
  1453. bool bFind = false;
  1454. for (int iCell = 0; iCell < INVENTORY_MAX_NUM; iCell++)
  1455. {
  1456. LPITEM item = ch->GetInventoryItem(iCell);
  1457. if (!item)
  1458. continue;
  1459.  
  1460. if (item->GetType() == ITEM_USE &&
  1461. item->GetSubType() == USE_TALISMAN &&
  1462. (item->GetValue(0) == 1 || item->GetValue(0) == 2))
  1463. {
  1464. int item_x = item->GetSocket(0);
  1465. int item_y = item->GetSocket(1);
  1466. if ((x-item_x)*(x-item_x)+(y-item_y)*(y-item_y)<r*r)
  1467. {
  1468. bFind = true;
  1469. break;
  1470. }
  1471. }
  1472. }
  1473.  
  1474. lua_pushboolean(L, bFind);
  1475. return 1;
  1476. }
  1477.  
  1478. int pc_get_equip_refine_level(lua_State* L)
  1479. {
  1480. LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
  1481. int cell = (int) lua_tonumber(L, 1);
  1482. if (cell < 0 || cell >= WEAR_MAX_NUM)
  1483. {
  1484. sys_err("invalid wear position %d", cell);
  1485. lua_pushnumber(L, 0);
  1486. return 1;
  1487. }
  1488.  
  1489. LPITEM item = ch->GetWear(cell);
  1490. if (!item)
  1491. {
  1492. lua_pushnumber(L, 0);
  1493. return 1;
  1494. }
  1495.  
  1496. lua_pushnumber(L, item->GetRefineLevel());
  1497. return 1;
  1498. }
  1499.  
  1500. int pc_refine_equip(lua_State* L)
  1501. {
  1502. LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
  1503. if (!lua_isnumber(L, 1) || !lua_isnumber(L, 2))
  1504. {
  1505. sys_err("invalid argument");
  1506. lua_pushboolean(L, 0);
  1507. return 1;
  1508. }
  1509.  
  1510. int cell = (int) lua_tonumber(L, 1);
  1511. int level_limit = (int) lua_tonumber(L, 2);
  1512. int pct = lua_isnumber(L, 3) ? (int)lua_tonumber(L, 3) : 100;
  1513.  
  1514. LPITEM item = ch->GetWear(cell);
  1515. if (!item)
  1516. {
  1517. lua_pushboolean(L, 0);
  1518. return 1;
  1519. }
  1520.  
  1521. if (item->GetRefinedVnum() == 0)
  1522. {
  1523. lua_pushboolean(L, 0);
  1524. return 1;
  1525. }
  1526.  
  1527. if (item->GetRefineLevel()>level_limit)
  1528. {
  1529. lua_pushboolean(L, 0);
  1530. return 1;
  1531. }
  1532.  
  1533. if (pct == 100 || number(1, 100) <= pct)
  1534. {
  1535. // °ł·® Ľş°ř
  1536. lua_pushboolean(L, 1);
  1537.  
  1538. LPITEM pkNewItem = ITEM_MANAGER::instance().CreateItem(item->GetRefinedVnum(), 1, 0, false);
  1539.  
  1540. if (pkNewItem)
  1541. {
  1542. for (int i = 0; i < ITEM_SOCKET_MAX_NUM; ++i)
  1543. if (!item->GetSocket(i))
  1544. break;
  1545. else
  1546. pkNewItem->SetSocket(i, 1);
  1547.  
  1548. int set = 0;
  1549. for (int i=0; i<ITEM_SOCKET_MAX_NUM; i++)
  1550. {
  1551. long socket = item->GetSocket(i);
  1552. if (socket > 2 && socket != 28960)
  1553. {
  1554. pkNewItem->SetSocket(set++, socket);
  1555. }
  1556. }
  1557.  
  1558. item->CopyAttributeTo(pkNewItem);
  1559.  
  1560. ITEM_MANAGER::instance().RemoveItem(item, "REMOVE (REFINE SUCCESS)");
  1561.  
  1562. // some tuits need here -_- pkNewItem->AddToCharacter(this, bCell);
  1563. pkNewItem->EquipTo(ch, cell);
  1564.  
  1565. ITEM_MANAGER::instance().FlushDelayedSave(pkNewItem);
  1566.  
  1567. LogManager::instance().ItemLog(ch, pkNewItem, "REFINE SUCCESS (QUEST)", pkNewItem->GetName());
  1568. }
  1569. }
  1570. else
  1571. {
  1572. // °ł·® ˝ÇĆĐ
  1573. lua_pushboolean(L, 0);
  1574. }
  1575.  
  1576. return 1;
  1577. }
  1578.  
  1579. int pc_get_skill_level(lua_State * L)
  1580. {
  1581. if (!lua_isnumber(L, 1))
  1582. {
  1583. sys_err("invalid argument");
  1584. lua_pushnumber(L, 0);
  1585. return 1;
  1586. }
  1587.  
  1588. LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
  1589.  
  1590. DWORD dwVnum = (DWORD) lua_tonumber(L, 1);
  1591. lua_pushnumber(L, ch->GetSkillLevel(dwVnum));
  1592.  
  1593. return 1;
  1594. }
  1595.  
  1596. int pc_give_lotto(lua_State* L)
  1597. {
  1598. CQuestManager& q = CQuestManager::instance();
  1599. LPCHARACTER ch = q.GetCurrentCharacterPtr();
  1600.  
  1601. sys_log(0, "TRY GIVE LOTTO TO pid %u", ch->GetPlayerID());
  1602.  
  1603. DWORD * pdw = M2_NEW DWORD[3];
  1604.  
  1605. pdw[0] = 50001;
  1606. pdw[1] = 1;
  1607. pdw[2] = q.GetEventFlag("lotto_round");
  1608.  
  1609. // ĂßĂ·Ľ­´Â ĽŇÄĎŔ» ĽłÁ¤ÇŃ´Ů
  1610. DBManager::instance().ReturnQuery(QID_LOTTO, ch->GetPlayerID(), pdw,
  1611. "INSERT INTO lotto_list VALUES(0, 'server%s', %u, NOW())",
  1612. get_table_postfix(), ch->GetPlayerID());
  1613.  
  1614. return 0;
  1615. }
  1616.  
  1617. int pc_aggregate_monster(lua_State* L)
  1618. {
  1619. LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
  1620. ch->AggregateMonster();
  1621. return 0;
  1622. }
  1623.  
  1624. int pc_forget_my_attacker(lua_State* L)
  1625. {
  1626. LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
  1627. ch->ForgetMyAttacker();
  1628. return 0;
  1629. }
  1630.  
  1631. int pc_attract_ranger(lua_State* L)
  1632. {
  1633. LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
  1634. ch->AttractRanger();
  1635. return 0;
  1636. }
  1637.  
  1638. int pc_select_pid(lua_State* L)
  1639. {
  1640. DWORD pid = (DWORD) lua_tonumber(L, 1);
  1641.  
  1642. LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
  1643. LPCHARACTER new_ch = CHARACTER_MANAGER::instance().FindByPID(pid);
  1644.  
  1645. if (new_ch)
  1646. {
  1647. CQuestManager::instance().GetPC(new_ch->GetPlayerID());
  1648.  
  1649. lua_pushnumber(L, ch->GetPlayerID());
  1650. }
  1651. else
  1652. {
  1653. lua_pushnumber(L, 0);
  1654. }
  1655.  
  1656. return 1;
  1657. }
  1658.  
  1659. int pc_select_vid(lua_State* L)
  1660. {
  1661. DWORD vid = (DWORD) lua_tonumber(L, 1);
  1662.  
  1663. LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
  1664. LPCHARACTER new_ch = CHARACTER_MANAGER::instance().Find(vid);
  1665.  
  1666. if (new_ch)
  1667. {
  1668. CQuestManager::instance().GetPC(new_ch->GetPlayerID());
  1669.  
  1670. lua_pushnumber(L, (DWORD)ch->GetVID());
  1671. }
  1672. else
  1673. {
  1674. lua_pushnumber(L, 0);
  1675. }
  1676.  
  1677. return 1;
  1678. }
  1679.  
  1680. int pc_get_sex(lua_State* L)
  1681. {
  1682. LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
  1683. lua_pushnumber(L, GET_SEX(ch)); /* 0==MALE, 1==FEMALE */
  1684. return 1;
  1685. }
  1686.  
  1687. int pc_is_engaged(lua_State* L)
  1688. {
  1689. LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
  1690. lua_pushboolean(L, marriage::CManager::instance().IsEngaged(ch->GetPlayerID()));
  1691. return 1;
  1692. }
  1693.  
  1694. int pc_is_married(lua_State* L)
  1695. {
  1696. LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
  1697. lua_pushboolean(L, marriage::CManager::instance().IsMarried(ch->GetPlayerID()));
  1698. return 1;
  1699. }
  1700.  
  1701. int pc_is_engaged_or_married(lua_State* L)
  1702. {
  1703. LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
  1704. lua_pushboolean(L, marriage::CManager::instance().IsEngagedOrMarried(ch->GetPlayerID()));
  1705. return 1;
  1706. }
  1707.  
  1708. int pc_is_gm(lua_State* L)
  1709. {
  1710. LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
  1711. lua_pushboolean(L, ch->GetGMLevel() >= GM_HIGH_WIZARD);
  1712. return 1;
  1713. }
  1714.  
  1715. int pc_get_gm_level(lua_State* L)
  1716. {
  1717. LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
  1718. lua_pushnumber(L, ch->GetGMLevel());
  1719. return 1;
  1720. }
  1721.  
  1722. int pc_mining(lua_State* L)
  1723. {
  1724. LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
  1725. LPCHARACTER npc = CQuestManager::instance().GetCurrentNPCCharacterPtr();
  1726. ch->mining(npc);
  1727. return 0;
  1728. }
  1729.  
  1730. int pc_diamond_refine(lua_State* L)
  1731. {
  1732. if (!lua_isnumber(L, 1))
  1733. {
  1734. lua_pushboolean(L, 0);
  1735. return 1;
  1736. }
  1737.  
  1738. int cost = (int) lua_tonumber(L, 1);
  1739. int pct = (int)lua_tonumber(L, 2);
  1740.  
  1741. LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
  1742. LPCHARACTER npc = CQuestManager::instance().GetCurrentNPCCharacterPtr();
  1743. LPITEM item = CQuestManager::instance().GetCurrentItem();
  1744.  
  1745. if (item)
  1746. lua_pushboolean(L, mining::OreRefine(ch, npc, item, cost, pct, NULL));
  1747. else
  1748. lua_pushboolean(L, 0);
  1749.  
  1750. return 1;
  1751. }
  1752.  
  1753. int pc_ore_refine(lua_State* L)
  1754. {
  1755. if (!lua_isnumber(L, 1))
  1756. {
  1757. lua_pushboolean(L, 0);
  1758. return 1;
  1759. }
  1760.  
  1761. int cost = (int) lua_tonumber(L, 1);
  1762. int pct = (int)lua_tonumber(L, 2);
  1763. int metinstone_cell = (int)lua_tonumber(L, 3);
  1764.  
  1765. LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
  1766. LPCHARACTER npc = CQuestManager::instance().GetCurrentNPCCharacterPtr();
  1767. LPITEM item = CQuestManager::instance().GetCurrentItem();
  1768.  
  1769. LPITEM metinstone_item = ch->GetInventoryItem(metinstone_cell);
  1770.  
  1771. if (item && metinstone_item)
  1772. lua_pushboolean(L, mining::OreRefine(ch, npc, item, cost, pct, metinstone_item));
  1773. else
  1774. lua_pushboolean(L, 0);
  1775.  
  1776. return 1;
  1777. }
  1778.  
  1779. int pc_clear_skill(lua_State* L)
  1780. {
  1781. LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
  1782. if ( ch == NULL ) return 0;
  1783.  
  1784. ch->ClearSkill();
  1785.  
  1786. return 0;
  1787. }
  1788.  
  1789. int pc_clear_sub_skill(lua_State* L)
  1790. {
  1791. LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
  1792. if ( ch == NULL ) return 0;
  1793.  
  1794. ch->ClearSubSkill();
  1795.  
  1796. return 0;
  1797. }
  1798.  
  1799. int pc_set_skill_point(lua_State* L)
  1800. {
  1801. if (!lua_isnumber(L, 1))
  1802. {
  1803. return 0;
  1804. }
  1805.  
  1806. LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
  1807. int newPoint = (int) lua_tonumber(L, 1);
  1808.  
  1809. ch->SetRealPoint(POINT_SKILL, newPoint);
  1810. ch->SetPoint(POINT_SKILL, ch->GetRealPoint(POINT_SKILL));
  1811. ch->PointChange(POINT_SKILL, 0);
  1812. ch->ComputePoints();
  1813. ch->PointsPacket();
  1814.  
  1815. return 0;
  1816. }
  1817.  
  1818. // RESET_ONE_SKILL
  1819. int pc_clear_one_skill(lua_State* L)
  1820. {
  1821. int vnum = (int)lua_tonumber(L, 1);
  1822. sys_log(0, "%d skill clear", vnum);
  1823.  
  1824. LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
  1825. if ( ch == NULL )
  1826. {
  1827. sys_log(0, "skill clear fail");
  1828. lua_pushnumber(L, 0);
  1829. return 1;
  1830. }
  1831.  
  1832. sys_log(0, "%d skill clear", vnum);
  1833.  
  1834. ch->ResetOneSkill(vnum);
  1835.  
  1836. return 0;
  1837. }
  1838. // END_RESET_ONE_SKILL
  1839.  
  1840. int pc_is_clear_skill_group(lua_State* L)
  1841. {
  1842. LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
  1843.  
  1844. lua_pushboolean(L, ch->GetQuestFlag("skill_group_clear.clear") == 1);
  1845.  
  1846. return 1;
  1847. }
  1848.  
  1849. int pc_save_exit_location(lua_State* L)
  1850. {
  1851. LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
  1852.  
  1853. ch->SaveExitLocation();
  1854.  
  1855. return 0;
  1856. }
  1857.  
  1858. //ĹÚ·ąĆ÷Ć®
  1859. int pc_teleport ( lua_State * L )
  1860. {
  1861. LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
  1862. int x=0,y=0;
  1863. if ( lua_isnumber(L, 1) )
  1864. {
  1865. // ÁöżŞ¸í żöÇÁ
  1866. const int TOWN_NUM = 10;
  1867. struct warp_by_town_name
  1868. {
  1869. const char* name;
  1870. DWORD x;
  1871. DWORD y;
  1872. } ws[TOWN_NUM] =
  1873. {
  1874. {"żµľČŔľĽş", 4743, 9548},
  1875. {"ŔÓÁö°î", 3235, 9086},
  1876. {"ŔÚľçÇö", 3531, 8829},
  1877. {"Á¶ľČŔľĽş", 638, 1664},
  1878. {"˝Â·ć°î", 1745, 1909},
  1879. {"şąÁ¤Çö", 1455, 2400},
  1880. {"Ćňą«ŔľĽş", 9599, 2692},
  1881. {"ąć»ę°î", 8036, 2984},
  1882. {"ąÚ¶óÇö", 8639, 2460},
  1883. {"Ľ­ÇŃ»ę", 4350, 2143},
  1884. };
  1885. int idx = (int)lua_tonumber(L, 1);
  1886.  
  1887. x = ws[idx].x;
  1888. y = ws[idx].y;
  1889. goto teleport_area;
  1890. }
  1891.  
  1892. else
  1893. {
  1894. const char * arg1 = lua_tostring(L, 1);
  1895.  
  1896. LPCHARACTER tch = CHARACTER_MANAGER::instance().FindPC(arg1);
  1897.  
  1898. if (!tch)
  1899. {
  1900. const CCI* pkCCI = P2P_MANAGER::instance().Find(arg1);
  1901.  
  1902. if (pkCCI)
  1903. {
  1904. if (pkCCI->bChannel != g_bChannel)
  1905. {
  1906. ch->ChatPacket(CHAT_TYPE_INFO, "Target is in %d channel (my channel %d)", pkCCI->bChannel, g_bChannel);
  1907. }
  1908. else
  1909. {
  1910.  
  1911. PIXEL_POSITION pos;
  1912.  
  1913. if (!SECTREE_MANAGER::instance().GetCenterPositionOfMap(pkCCI->lMapIndex, pos))
  1914. {
  1915. ch->ChatPacket(CHAT_TYPE_INFO, "Cannot find map (index %d)", pkCCI->lMapIndex);
  1916. }
  1917. else
  1918. {
  1919. ch->ChatPacket(CHAT_TYPE_INFO, "You warp to ( %d, %d )", pos.x, pos.y);
  1920. ch->WarpSet(pos.x, pos.y);
  1921. lua_pushnumber(L, 1 );
  1922. }
  1923. }
  1924. }
  1925. else if (NULL == CHARACTER_MANAGER::instance().FindPC(arg1))
  1926. {
  1927. ch->ChatPacket(CHAT_TYPE_INFO, "There is no one by that name");
  1928. }
  1929.  
  1930. lua_pushnumber(L, 0 );
  1931.  
  1932. return 1;
  1933. }
  1934. else
  1935. {
  1936. x = tch->GetX() / 100;
  1937. y = tch->GetY() / 100;
  1938. }
  1939. }
  1940.  
  1941. teleport_area:
  1942.  
  1943. x *= 100;
  1944. y *= 100;
  1945.  
  1946. ch->ChatPacket(CHAT_TYPE_INFO, "You warp to ( %d, %d )", x, y);
  1947. ch->WarpSet(x,y);
  1948. ch->Stop();
  1949. lua_pushnumber(L, 1 );
  1950. return 1;
  1951. }
  1952.  
  1953. int pc_set_skill_level(lua_State* L)
  1954. {
  1955. DWORD dwVnum = (DWORD)lua_tonumber(L, 1);
  1956. BYTE byLev = (BYTE)lua_tonumber(L, 2);
  1957.  
  1958. LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
  1959. ch->SetSkillLevel(dwVnum, byLev);
  1960.  
  1961. ch->SkillLevelPacket();
  1962.  
  1963. return 0;
  1964. }
  1965.  
  1966. int pc_give_polymorph_book(lua_State* L)
  1967. {
  1968. if ( lua_isnumber(L, 1) != true && lua_isnumber(L, 2) != true && lua_isnumber(L, 3) != true && lua_isnumber(L, 4) != true )
  1969. {
  1970. sys_err("Wrong Quest Function Arguments: pc_give_polymorph_book");
  1971. return 0;
  1972. }
  1973.  
  1974. LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
  1975.  
  1976. CPolymorphUtils::instance().GiveBook(ch, (DWORD)lua_tonumber(L, 1), (DWORD)lua_tonumber(L, 2), (BYTE)lua_tonumber(L, 3), (BYTE)lua_tonumber(L, 4));
  1977.  
  1978. return 0;
  1979. }
  1980.  
  1981. int pc_upgrade_polymorph_book(lua_State* L)
  1982. {
  1983. LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
  1984. LPITEM pItem = CQuestManager::instance().GetCurrentItem();
  1985.  
  1986. bool ret = CPolymorphUtils::instance().BookUpgrade(ch, pItem);
  1987.  
  1988. lua_pushboolean(L, ret);
  1989.  
  1990. return 1;
  1991. }
  1992.  
  1993. int pc_get_premium_remain_sec(lua_State* L)
  1994. {
  1995. int remain_seconds = 0;
  1996. int premium_type = 0;
  1997. LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
  1998.  
  1999. if (!lua_isnumber(L, 1))
  2000. {
  2001. sys_err("wrong premium index (is not number)");
  2002. return 0;
  2003. }
  2004.  
  2005. premium_type = (int)lua_tonumber(L,1);
  2006. switch (premium_type)
  2007. {
  2008. case PREMIUM_EXP:
  2009. case PREMIUM_ITEM:
  2010. case PREMIUM_SAFEBOX:
  2011. case PREMIUM_AUTOLOOT:
  2012. case PREMIUM_FISH_MIND:
  2013. case PREMIUM_MARRIAGE_FAST:
  2014. case PREMIUM_GOLD:
  2015. break;
  2016.  
  2017. default:
  2018. sys_err("wrong premium index %d", premium_type);
  2019. return 0;
  2020. }
  2021.  
  2022. remain_seconds = ch->GetPremiumRemainSeconds(premium_type);
  2023.  
  2024. lua_pushnumber(L, remain_seconds);
  2025. return 1;
  2026. }
  2027.  
  2028. int pc_send_block_mode(lua_State* L)
  2029. {
  2030. LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
  2031.  
  2032. ch->SetBlockModeForce((BYTE)lua_tonumber(L, 1));
  2033.  
  2034. return 0;
  2035. }
  2036.  
  2037. int pc_change_empire(lua_State* L)
  2038. {
  2039. LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
  2040.  
  2041. lua_pushnumber(L, ch->ChangeEmpire((unsigned char)lua_tonumber(L, 1)));
  2042. if (ch->GetParty())
  2043. {
  2044. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Nie mozesz zmienic krolestwa bedac w party."));
  2045. lua_pushnumber(L, 4);
  2046. return 0;
  2047. }
  2048. return 1;
  2049. }
  2050.  
  2051. int pc_get_change_empire_count(lua_State* L)
  2052. {
  2053. LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
  2054.  
  2055. lua_pushnumber(L, ch->GetChangeEmpireCount());
  2056.  
  2057. return 1;
  2058. }
  2059.  
  2060. int pc_set_change_empire_count(lua_State* L)
  2061. {
  2062. LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
  2063.  
  2064. ch->SetChangeEmpireCount();
  2065.  
  2066. return 0;
  2067. }
  2068.  
  2069. int pc_change_name(lua_State* L)
  2070. {
  2071. // ¸®ĹĎ°Ş
  2072. // 0: »őŔ̸§Ŕ» ĽłÁ¤ÇŃ µÚ ·Î±×ľĆżôŔ» ľČÇßŔ˝
  2073. // 1: ˝şĹ©¸łĆ®żˇĽ­ ą®ŔÚż­ŔĚ łŃľîżŔÁö ľĘľŇŔ˝
  2074. // 2: check_name Ŕ» Ĺë°úÇĎÁö ¸řÇßŔ˝
  2075. // 3: ŔĚąĚ °°Ŕş Ŕ̸§ŔĚ »çżëÁß
  2076. // 4: Ľş°ř
  2077. // 5: ÇŘ´ç ±â´É ÁöżřÇĎÁö ľĘŔ˝
  2078. if ( LC_IsEurope() )
  2079. {
  2080. lua_pushnumber(L, 5);
  2081. return 1;
  2082. }
  2083.  
  2084. LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
  2085.  
  2086. if ( ch->GetNewName().size() != 0 )
  2087. {
  2088. lua_pushnumber(L, 0);
  2089. return 1;
  2090. }
  2091.  
  2092. if ( lua_isstring(L, 1) != true )
  2093. {
  2094. lua_pushnumber(L, 1);
  2095. return 1;
  2096. }
  2097.  
  2098. const char * szName = lua_tostring(L, 1);
  2099.  
  2100. if ( check_name(szName) == false )
  2101. {
  2102. lua_pushnumber(L, 2);
  2103. return 1;
  2104. }
  2105.  
  2106. char szQuery[1024];
  2107. snprintf(szQuery, sizeof(szQuery), "SELECT COUNT(*) FROM player%s WHERE name='%s'", get_table_postfix(), szName);
  2108. std::unique_ptr<SQLMsg> pmsg(DBManager::instance().DirectQuery(szQuery));
  2109.  
  2110. if ( pmsg->Get()->uiNumRows > 0 )
  2111. {
  2112. MYSQL_ROW row = mysql_fetch_row(pmsg->Get()->pSQLResult);
  2113.  
  2114. int count = 0;
  2115. str_to_number(count, row[0]);
  2116.  
  2117. // ŔĚąĚ ÇŘ´ç Ŕ̸§Ŕ» °ˇÁř Äł¸ŻĹÍ°ˇ ŔÖŔ˝
  2118. if ( count != 0 )
  2119. {
  2120. lua_pushnumber(L, 3);
  2121. return 1;
  2122. }
  2123. }
  2124.  
  2125. DWORD pid = ch->GetPlayerID();
  2126. db_clientdesc->DBPacketHeader(HEADER_GD_FLUSH_CACHE, 0, sizeof(DWORD));
  2127. db_clientdesc->Packet(&pid, sizeof(DWORD));
  2128.  
  2129. /* delete messenger list */
  2130. MessengerManager::instance().RemoveAllList(ch->GetName());
  2131.  
  2132. /* change_name_log */
  2133. LogManager::instance().ChangeNameLog(pid, ch->GetName(), szName, ch->GetDesc()->GetHostName());
  2134.  
  2135. snprintf(szQuery, sizeof(szQuery), "UPDATE player%s SET name='%s' WHERE id=%u", get_table_postfix(), szName, pid);
  2136. SQLMsg * msg = DBManager::instance().DirectQuery(szQuery);
  2137. M2_DELETE(msg);
  2138.  
  2139. ch->SetNewName(szName);
  2140. lua_pushnumber(L, 4);
  2141. return 1;
  2142. }
  2143.  
  2144. int pc_is_dead(lua_State* L)
  2145. {
  2146. LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
  2147.  
  2148. if ( ch != NULL )
  2149. {
  2150. lua_pushboolean(L, ch->IsDead());
  2151. return 1;
  2152. }
  2153.  
  2154. lua_pushboolean(L, true);
  2155.  
  2156. return 1;
  2157. }
  2158.  
  2159. int pc_reset_status( lua_State* L )
  2160. {
  2161. if ( lua_isnumber(L, 1) == true )
  2162. {
  2163. int idx = (int)lua_tonumber(L, 1);
  2164.  
  2165. if ( idx >= 0 && idx < 4 )
  2166. {
  2167. LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
  2168. int point = POINT_NONE;
  2169. char buf[128];
  2170.  
  2171. switch ( idx )
  2172. {
  2173. case 0 : point = POINT_HT; break;
  2174. case 1 : point = POINT_IQ; break;
  2175. case 2 : point = POINT_ST; break;
  2176. case 3 : point = POINT_DX; break;
  2177. default : lua_pushboolean(L, false); return 1;
  2178. }
  2179.  
  2180. int old_val = ch->GetRealPoint(point);
  2181. int old_stat = ch->GetRealPoint(POINT_STAT);
  2182.  
  2183. ch->SetRealPoint(point, 1);
  2184. ch->SetPoint(point, ch->GetRealPoint(point));
  2185.  
  2186. ch->PointChange(POINT_STAT, old_val-1);
  2187.  
  2188. if ( point == POINT_HT )
  2189. {
  2190. BYTE job = ch->GetJob();
  2191. ch->SetRandomHP((ch->GetLevel()-1) * number(JobInitialPoints[job].hp_per_lv_begin, JobInitialPoints[job].hp_per_lv_end));
  2192. }
  2193. else if ( point == POINT_IQ )
  2194. {
  2195. BYTE job = ch->GetJob();
  2196. ch->SetRandomSP((ch->GetLevel()-1) * number(JobInitialPoints[job].sp_per_lv_begin, JobInitialPoints[job].sp_per_lv_end));
  2197. }
  2198.  
  2199. ch->ComputePoints();
  2200. ch->PointsPacket();
  2201.  
  2202. if ( point == POINT_HT )
  2203. {
  2204. ch->PointChange(POINT_HP, ch->GetMaxHP() - ch->GetHP());
  2205. }
  2206. else if ( point == POINT_IQ )
  2207. {
  2208. ch->PointChange(POINT_SP, ch->GetMaxSP() - ch->GetSP());
  2209. }
  2210.  
  2211. switch ( idx )
  2212. {
  2213. case 0 :
  2214. snprintf(buf, sizeof(buf), "reset ht(%d)->1 stat_point(%d)->(%d)", old_val, old_stat, ch->GetRealPoint(POINT_STAT));
  2215. break;
  2216. case 1 :
  2217. snprintf(buf, sizeof(buf), "reset iq(%d)->1 stat_point(%d)->(%d)", old_val, old_stat, ch->GetRealPoint(POINT_STAT));
  2218. break;
  2219. case 2 :
  2220. snprintf(buf, sizeof(buf), "reset st(%d)->1 stat_point(%d)->(%d)", old_val, old_stat, ch->GetRealPoint(POINT_STAT));
  2221. break;
  2222. case 3 :
  2223. snprintf(buf, sizeof(buf), "reset dx(%d)->1 stat_point(%d)->(%d)", old_val, old_stat, ch->GetRealPoint(POINT_STAT));
  2224. break;
  2225. }
  2226.  
  2227. LogManager::instance().CharLog(ch, 0, "RESET_ONE_STATUS", buf);
  2228.  
  2229. lua_pushboolean(L, true);
  2230. return 1;
  2231. }
  2232. }
  2233.  
  2234. lua_pushboolean(L, false);
  2235. return 1;
  2236. }
  2237.  
  2238. int pc_get_ht( lua_State* L )
  2239. {
  2240. LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
  2241. lua_pushnumber(L, ch->GetRealPoint(POINT_HT));
  2242. return 1;
  2243. }
  2244.  
  2245. int pc_set_ht( lua_State* L )
  2246. {
  2247. if ( lua_isnumber(L, 1) == false )
  2248. return 1;
  2249.  
  2250. int newPoint = (int)lua_tonumber(L, 1);
  2251.  
  2252. LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
  2253. int usedPoint = newPoint - ch->GetRealPoint(POINT_HT);
  2254. ch->SetRealPoint(POINT_HT, newPoint);
  2255. ch->PointChange(POINT_HT, 0);
  2256. ch->PointChange(POINT_STAT, -usedPoint);
  2257. ch->ComputePoints();
  2258. ch->PointsPacket();
  2259. return 1;
  2260. }
  2261.  
  2262. int pc_get_iq( lua_State* L )
  2263. {
  2264. LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
  2265. lua_pushnumber(L, ch->GetRealPoint(POINT_IQ));
  2266. return 1;
  2267. }
  2268.  
  2269. int pc_set_iq( lua_State* L )
  2270. {
  2271. if ( lua_isnumber(L, 1) == false )
  2272. return 1;
  2273.  
  2274. int newPoint = (int)lua_tonumber(L, 1);
  2275.  
  2276. LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
  2277. int usedPoint = newPoint - ch->GetRealPoint(POINT_IQ);
  2278. ch->SetRealPoint(POINT_IQ, newPoint);
  2279. ch->PointChange(POINT_IQ, 0);
  2280. ch->PointChange(POINT_STAT, -usedPoint);
  2281. ch->ComputePoints();
  2282. ch->PointsPacket();
  2283. return 1;
  2284. }
  2285.  
  2286. int pc_get_st( lua_State* L )
  2287. {
  2288. LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
  2289. lua_pushnumber(L, ch->GetRealPoint(POINT_ST));
  2290. return 1;
  2291. }
  2292.  
  2293. int pc_set_st( lua_State* L )
  2294. {
  2295. if ( lua_isnumber(L, 1) == false )
  2296. return 1;
  2297.  
  2298. int newPoint = (int)lua_tonumber(L, 1);
  2299.  
  2300. LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
  2301. int usedPoint = newPoint - ch->GetRealPoint(POINT_ST);
  2302. ch->SetRealPoint(POINT_ST, newPoint);
  2303. ch->PointChange(POINT_ST, 0);
  2304. ch->PointChange(POINT_STAT, -usedPoint);
  2305. ch->ComputePoints();
  2306. ch->PointsPacket();
  2307. return 1;
  2308. }
  2309.  
  2310. int pc_get_dx( lua_State* L )
  2311. {
  2312. LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
  2313. lua_pushnumber(L, ch->GetRealPoint(POINT_DX));
  2314. return 1;
  2315. }
  2316.  
  2317. int pc_set_dx( lua_State* L )
  2318. {
  2319. if ( lua_isnumber(L, 1) == false )
  2320. return 1;
  2321.  
  2322. int newPoint = (int)lua_tonumber(L, 1);
  2323.  
  2324. LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
  2325. int usedPoint = newPoint - ch->GetRealPoint(POINT_DX);
  2326. ch->SetRealPoint(POINT_DX, newPoint);
  2327. ch->PointChange(POINT_DX, 0);
  2328. ch->PointChange(POINT_STAT, -usedPoint);
  2329. ch->ComputePoints();
  2330. ch->PointsPacket();
  2331. return 1;
  2332. }
  2333.  
  2334. int pc_is_near_vid( lua_State* L )
  2335. {
  2336. if ( lua_isnumber(L, 1) != true || lua_isnumber(L, 2) != true )
  2337. {
  2338. lua_pushboolean(L, false);
  2339. }
  2340. else
  2341. {
  2342. LPCHARACTER pMe = CQuestManager::instance().GetCurrentCharacterPtr();
  2343. LPCHARACTER pOther = CHARACTER_MANAGER::instance().Find( (DWORD)lua_tonumber(L, 1) );
  2344.  
  2345. if ( pMe != NULL && pOther != NULL )
  2346. {
  2347. lua_pushboolean(L, (DISTANCE_APPROX(pMe->GetX() - pOther->GetX(), pMe->GetY() - pOther->GetY()) < (int)lua_tonumber(L, 2)*100));
  2348. }
  2349. else
  2350. {
  2351. lua_pushboolean(L, false);
  2352. }
  2353. }
  2354.  
  2355. return 1;
  2356. }
  2357.  
  2358. int pc_get_socket_items( lua_State* L )
  2359. {
  2360. LPCHARACTER pChar = CQuestManager::instance().GetCurrentCharacterPtr();
  2361.  
  2362. lua_newtable( L );
  2363.  
  2364. if ( pChar == NULL ) return 1;
  2365.  
  2366. int idx = 1;
  2367.  
  2368. // żëČĄĽ® ˝˝·ÔŔş ÇŇ ÇĘżä ľřŔ» µí.
  2369. // ŔĚ ÇÔĽö´Â Ĺ»Ľ®Ľ­żë ÇÔĽöŔÎ µí ÇĎ´Ů.
  2370. for ( int i=0; i < INVENTORY_MAX_NUM + WEAR_MAX_NUM; i++ )
  2371. {
  2372. LPITEM pItem = pChar->GetInventoryItem(i);
  2373.  
  2374. if ( pItem != NULL )
  2375. {
  2376. if ( pItem->IsEquipped() == false )
  2377. {
  2378. int j = 0;
  2379. for (; j < ITEM_SOCKET_MAX_NUM; j++ )
  2380. {
  2381. long socket = pItem->GetSocket(j);
  2382.  
  2383. if ( socket > 2 && socket != ITEM_BROKEN_METIN_VNUM )
  2384. {
  2385. TItemTable* pItemInfo = ITEM_MANAGER::instance().GetTable( socket );
  2386. if ( pItemInfo != NULL )
  2387. {
  2388. if ( pItemInfo->bType == ITEM_METIN ) break;
  2389. }
  2390. }
  2391. }
  2392.  
  2393. if ( j >= ITEM_SOCKET_MAX_NUM ) continue;
  2394.  
  2395. lua_newtable( L );
  2396.  
  2397. {
  2398. lua_pushstring( L, pItem->GetName() );
  2399. lua_rawseti( L, -2, 1 );
  2400.  
  2401. lua_pushnumber( L, i );
  2402. lua_rawseti( L, -2, 2 );
  2403. }
  2404.  
  2405. lua_rawseti( L, -2, idx++ );
  2406. }
  2407. }
  2408. }
  2409.  
  2410. return 1;
  2411. }
  2412.  
  2413. int pc_get_empty_inventory_count( lua_State* L )
  2414. {
  2415. LPCHARACTER pChar = CQuestManager::instance().GetCurrentCharacterPtr();
  2416.  
  2417. if ( pChar != NULL )
  2418. {
  2419. lua_pushnumber(L, pChar->CountEmptyInventory());
  2420. }
  2421. else
  2422. {
  2423. lua_pushnumber(L, 0);
  2424. }
  2425.  
  2426. return 1;
  2427. }
  2428.  
  2429. int pc_get_logoff_interval( lua_State* L )
  2430. {
  2431. LPCHARACTER pChar = CQuestManager::instance().GetCurrentCharacterPtr();
  2432.  
  2433. if ( pChar != NULL )
  2434. {
  2435. lua_pushnumber(L, pChar->GetLogOffInterval());
  2436. }
  2437. else
  2438. {
  2439. lua_pushnumber(L, 0);
  2440. }
  2441.  
  2442. return 1;
  2443. }
  2444.  
  2445. int pc_get_player_id( lua_State* L )
  2446. {
  2447. LPCHARACTER pChar = CQuestManager::instance().GetCurrentCharacterPtr();
  2448.  
  2449. if ( pChar != NULL )
  2450. {
  2451. lua_pushnumber( L, pChar->GetPlayerID() );
  2452. }
  2453. else
  2454. {
  2455. lua_pushnumber( L, 0 );
  2456. }
  2457.  
  2458. return 1;
  2459. }
  2460.  
  2461. int pc_get_account_id( lua_State* L )
  2462. {
  2463. LPCHARACTER pChar = CQuestManager::instance().GetCurrentCharacterPtr();
  2464.  
  2465. if ( pChar != NULL )
  2466. {
  2467. if ( pChar->GetDesc() != NULL )
  2468. {
  2469. lua_pushnumber( L, pChar->GetDesc()->GetAccountTable().id );
  2470. return 1;
  2471. }
  2472. }
  2473.  
  2474. lua_pushnumber( L, 0 );
  2475. return 1;
  2476. }
  2477.  
  2478. int pc_get_account( lua_State* L )
  2479. {
  2480. LPCHARACTER pChar = CQuestManager::instance().GetCurrentCharacterPtr();
  2481.  
  2482. if( NULL != pChar )
  2483. {
  2484. if( NULL != pChar->GetDesc() )
  2485. {
  2486. lua_pushstring( L, pChar->GetDesc()->GetAccountTable().login );
  2487. return 1;
  2488. }
  2489. }
  2490.  
  2491. lua_pushstring( L, "" );
  2492. return 1;
  2493. }
  2494.  
  2495. int pc_is_riding(lua_State* L)
  2496. {
  2497. LPCHARACTER pChar = CQuestManager::instance().GetCurrentCharacterPtr();
  2498.  
  2499. if( NULL != pChar )
  2500. {
  2501. bool is_riding = pChar->IsRiding();
  2502.  
  2503. lua_pushboolean(L, is_riding);
  2504.  
  2505. return 1;
  2506. }
  2507.  
  2508. lua_pushboolean(L, false);
  2509. return 1;
  2510. }
  2511.  
  2512. int pc_get_special_ride_vnum(lua_State* L)
  2513. {
  2514. LPCHARACTER pChar = CQuestManager::instance().GetCurrentCharacterPtr();
  2515.  
  2516. if (NULL != pChar)
  2517. {
  2518. LPITEM Unique1 = pChar->GetWear(WEAR_UNIQUE1);
  2519. LPITEM Unique2 = pChar->GetWear(WEAR_UNIQUE2);
  2520. LPITEM Unique3 = pChar->GetWear(WEAR_COSTUME_MOUNT);
  2521. if (NULL != Unique1)
  2522. {
  2523. if (UNIQUE_GROUP_SPECIAL_RIDE == Unique1->GetSpecialGroup())
  2524. {
  2525. lua_pushnumber(L, Unique1->GetVnum());
  2526. lua_pushnumber(L, Unique1->GetSocket(2));
  2527. return 2;
  2528. }
  2529. }
  2530.  
  2531. if (NULL != Unique2)
  2532. {
  2533. if (UNIQUE_GROUP_SPECIAL_RIDE == Unique2->GetSpecialGroup())
  2534. {
  2535. lua_pushnumber(L, Unique2->GetVnum());
  2536. lua_pushnumber(L, Unique2->GetSocket(2));
  2537. return 2;
  2538. }
  2539. }
  2540. if (NULL != Unique3)
  2541. {
  2542. if (UNIQUE_GROUP_SPECIAL_RIDE == Unique3->GetSpecialGroup())
  2543. {
  2544. lua_pushnumber(L, Unique3->GetVnum());
  2545. lua_pushnumber(L, Unique3->GetSocket(2));
  2546. return 2;
  2547. }
  2548. }
  2549. }
  2550.  
  2551. lua_pushnumber(L, 0);
  2552. lua_pushnumber(L, 0);
  2553.  
  2554. return 2;
  2555. }
  2556.  
  2557. int pc_can_warp(lua_State* L)
  2558. {
  2559. LPCHARACTER pChar = CQuestManager::instance().GetCurrentCharacterPtr();
  2560.  
  2561. if (NULL != pChar)
  2562. {
  2563. lua_pushboolean(L, pChar->CanWarp());
  2564. }
  2565. else
  2566. {
  2567. lua_pushboolean(L, false);
  2568. }
  2569.  
  2570. return 1;
  2571. }
  2572.  
  2573. int pc_dec_skill_point(lua_State* L)
  2574. {
  2575. LPCHARACTER pChar = CQuestManager::instance().GetCurrentCharacterPtr();
  2576.  
  2577. if (NULL != pChar)
  2578. {
  2579. pChar->PointChange(POINT_SKILL, -1);
  2580. }
  2581.  
  2582. return 0;
  2583. }
  2584.  
  2585. int pc_get_skill_point(lua_State* L)
  2586. {
  2587. LPCHARACTER pChar = CQuestManager::instance().GetCurrentCharacterPtr();
  2588.  
  2589. if (NULL != pChar)
  2590. {
  2591. lua_pushnumber(L, pChar->GetPoint(POINT_SKILL));
  2592. }
  2593. else
  2594. {
  2595. lua_pushnumber(L, 0);
  2596. }
  2597.  
  2598. return 1;
  2599. }
  2600.  
  2601. int pc_get_channel_id(lua_State* L)
  2602. {
  2603. lua_pushnumber(L, g_bChannel);
  2604.  
  2605. return 1;
  2606. }
  2607.  
  2608. int pc_give_poly_marble(lua_State* L)
  2609. {
  2610. const int dwVnum = lua_tonumber(L, 1);
  2611.  
  2612. const CMob* MobInfo = CMobManager::instance().Get(dwVnum);
  2613.  
  2614. if (NULL == MobInfo)
  2615. {
  2616. lua_pushboolean(L, false);
  2617. return 1;
  2618. }
  2619.  
  2620. if (0 == MobInfo->m_table.dwPolymorphItemVnum)
  2621. {
  2622. lua_pushboolean(L, false);
  2623. return 1;
  2624. }
  2625.  
  2626. LPITEM item = ITEM_MANAGER::instance().CreateItem( MobInfo->m_table.dwPolymorphItemVnum );
  2627.  
  2628. if (NULL == item)
  2629. {
  2630. lua_pushboolean(L, false);
  2631. return 1;
  2632. }
  2633.  
  2634. item->SetSocket(0, dwVnum);
  2635.  
  2636. const LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
  2637.  
  2638. int iEmptyCell = ch->GetEmptyInventory(item->GetSize());
  2639.  
  2640. if (-1 == iEmptyCell)
  2641. {
  2642. M2_DESTROY_ITEM(item);
  2643. lua_pushboolean(L, false);
  2644. return 1;
  2645. }
  2646.  
  2647. item->AddToCharacter(ch, TItemPos(INVENTORY, iEmptyCell));
  2648.  
  2649. const PC* pPC = CQuestManager::instance().GetCurrentPC();
  2650.  
  2651. LogManager::instance().QuestRewardLog(pPC->GetCurrentQuestName().c_str(), ch->GetPlayerID(), ch->GetLevel(), MobInfo->m_table.dwPolymorphItemVnum, dwVnum);
  2652.  
  2653. lua_pushboolean(L, true);
  2654.  
  2655. return 1;
  2656. }
  2657.  
  2658. int pc_get_sig_items (lua_State* L)
  2659. {
  2660. DWORD group_vnum = (DWORD)lua_tonumber (L, 1);
  2661. const LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
  2662. int count = 0;
  2663. for (int i = 0; i < INVENTORY_MAX_NUM; ++i)
  2664. {
  2665. if (ch->GetInventoryItem(i) != NULL && ch->GetInventoryItem(i)->GetSIGVnum() == group_vnum)
  2666. {
  2667. lua_pushnumber(L, ch->GetInventoryItem(i)->GetID());
  2668. count++;
  2669. }
  2670. }
  2671.  
  2672. return count;
  2673. }
  2674.  
  2675. int pc_charge_cash(lua_State * L)
  2676. {
  2677. TRequestChargeCash packet;
  2678.  
  2679. int amount = lua_isnumber(L, 1) ? (int)lua_tonumber(L, 1) : 0;
  2680. std::string strChargeType = lua_isstring(L, 2) ? lua_tostring(L, 2) : "";
  2681.  
  2682. LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
  2683.  
  2684. if (NULL == ch || NULL == ch->GetDesc() || 1 > amount || 50000 < amount)
  2685. {
  2686. lua_pushboolean(L, 0);
  2687. return 1;
  2688. }
  2689.  
  2690. packet.dwAID = ch->GetDesc()->GetAccountTable().id;
  2691. packet.dwAmount = (DWORD)amount;
  2692. packet.eChargeType = ERequestCharge_Cash;
  2693.  
  2694. if (0 < strChargeType.length())
  2695. std::transform(strChargeType.begin(), strChargeType.end(), strChargeType.begin(), (int(*)(int))std::tolower);
  2696.  
  2697. if ("mileage" == strChargeType)
  2698. packet.eChargeType = ERequestCharge_Mileage;
  2699.  
  2700. db_clientdesc->DBPacketHeader(HEADER_GD_REQUEST_CHARGE_CASH, 0, sizeof(TRequestChargeCash));
  2701. db_clientdesc->Packet(&packet, sizeof(packet));
  2702.  
  2703. lua_pushboolean(L, 1);
  2704. return 1;
  2705. }
  2706.  
  2707. int pc_give_award(lua_State* L)
  2708. {
  2709. LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
  2710.  
  2711. if (!lua_isnumber(L, 1) || !lua_isnumber(L, 2) || !lua_isstring(L, 3) )
  2712. {
  2713. sys_err("QUEST give award call error : wrong argument");
  2714. lua_pushnumber (L, 0);
  2715. return 1;
  2716. }
  2717.  
  2718. DWORD dwVnum = (int) lua_tonumber(L, 1);
  2719.  
  2720. int icount = (int) lua_tonumber(L, 2);
  2721.  
  2722. sys_log(0, "QUEST [award] item %d to login %s", dwVnum, ch->GetDesc()->GetAccountTable().login);
  2723.  
  2724. DBManager::instance().Query("INSERT INTO item_award (login, vnum, count, given_time, why, mall)select '%s', %d, %d, now(), '%s', 1 from DUAL where not exists (select login, why from item_award where login = '%s' and why = '%s') ;",
  2725. ch->GetDesc()->GetAccountTable().login,
  2726. dwVnum,
  2727. icount,
  2728. lua_tostring(L,3),
  2729. ch->GetDesc()->GetAccountTable().login,
  2730. lua_tostring(L,3));
  2731.  
  2732. lua_pushnumber (L, 0);
  2733. return 1;
  2734. }
  2735. int pc_give_award_socket(lua_State* L)
  2736. {
  2737. LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
  2738.  
  2739. if (!lua_isnumber(L, 1) || !lua_isnumber(L, 2) || !lua_isstring(L, 3) || !lua_isstring(L, 4) || !lua_isstring(L, 5) || !lua_isstring(L, 6) )
  2740. {
  2741. sys_err("QUEST give award call error : wrong argument");
  2742. lua_pushnumber (L, 0);
  2743. return 1;
  2744. }
  2745.  
  2746. DWORD dwVnum = (int) lua_tonumber(L, 1);
  2747.  
  2748. int icount = (int) lua_tonumber(L, 2);
  2749.  
  2750. sys_log(0, "QUEST [award] item %d to login %s", dwVnum, ch->GetDesc()->GetAccountTable().login);
  2751.  
  2752. DBManager::instance().Query("INSERT INTO item_award (login, vnum, count, given_time, why, mall, socket0, socket1, socket2)select '%s', %d, %d, now(), '%s', 1, %s, %s, %s from DUAL where not exists (select login, why from item_award where login = '%s' and why = '%s') ;",
  2753. ch->GetDesc()->GetAccountTable().login,
  2754. dwVnum,
  2755. icount,
  2756. lua_tostring(L,3),
  2757. lua_tostring(L,4),
  2758. lua_tostring(L,5),
  2759. lua_tostring(L,6),
  2760. ch->GetDesc()->GetAccountTable().login,
  2761. lua_tostring(L,3));
  2762.  
  2763. lua_pushnumber (L, 0);
  2764. return 1;
  2765. }
  2766.  
  2767. int pc_get_informer_type(lua_State* L) //µ¶ŔĎ Ľ±ą° ±â´É
  2768. {
  2769. LPCHARACTER pChar = CQuestManager::instance().GetCurrentCharacterPtr();
  2770.  
  2771. if( pChar != NULL )
  2772. {
  2773. //sys_err("quest cmd test %s", pChar->GetItemAward_cmd() );
  2774. lua_pushstring(L, pChar->GetItemAward_cmd() );
  2775. }
  2776. else
  2777. lua_pushstring(L, "" );
  2778.  
  2779. return 1;
  2780. }
  2781.  
  2782. int pc_get_informer_item(lua_State* L)
  2783. {
  2784. LPCHARACTER pChar = CQuestManager::instance().GetCurrentCharacterPtr();
  2785.  
  2786. if( pChar != NULL )
  2787. {
  2788. lua_pushnumber(L, pChar->GetItemAward_vnum() );
  2789. }
  2790. else
  2791. lua_pushnumber(L,0);
  2792.  
  2793. return 1;
  2794. }
  2795.  
  2796. int pc_get_killee_drop_pct(lua_State* L)
  2797. {
  2798. LPCHARACTER pChar = CQuestManager::instance().GetCurrentCharacterPtr();
  2799. LPCHARACTER pKillee = pChar->GetQuestNPC();
  2800.  
  2801. int iDeltaPercent, iRandRange;
  2802. if (NULL == pKillee || !ITEM_MANAGER::instance().GetDropPct(pKillee, pChar, iDeltaPercent, iRandRange))
  2803. {
  2804. sys_err("killee is null");
  2805. lua_pushnumber(L, -1);
  2806. lua_pushnumber(L, -1);
  2807.  
  2808. return 2;
  2809. }
  2810.  
  2811. lua_pushnumber(L, iDeltaPercent);
  2812. lua_pushnumber(L, iRandRange);
  2813.  
  2814. return 2;
  2815. }
  2816.  
  2817. void RegisterPCFunctionTable()
  2818. {
  2819. luaL_reg pc_functions[] =
  2820. {
  2821. { "get_wear", pc_get_wear },
  2822. { "get_player_id", pc_get_player_id },
  2823. { "get_account_id", pc_get_account_id },
  2824. { "get_account", pc_get_account },
  2825. { "get_level", pc_get_level },
  2826. { "set_level", pc_set_level },
  2827. { "get_next_exp", pc_get_next_exp },
  2828. { "get_exp", pc_get_exp },
  2829. { "get_job", pc_get_job },
  2830. { "get_race", pc_get_race },
  2831. { "change_sex", pc_change_sex },
  2832. { "gethp", pc_get_hp },
  2833. { "get_hp", pc_get_hp },
  2834. { "getmaxhp", pc_get_max_hp },
  2835. { "get_max_hp", pc_get_max_hp },
  2836. { "getsp", pc_get_sp },
  2837. { "get_sp", pc_get_sp },
  2838. { "getmaxsp", pc_get_max_sp },
  2839. { "get_max_sp", pc_get_max_sp },
  2840. { "change_sp", pc_change_sp },
  2841. { "getmoney", pc_get_money },
  2842. { "get_money", pc_get_money },
  2843. { "get_real_alignment", pc_get_real_alignment },
  2844. { "get_alignment", pc_get_alignment },
  2845. { "getweapon", pc_get_weapon },
  2846. { "get_weapon", pc_get_weapon },
  2847. { "getarmor", pc_get_armor },
  2848. { "get_armor", pc_get_armor },
  2849. { "getgold", pc_get_money },
  2850. { "get_gold", pc_get_money },
  2851. { "changegold", pc_change_money },
  2852. { "changemoney", pc_change_money },
  2853. { "changealignment", pc_change_alignment },
  2854. { "change_gold", pc_change_money },
  2855. { "change_money", pc_change_money },
  2856. { "change_alignment", pc_change_alignment },
  2857. { "getname", pc_get_name },
  2858. { "get_name", pc_get_name },
  2859. { "get_vid", pc_get_vid },
  2860. { "getplaytime", pc_get_playtime },
  2861. { "get_playtime", pc_get_playtime },
  2862. { "getleadership", pc_get_leadership },
  2863. { "get_leadership", pc_get_leadership },
  2864. { "getqf", pc_get_quest_flag },
  2865. { "setqf", pc_set_quest_flag },
  2866. { "delqf", pc_del_quest_flag },
  2867. { "getf", pc_get_another_quest_flag},
  2868. { "setf", pc_set_another_quest_flag},
  2869. { "get_x", pc_get_x },
  2870. { "get_y", pc_get_y },
  2871. { "getx", pc_get_x },
  2872. { "gety", pc_get_y },
  2873. { "get_local_x", pc_get_local_x },
  2874. { "get_local_y", pc_get_local_y },
  2875. { "getcurrentmapindex", pc_get_current_map_index},
  2876. { "get_map_index", pc_get_current_map_index},
  2877. { "give_exp", pc_give_exp },
  2878. { "give_exp_perc", pc_give_exp_perc },
  2879. { "give_exp2", pc_give_exp2 },
  2880. { "give_item", pc_give_item },
  2881. { "give_item2", pc_give_or_drop_item },
  2882. { "give_item2_select", pc_give_or_drop_item_and_select },
  2883. { "give_gold", pc_give_gold },
  2884. { "count_item", pc_count_item },
  2885. { "remove_item", pc_remove_item },
  2886. { "countitem", pc_count_item },
  2887. { "removeitem", pc_remove_item },
  2888. { "reset_point", pc_reset_point },
  2889. { "has_guild", pc_hasguild },
  2890. { "hasguild", pc_hasguild },
  2891. { "get_guild", pc_getguild },
  2892. { "getguild", pc_getguild },
  2893. { "isguildmaster", pc_isguildmaster },
  2894. { "is_guild_master", pc_isguildmaster },
  2895. { "destroy_guild", pc_destroy_guild },
  2896. { "remove_from_guild", pc_remove_from_guild },
  2897. { "in_dungeon", pc_in_dungeon },
  2898. { "getempire", pc_get_empire },
  2899. { "get_empire", pc_get_empire },
  2900. { "get_skill_group", pc_get_skillgroup },
  2901. { "set_skill_group", pc_set_skillgroup },
  2902. { "warp", pc_warp },
  2903. { "warp_local", pc_warp_local },
  2904. { "warp_exit", pc_warp_exit },
  2905. { "set_warp_location", pc_set_warp_location },
  2906. { "set_warp_location_local",pc_set_warp_location_local },
  2907. { "get_start_location", pc_get_start_location },
  2908. { "has_master_skill", pc_has_master_skill },
  2909. { "set_part", pc_set_part },
  2910. { "get_part", pc_get_part },
  2911. { "is_polymorphed", pc_is_polymorphed },
  2912. { "remove_polymorph", pc_remove_polymorph },
  2913. { "is_mount", pc_is_mount },
  2914. { "polymorph", pc_polymorph },
  2915. { "mount", pc_mount },
  2916. { "mount_bonus", pc_mount_bonus },
  2917. { "unmount", pc_unmount },
  2918. { "warp_to_guild_war_observer_position", pc_warp_to_guild_war_observer_position },
  2919. { "give_item_from_special_item_group", pc_give_item_from_special_item_group },
  2920. { "learn_grand_master_skill", pc_learn_grand_master_skill },
  2921. { "is_skill_book_no_delay", pc_is_skill_book_no_delay},
  2922. { "remove_skill_book_no_delay", pc_remove_skill_book_no_delay},
  2923.  
  2924. { "enough_inventory", pc_enough_inventory },
  2925. { "get_horse_level", pc_get_horse_level }, // TO BE DELETED XXX
  2926. { "is_horse_alive", pc_is_horse_alive }, // TO BE DELETED XXX
  2927. { "revive_horse", pc_revive_horse }, // TO BE DELETED XXX
  2928. { "have_pos_scroll", pc_have_pos_scroll },
  2929. { "have_map_scroll", pc_have_map_scroll },
  2930. { "get_war_map", pc_get_war_map },
  2931. { "get_equip_refine_level", pc_get_equip_refine_level },
  2932. { "refine_equip", pc_refine_equip },
  2933. { "get_skill_level", pc_get_skill_level },
  2934. { "give_lotto", pc_give_lotto },
  2935. { "aggregate_monster", pc_aggregate_monster },
  2936. { "forget_my_attacker", pc_forget_my_attacker },
  2937. { "pc_attract_ranger", pc_attract_ranger },
  2938. { "select", pc_select_vid },
  2939. { "get_sex", pc_get_sex },
  2940. { "is_married", pc_is_married },
  2941. { "is_engaged", pc_is_engaged },
  2942. { "is_engaged_or_married", pc_is_engaged_or_married},
  2943. { "is_gm", pc_is_gm },
  2944. { "get_gm_level", pc_get_gm_level },
  2945. { "mining", pc_mining },
  2946. { "ore_refine", pc_ore_refine },
  2947. { "diamond_refine", pc_diamond_refine },
  2948.  
  2949. // RESET_ONE_SKILL
  2950. { "clear_one_skill", pc_clear_one_skill },
  2951. // END_RESET_ONE_SKILL
  2952.  
  2953. { "clear_skill", pc_clear_skill },
  2954. { "clear_sub_skill", pc_clear_sub_skill },
  2955. { "set_skill_point", pc_set_skill_point },
  2956.  
  2957. { "is_clear_skill_group", pc_is_clear_skill_group },
  2958.  
  2959. { "save_exit_location", pc_save_exit_location },
  2960. { "teleport", pc_teleport },
  2961.  
  2962. { "set_skill_level", pc_set_skill_level },
  2963.  
  2964. { "give_polymorph_book", pc_give_polymorph_book },
  2965. { "upgrade_polymorph_book", pc_upgrade_polymorph_book },
  2966. { "get_premium_remain_sec", pc_get_premium_remain_sec },
  2967.  
  2968. { "send_block_mode", pc_send_block_mode },
  2969.  
  2970. { "change_empire", pc_change_empire },
  2971. { "get_change_empire_count", pc_get_change_empire_count },
  2972. { "set_change_empire_count", pc_set_change_empire_count },
  2973.  
  2974. { "change_name", pc_change_name },
  2975.  
  2976. { "is_dead", pc_is_dead },
  2977.  
  2978. { "reset_status", pc_reset_status },
  2979. { "get_ht", pc_get_ht },
  2980. { "set_ht", pc_set_ht },
  2981. { "get_iq", pc_get_iq },
  2982. { "set_iq", pc_set_iq },
  2983. { "get_st", pc_get_st },
  2984. { "set_st", pc_set_st },
  2985. { "get_dx", pc_get_dx },
  2986. { "set_dx", pc_set_dx },
  2987.  
  2988. { "is_near_vid", pc_is_near_vid },
  2989.  
  2990. { "get_socket_items", pc_get_socket_items },
  2991. { "get_empty_inventory_count", pc_get_empty_inventory_count },
  2992.  
  2993. { "get_logoff_interval", pc_get_logoff_interval },
  2994.  
  2995. { "is_riding", pc_is_riding },
  2996. { "get_special_ride_vnum", pc_get_special_ride_vnum },
  2997.  
  2998. { "can_warp", pc_can_warp },
  2999.  
  3000. { "dec_skill_point", pc_dec_skill_point },
  3001. { "get_skill_point", pc_get_skill_point },
  3002.  
  3003. { "get_channel_id", pc_get_channel_id },
  3004.  
  3005. { "give_poly_marble", pc_give_poly_marble },
  3006. { "get_sig_items", pc_get_sig_items },
  3007.  
  3008. { "charge_cash", pc_charge_cash },
  3009.  
  3010. { "get_informer_type", pc_get_informer_type }, //µ¶ŔĎ Ľ±ą° ±â´É
  3011. { "get_informer_item", pc_get_informer_item },
  3012.  
  3013. { "give_award", pc_give_award }, //ŔĎş» °čÁ¤´ç ÇŃąřľż ±Ý±« Áö±Ţ
  3014. { "give_award_socket", pc_give_award_socket }, //¸ô ŔÎşĄĹ丮żˇ ľĆŔĚĹŰ Áö±Ţ. ĽŇÄĎ ĽłÁ¤Ŕ» Ŕ§ÇŃ ÇÔĽö.
  3015.  
  3016. { "get_killee_drop_pct", pc_get_killee_drop_pct }, /* mob_vnum.kill ŔĚşĄĆ®żˇĽ­ killeeżÍ pcżÍŔÇ level Â÷ŔĚ, pcŔÇ ÇÁ¸®ąĚľö µĺ¶ř·ü µîµîŔ» °í·ÁÇŃ ľĆŔĚĹŰ µĺ¶ř Č®·ü.
  3017. * return °ŞŔş (şĐŔÚ, şĐ¸đ).
  3018. * (¸»ŔĚ şąŔâÇѵĄ, CreateDropItemŔÇ GetDropPctŔÇ iDeltaPercent, iRandRange¸¦ returnÇŃ´Ů°í ş¸¸é µĘ.)
  3019. * (ŔĚ ¸»ŔĚ ´ő ľî·Áżď¶ółŞ ¤Đ¤Đ)
  3020. * ÁÖŔÇ»çÇ× : kill eventżˇĽ­¸¸ »çżëÇŇ °Í!
  3021. */
  3022.  
  3023. { NULL, NULL }
  3024. };
  3025.  
  3026. CQuestManager::instance().AddLuaFunctionTable("pc", pc_functions);
  3027. }
  3028. };
  3029.  
Advertisement
RAW Paste Data Copied
Advertisement