Advertisement
Guest User

Untitled

a guest
Sep 10th, 2017
304
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 124.11 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include "utils.h"
  3. #include "config.h"
  4. #include "desc_client.h"
  5. #include "desc_manager.h"
  6. #include "char.h"
  7. #include "char_manager.h"
  8. #include "item_manager.h"
  9. #include "sectree_manager.h"
  10. #include "mob_manager.h"
  11. #include "packet.h"
  12. #include "cmd.h"
  13. #include "regen.h"
  14. #include "guild.h"
  15. #include "guild_manager.h"
  16. #include "p2p.h"
  17. #include "buffer_manager.h"
  18. #include "fishing.h"
  19. #include "mining.h"
  20. #include "questmanager.h"
  21. #include "vector.h"
  22. #include "affect.h"
  23. #include "db.h"
  24. #include "priv_manager.h"
  25. #include "building.h"
  26. #include "battle.h"
  27. #include "arena.h"
  28. #include "start_position.h"
  29. #include "party.h"
  30. #include "monarch.h"
  31. #include "castle.h"
  32. #include "BattleArena.h"
  33. #include "xmas_event.h"
  34. #include "log.h"
  35. #include "pcbang.h"
  36. #include "threeway_war.h"
  37. #include "unique_item.h"
  38. #include "DragonSoul.h"
  39. #ifdef NEW_PET_SYSTEM
  40. #include "New_PetSystem.h"
  41. #endif
  42.  
  43. extern bool DropEvent_RefineBox_SetValue(const std::string& name, int value);
  44.  
  45. // ADD_COMMAND_SLOW_STUN
  46. enum
  47. {
  48. COMMANDAFFECT_STUN,
  49. COMMANDAFFECT_SLOW,
  50. };
  51.  
  52. void Command_ApplyAffect(LPCHARACTER ch, const char* argument, const char* affectName, int cmdAffect)
  53. {
  54. char arg1[256];
  55. one_argument(argument, arg1, sizeof(arg1));
  56.  
  57. sys_log(0, arg1);
  58.  
  59. if (!*arg1)
  60. {
  61. ch->ChatPacket(CHAT_TYPE_INFO, "Usage: %s <name>", affectName);
  62. return;
  63. }
  64.  
  65. LPCHARACTER tch = CHARACTER_MANAGER::instance().FindPC(arg1);
  66. if (!tch)
  67. {
  68. ch->ChatPacket(CHAT_TYPE_INFO, "%s is not in same map", arg1);
  69. return;
  70. }
  71.  
  72. switch (cmdAffect)
  73. {
  74. case COMMANDAFFECT_STUN:
  75. SkillAttackAffect(tch, 1000, IMMUNE_STUN, AFFECT_STUN, POINT_NONE, 0, AFF_STUN, 30, "GM_STUN");
  76. break;
  77. case COMMANDAFFECT_SLOW:
  78. SkillAttackAffect(tch, 1000, IMMUNE_SLOW, AFFECT_SLOW, POINT_MOV_SPEED, -30, AFF_SLOW, 30, "GM_SLOW");
  79. break;
  80. }
  81.  
  82. sys_log(0, "%s %s", arg1, affectName);
  83.  
  84. ch->ChatPacket(CHAT_TYPE_INFO, "%s %s", arg1, affectName);
  85. }
  86. // END_OF_ADD_COMMAND_SLOW_STUN
  87.  
  88. ACMD(do_pcbang_update)
  89. {
  90. char arg1[256];
  91. one_argument(argument, arg1, sizeof(arg1));
  92.  
  93. unsigned long PCBangID = 0;
  94.  
  95. if (*arg1 == '\0')
  96. PCBangID = 0;
  97. else
  98. str_to_number(PCBangID, arg1);
  99.  
  100. if (PCBangID == 0)
  101. {
  102. CPCBangManager::instance().RequestUpdateIPList(0);
  103. ch->ChatPacket(CHAT_TYPE_INFO, "PCBang Info Update For All");
  104. }
  105. else
  106. {
  107. CPCBangManager::instance().RequestUpdateIPList(PCBangID);
  108. ch->ChatPacket(CHAT_TYPE_INFO, "PCBang Info Update For %u", PCBangID);
  109. }
  110.  
  111. TPacketPCBangUpdate packet;
  112. packet.bHeader = HEADER_GG_PCBANG_UPDATE;
  113. packet.ulPCBangID = PCBangID;
  114.  
  115. P2P_MANAGER::instance().Send(&packet, sizeof(TPacketPCBangUpdate));
  116.  
  117. }
  118.  
  119. ACMD(do_pcbang_check)
  120. {
  121. char arg1[256];
  122. one_argument(argument, arg1, sizeof(arg1));
  123.  
  124. if (CPCBangManager::instance().IsPCBangIP(arg1) == true)
  125. {
  126. ch->ChatPacket(CHAT_TYPE_INFO, "%s is a PCBang IP", arg1);
  127. }
  128. else
  129. {
  130. ch->ChatPacket(CHAT_TYPE_INFO, "%s is not a PCBang IP", arg1);
  131. }
  132. }
  133.  
  134. ACMD(do_stun)
  135. {
  136. Command_ApplyAffect(ch, argument, "stun", COMMANDAFFECT_STUN);
  137. }
  138.  
  139. ACMD(do_slow)
  140. {
  141. Command_ApplyAffect(ch, argument, "slow", COMMANDAFFECT_SLOW);
  142. }
  143.  
  144. ACMD(do_transfer)
  145. {
  146. char arg1[256];
  147. one_argument(argument, arg1, sizeof(arg1));
  148.  
  149. if (!*arg1)
  150. {
  151. ch->ChatPacket(CHAT_TYPE_INFO, "Usage: transfer <name>");
  152. return;
  153. }
  154.  
  155. LPCHARACTER tch = CHARACTER_MANAGER::instance().FindPC(arg1);
  156. if (!tch)
  157. {
  158. CCI * pkCCI = P2P_MANAGER::instance().Find(arg1);
  159.  
  160. if (pkCCI)
  161. {
  162. if (pkCCI->bChannel != g_bChannel)
  163. {
  164. ch->ChatPacket(CHAT_TYPE_INFO, "Target is in %d channel (my channel %d)", pkCCI->bChannel, g_bChannel);
  165. return;
  166. }
  167.  
  168. TPacketGGTransfer pgg;
  169.  
  170. pgg.bHeader = HEADER_GG_TRANSFER;
  171. strlcpy(pgg.szName, arg1, sizeof(pgg.szName));
  172. pgg.lX = ch->GetX();
  173. pgg.lY = ch->GetY();
  174.  
  175. P2P_MANAGER::instance().Send(&pgg, sizeof(TPacketGGTransfer));
  176. ch->ChatPacket(CHAT_TYPE_INFO, "Transfer requested.");
  177. }
  178. else
  179. {
  180. ch->ChatPacket(CHAT_TYPE_INFO, "There is no character(%s) by that name", arg1);
  181. sys_log(0, "There is no character(%s) by that name", arg1);
  182. }
  183.  
  184. return;
  185. }
  186.  
  187. if (ch == tch)
  188. {
  189. ch->ChatPacket(CHAT_TYPE_INFO, "Transfer me?!?");
  190. return;
  191. }
  192.  
  193. //tch->Show(ch->GetMapIndex(), ch->GetX(), ch->GetY(), ch->GetZ());
  194. tch->WarpSet(ch->GetX(), ch->GetY(), ch->GetMapIndex());
  195. }
  196.  
  197. // LUA_ADD_GOTO_INFO
  198. struct GotoInfo
  199. {
  200. std::string st_name;
  201.  
  202. BYTE empire;
  203. int mapIndex;
  204. DWORD x, y;
  205.  
  206. GotoInfo()
  207. {
  208. st_name = "";
  209. empire = 0;
  210. mapIndex = 0;
  211.  
  212. x = 0;
  213. y = 0;
  214. }
  215. GotoInfo(const GotoInfo& c_src)
  216. {
  217. __copy__(c_src);
  218. }
  219. void operator = (const GotoInfo& c_src)
  220. {
  221. __copy__(c_src);
  222. }
  223. void __copy__(const GotoInfo& c_src)
  224. {
  225. st_name = c_src.st_name;
  226. empire = c_src.empire;
  227. mapIndex = c_src.mapIndex;
  228.  
  229. x = c_src.x;
  230. y = c_src.y;
  231. }
  232. };
  233.  
  234. static std::vector<GotoInfo> gs_vec_gotoInfo;
  235.  
  236. void CHARACTER_AddGotoInfo(const std::string& c_st_name, BYTE empire, int mapIndex, DWORD x, DWORD y)
  237. {
  238. GotoInfo newGotoInfo;
  239. newGotoInfo.st_name = c_st_name;
  240. newGotoInfo.empire = empire;
  241. newGotoInfo.mapIndex = mapIndex;
  242. newGotoInfo.x = x;
  243. newGotoInfo.y = y;
  244. gs_vec_gotoInfo.push_back(newGotoInfo);
  245.  
  246. //sys_log(0, "AddGotoInfo(name=%s, empire=%d, mapIndex=%d, pos=(%d, %d))", c_st_name.c_str(), empire, mapIndex, x, y);
  247. }
  248.  
  249. bool FindInString(const char * c_pszFind, const char * c_pszIn)
  250. {
  251. const char * c = c_pszIn;
  252. const char * p;
  253.  
  254. p = strchr(c, '|');
  255.  
  256. if (!p)
  257. return (0 == strncasecmp(c_pszFind, c_pszIn, strlen(c_pszFind)));
  258. else
  259. {
  260. char sz[64 + 1];
  261.  
  262. do
  263. {
  264. strlcpy(sz, c, MIN(sizeof(sz), (p - c) + 1));
  265.  
  266. if (!strncasecmp(c_pszFind, sz, strlen(c_pszFind)))
  267. return true;
  268.  
  269. c = p + 1;
  270. } while ((p = strchr(c, '|')));
  271.  
  272. strlcpy(sz, c, sizeof(sz));
  273.  
  274. if (!strncasecmp(c_pszFind, sz, strlen(c_pszFind)))
  275. return true;
  276. }
  277.  
  278. return false;
  279. }
  280.  
  281. bool CHARACTER_GoToName(LPCHARACTER ch, BYTE empire, int mapIndex, const char* gotoName)
  282. {
  283. std::vector<GotoInfo>::iterator i;
  284. for (i = gs_vec_gotoInfo.begin(); i != gs_vec_gotoInfo.end(); ++i)
  285. {
  286. const GotoInfo& c_eachGotoInfo = *i;
  287.  
  288. if (mapIndex != 0)
  289. {
  290. if (mapIndex != c_eachGotoInfo.mapIndex)
  291. continue;
  292. }
  293. else if (!FindInString(gotoName, c_eachGotoInfo.st_name.c_str()))
  294. continue;
  295.  
  296. if (c_eachGotoInfo.empire == 0 || c_eachGotoInfo.empire == empire)
  297. {
  298. int x = c_eachGotoInfo.x * 100;
  299. int y = c_eachGotoInfo.y * 100;
  300.  
  301. ch->ChatPacket(CHAT_TYPE_INFO, "You warp to ( %d, %d )", x, y);
  302. ch->WarpSet(x, y);
  303. ch->Stop();
  304. return true;
  305. }
  306. }
  307. return false;
  308. }
  309.  
  310. // END_OF_LUA_ADD_GOTO_INFO
  311.  
  312. /*
  313. = {
  314. { "A1|영안읍성", 0, 1, 4693, 9642 },
  315. { "A3|자양현", 0, 3, 3608, 8776 },
  316.  
  317. { "B1|조안읍성", 0, 21, 557, 1579 },
  318. { "B3|복정현", 0, 23, 1385, 2349 },
  319.  
  320. { "C1|평무읍성", 0, 41, 9696, 2784 },
  321. { "C3|박라현", 0, 43, 8731, 2426 },
  322.  
  323. // Snow
  324. { "Snow|서한산", 1, 61, 4342, 2906 },
  325. { "Snow|서한산", 2, 61, 3752, 1749 },
  326. { "Snow|서한산", 3, 61, 4918, 1736 },
  327.  
  328. // Flame
  329. { "Flame|도염화지|화염", 1, 62, 5994, 7563 },
  330. { "Flame|도염화지|화염", 2, 62, 5978, 6222 },
  331. { "Flame|도염화지|화염", 3, 62, 7307, 6898 },
  332.  
  333. // Desert
  334. { "Desert|영비사막|사막", 1, 63, 2178, 6272 },
  335. { "Desert|영비사막|사막", 2, 63, 2219, 5027 },
  336. { "Desert|영비사막|사막", 3, 63, 3440, 5025 },
  337.  
  338. // Threeway
  339. { "Three|승룡곡", 1, 64, 4021, 6739 },
  340. { "Three|승룡곡", 2, 64, 2704, 7399 },
  341. { "Three|승룡곡", 3, 64, 3213, 8080 },
  342.  
  343. // 밀교사원
  344. { "Milgyo|밀교사원", 1, 65, 5536, 1436 },
  345. { "Milgyo|밀교사원", 2, 65, 5536, 1436 },
  346. { "Milgyo|밀교사원", 3, 65, 5536, 1436 },
  347.  
  348. // 사귀타워입구
  349. { "사귀타워입구", 1, 65, 5905, 1108 },
  350. { "사귀타워입구", 2, 65, 5905, 1108 },
  351. { "사귀타워입구", 3, 65, 5905, 1108 },
  352.  
  353. { NULL, 0, 0, 0, 0 },
  354. };
  355. */
  356.  
  357.  
  358. ACMD(do_goto)
  359. {
  360. char arg1[256], arg2[256];
  361. int x = 0, y = 0, z = 0;
  362.  
  363. two_arguments(argument, arg1, sizeof(arg1), arg2, sizeof(arg2));
  364.  
  365. if (!*arg1 && !*arg2)
  366. {
  367. ch->ChatPacket(CHAT_TYPE_INFO, "Usage: goto <x meter> <y meter>");
  368. return;
  369. }
  370.  
  371. if (isnhdigit(*arg1) && isnhdigit(*arg2))
  372. {
  373. str_to_number(x, arg1);
  374. str_to_number(y, arg2);
  375.  
  376. PIXEL_POSITION p;
  377.  
  378. if (SECTREE_MANAGER::instance().GetMapBasePosition(ch->GetX(), ch->GetY(), p))
  379. {
  380. x += p.x / 100;
  381. y += p.y / 100;
  382. }
  383.  
  384. ch->ChatPacket(CHAT_TYPE_INFO, "You goto ( %d, %d )", x, y);
  385. }
  386. else
  387. {
  388. int mapIndex = 0;
  389. BYTE empire = 0;
  390.  
  391. if (*arg1 == '#')
  392. str_to_number(mapIndex, (arg1 + 1));
  393.  
  394. if (*arg2 && isnhdigit(*arg2))
  395. {
  396. str_to_number(empire, arg2);
  397. empire = MINMAX(1, empire, 3);
  398. }
  399. else
  400. empire = ch->GetEmpire();
  401.  
  402. if (CHARACTER_GoToName(ch, empire, mapIndex, arg1))
  403. {
  404. ch->ChatPacket(CHAT_TYPE_INFO, "Cannot find map command syntax: /goto <mapname> [empire]");
  405. return;
  406. }
  407.  
  408. return;
  409.  
  410. /*
  411. int iMapIndex = 0;
  412. for (int i = 0; aWarpInfo[i].c_pszName != NULL; ++i)
  413. {
  414. if (iMapIndex != 0)
  415. {
  416. if (iMapIndex != aWarpInfo[i].iMapIndex)
  417. continue;
  418. }
  419. else if (!FindInString(arg1, aWarpInfo[i].c_pszName))
  420. continue;
  421.  
  422. if (aWarpInfo[i].bEmpire == 0 || aWarpInfo[i].bEmpire == bEmpire)
  423. {
  424. x = aWarpInfo[i].x * 100;
  425. y = aWarpInfo[i].y * 100;
  426.  
  427. ch->ChatPacket(CHAT_TYPE_INFO, "You warp to ( %d, %d )", x, y);
  428. ch->WarpSet(x, y);
  429. ch->Stop();
  430. return;
  431. }
  432. }
  433. */
  434.  
  435. }
  436.  
  437. x *= 100;
  438. y *= 100;
  439.  
  440. ch->Show(ch->GetMapIndex(), x, y, z);
  441. ch->Stop();
  442. }
  443.  
  444. ACMD(do_warp)
  445. {
  446. char arg1[256], arg2[256];
  447.  
  448. two_arguments(argument, arg1, sizeof(arg1), arg2, sizeof(arg2));
  449.  
  450. if (!*arg1)
  451. {
  452. ch->ChatPacket(CHAT_TYPE_INFO, "Usage: warp <character name> | <x meter> <y meter>");
  453. return;
  454. }
  455.  
  456. int x = 0, y = 0;
  457.  
  458. if (isnhdigit(*arg1) && isnhdigit(*arg2))
  459. {
  460. str_to_number(x, arg1);
  461. str_to_number(y, arg2);
  462. }
  463. else
  464. {
  465. LPCHARACTER tch = CHARACTER_MANAGER::instance().FindPC(arg1);
  466.  
  467. if (NULL == tch)
  468. {
  469. const CCI* pkCCI = P2P_MANAGER::instance().Find(arg1);
  470.  
  471. if (NULL != pkCCI)
  472. {
  473. if (pkCCI->bChannel != g_bChannel)
  474. {
  475. ch->ChatPacket(CHAT_TYPE_INFO, "Target is in %d channel (my channel %d)", pkCCI->bChannel, g_bChannel);
  476. return;
  477. }
  478.  
  479. ch->WarpToPID( pkCCI->dwPID );
  480. }
  481. else
  482. {
  483. ch->ChatPacket(CHAT_TYPE_INFO, "There is no one by that name");
  484. }
  485.  
  486. return;
  487. }
  488. else
  489. {
  490. x = tch->GetX() / 100;
  491. y = tch->GetY() / 100;
  492. }
  493. }
  494.  
  495. x *= 100;
  496. y *= 100;
  497.  
  498. ch->ChatPacket(CHAT_TYPE_INFO, "You warp to ( %d, %d )", x, y);
  499. ch->WarpSet(x, y);
  500. ch->Stop();
  501. }
  502.  
  503. ACMD(do_item)
  504. {
  505. char arg1[256], arg2[256];
  506. two_arguments(argument, arg1, sizeof(arg1), arg2, sizeof(arg2));
  507.  
  508. if (!*arg1)
  509. {
  510. ch->ChatPacket(CHAT_TYPE_INFO, "Usage: item <item vnum>");
  511. return;
  512. }
  513.  
  514. int iCount = 1;
  515.  
  516. if (*arg2)
  517. {
  518. str_to_number(iCount, arg2);
  519. iCount = MINMAX(1, iCount, ITEM_MAX_COUNT);
  520. }
  521.  
  522. DWORD dwVnum;
  523.  
  524. if (isnhdigit(*arg1))
  525. str_to_number(dwVnum, arg1);
  526. else
  527. {
  528. if (!ITEM_MANAGER::instance().GetVnum(arg1, dwVnum))
  529. {
  530. ch->ChatPacket(CHAT_TYPE_INFO, "#%u item not exist by that vnum.", dwVnum);
  531. return;
  532. }
  533. }
  534.  
  535. LPITEM item = ITEM_MANAGER::instance().CreateItem(dwVnum, iCount, 0, true);
  536.  
  537. if (item)
  538. {
  539. if (item->IsDragonSoul())
  540. {
  541. int iEmptyPos = ch->GetEmptyDragonSoulInventory(item);
  542.  
  543. if (iEmptyPos != -1)
  544. {
  545. item->AddToCharacter(ch, TItemPos(DRAGON_SOUL_INVENTORY, iEmptyPos));
  546. LogManager::instance().ItemLog(ch, item, "GM", item->GetName());
  547. }
  548. else
  549. {
  550. M2_DESTROY_ITEM(item);
  551. if (!ch->DragonSoul_IsQualified())
  552. {
  553. ch->ChatPacket(CHAT_TYPE_INFO, "인벤이 활성화 되지 않음.");
  554. }
  555. else
  556. ch->ChatPacket(CHAT_TYPE_INFO, "Envanter dolu.");
  557. }
  558. }
  559. else
  560. {
  561. int iEmptyPos = ch->GetEmptyInventory(item->GetSize());
  562.  
  563. if (iEmptyPos != -1)
  564. {
  565. item->AddToCharacter(ch, TItemPos(INVENTORY, iEmptyPos));
  566. LogManager::instance().ItemLog(ch, item, "GM", item->GetName());
  567. }
  568. else
  569. {
  570. M2_DESTROY_ITEM(item);
  571. ch->ChatPacket(CHAT_TYPE_INFO, "Envanter dolu.");
  572. }
  573. }
  574. }
  575. else
  576. {
  577. ch->ChatPacket(CHAT_TYPE_INFO, "#%u item not exist by that vnum.", dwVnum);
  578. }
  579. }
  580.  
  581. ACMD(do_group_random)
  582. {
  583. char arg1[256];
  584. one_argument(argument, arg1, sizeof(arg1));
  585.  
  586. if (!*arg1)
  587. {
  588. ch->ChatPacket(CHAT_TYPE_INFO, "Usage: grrandom <group vnum>");
  589. return;
  590. }
  591.  
  592. DWORD dwVnum = 0;
  593. str_to_number(dwVnum, arg1);
  594. CHARACTER_MANAGER::instance().SpawnGroupGroup(dwVnum, ch->GetMapIndex(), ch->GetX() - 500, ch->GetY() - 500, ch->GetX() + 500, ch->GetY() + 500);
  595. }
  596.  
  597. ACMD(do_group)
  598. {
  599. char arg1[256];
  600. one_argument(argument, arg1, sizeof(arg1));
  601.  
  602. if (!*arg1)
  603. {
  604. ch->ChatPacket(CHAT_TYPE_INFO, "Usage: group <group vnum>");
  605. return;
  606. }
  607.  
  608. DWORD dwVnum = 0;
  609. str_to_number(dwVnum, arg1);
  610.  
  611. if (test_server)
  612. sys_log(0, "COMMAND GROUP SPAWN %u at %u %u %u", dwVnum, ch->GetMapIndex(), ch->GetX(), ch->GetY());
  613.  
  614. CHARACTER_MANAGER::instance().SpawnGroup(dwVnum, ch->GetMapIndex(), ch->GetX() - 500, ch->GetY() - 500, ch->GetX() + 500, ch->GetY() + 500);
  615. }
  616.  
  617. ACMD(do_mob_coward)
  618. {
  619. char arg1[256], arg2[256];
  620. DWORD vnum = 0;
  621. LPCHARACTER tch;
  622.  
  623. two_arguments(argument, arg1, sizeof(arg1), arg2, sizeof(arg2));
  624.  
  625. if (!*arg1)
  626. {
  627. ch->ChatPacket(CHAT_TYPE_INFO, "Usage: mc <vnum>");
  628. return;
  629. }
  630.  
  631. const CMob * pkMob;
  632.  
  633. if (isdigit(*arg1))
  634. {
  635. str_to_number(vnum, arg1);
  636.  
  637. if ((pkMob = CMobManager::instance().Get(vnum)) == NULL)
  638. vnum = 0;
  639. }
  640. else
  641. {
  642. pkMob = CMobManager::Instance().Get(arg1, true);
  643.  
  644. if (pkMob)
  645. vnum = pkMob->m_table.dwVnum;
  646. }
  647.  
  648. if (vnum == 0)
  649. {
  650. ch->ChatPacket(CHAT_TYPE_INFO, "No such mob by that vnum");
  651. return;
  652. }
  653.  
  654. int iCount = 0;
  655.  
  656. if (*arg2)
  657. str_to_number(iCount, arg2);
  658. else
  659. iCount = 1;
  660.  
  661. iCount = MIN(20, iCount);
  662.  
  663. while (iCount--)
  664. {
  665. tch = CHARACTER_MANAGER::instance().SpawnMobRange(vnum,
  666. ch->GetMapIndex(),
  667. ch->GetX() - number(200, 750),
  668. ch->GetY() - number(200, 750),
  669. ch->GetX() + number(200, 750),
  670. ch->GetY() + number(200, 750),
  671. true,
  672. pkMob->m_table.bType == CHAR_TYPE_STONE);
  673. if (tch)
  674. tch->SetCoward();
  675. }
  676. }
  677.  
  678. ACMD(do_mob_map)
  679. {
  680. char arg1[256];
  681. one_argument(argument, arg1, sizeof(arg1));
  682.  
  683. if (!*arg1)
  684. {
  685. ch->ChatPacket(CHAT_TYPE_INFO, "Syntax: mm <vnum>");
  686. return;
  687. }
  688.  
  689. DWORD vnum = 0;
  690. str_to_number(vnum, arg1);
  691. LPCHARACTER tch = CHARACTER_MANAGER::instance().SpawnMobRandomPosition(vnum, ch->GetMapIndex());
  692.  
  693. if (tch)
  694. ch->ChatPacket(CHAT_TYPE_INFO, "%s spawned in %dx%d", tch->GetName(), tch->GetX(), tch->GetY());
  695. else
  696. ch->ChatPacket(CHAT_TYPE_INFO, "Spawn failed.");
  697. }
  698.  
  699. ACMD(do_mob_aggresive)
  700. {
  701. char arg1[256], arg2[256];
  702. DWORD vnum = 0;
  703. LPCHARACTER tch;
  704.  
  705. two_arguments(argument, arg1, sizeof(arg1), arg2, sizeof(arg2));
  706.  
  707. if (!*arg1)
  708. {
  709. ch->ChatPacket(CHAT_TYPE_INFO, "Usage: mob <mob vnum>");
  710. return;
  711. }
  712.  
  713. const CMob * pkMob;
  714.  
  715. if (isdigit(*arg1))
  716. {
  717. str_to_number(vnum, arg1);
  718.  
  719. if ((pkMob = CMobManager::instance().Get(vnum)) == NULL)
  720. vnum = 0;
  721. }
  722. else
  723. {
  724. pkMob = CMobManager::Instance().Get(arg1, true);
  725.  
  726. if (pkMob)
  727. vnum = pkMob->m_table.dwVnum;
  728. }
  729.  
  730. if (vnum == 0)
  731. {
  732. ch->ChatPacket(CHAT_TYPE_INFO, "No such mob by that vnum");
  733. return;
  734. }
  735.  
  736. int iCount = 0;
  737.  
  738. if (*arg2)
  739. str_to_number(iCount, arg2);
  740. else
  741. iCount = 1;
  742.  
  743. iCount = MIN(20, iCount);
  744.  
  745. while (iCount--)
  746. {
  747. tch = CHARACTER_MANAGER::instance().SpawnMobRange(vnum,
  748. ch->GetMapIndex(),
  749. ch->GetX() - number(200, 750),
  750. ch->GetY() - number(200, 750),
  751. ch->GetX() + number(200, 750),
  752. ch->GetY() + number(200, 750),
  753. true,
  754. pkMob->m_table.bType == CHAR_TYPE_STONE);
  755. if (tch)
  756. tch->SetAggressive();
  757. }
  758. }
  759.  
  760. ACMD(do_mob)
  761. {
  762. char arg1[256], arg2[256];
  763. DWORD vnum = 0;
  764.  
  765. two_arguments(argument, arg1, sizeof(arg1), arg2, sizeof(arg2));
  766.  
  767. if (!*arg1)
  768. {
  769. ch->ChatPacket(CHAT_TYPE_INFO, "Usage: mob <mob vnum>");
  770. return;
  771. }
  772.  
  773. const CMob* pkMob = NULL;
  774.  
  775. if (isnhdigit(*arg1))
  776. {
  777. str_to_number(vnum, arg1);
  778.  
  779. if ((pkMob = CMobManager::instance().Get(vnum)) == NULL)
  780. vnum = 0;
  781. }
  782. else
  783. {
  784. pkMob = CMobManager::Instance().Get(arg1, true);
  785.  
  786. if (pkMob)
  787. vnum = pkMob->m_table.dwVnum;
  788. }
  789.  
  790. if (vnum == 0)
  791. {
  792. ch->ChatPacket(CHAT_TYPE_INFO, "No such mob by that vnum");
  793. return;
  794. }
  795.  
  796. int iCount = 0;
  797.  
  798. if (*arg2)
  799. str_to_number(iCount, arg2);
  800. else
  801. iCount = 1;
  802.  
  803. if (test_server)
  804. iCount = MIN(40, iCount);
  805. else
  806. iCount = MIN(20, iCount);
  807.  
  808. while (iCount--)
  809. {
  810. CHARACTER_MANAGER::instance().SpawnMobRange(vnum,
  811. ch->GetMapIndex(),
  812. ch->GetX() - number(200, 750),
  813. ch->GetY() - number(200, 750),
  814. ch->GetX() + number(200, 750),
  815. ch->GetY() + number(200, 750),
  816. true,
  817. pkMob->m_table.bType == CHAR_TYPE_STONE);
  818. }
  819. }
  820.  
  821. ACMD(do_mob_ld)
  822. {
  823. char arg1[256], arg2[256], arg3[256], arg4[256];
  824. DWORD vnum = 0;
  825.  
  826. two_arguments(two_arguments(argument, arg1, sizeof(arg1), arg2, sizeof(arg2)), arg3, sizeof(arg3), arg4, sizeof(arg4));
  827.  
  828. if (!*arg1)
  829. {
  830. ch->ChatPacket(CHAT_TYPE_INFO, "Usage: mob <mob vnum>");
  831. return;
  832. }
  833.  
  834. const CMob* pkMob = NULL;
  835.  
  836. if (isnhdigit(*arg1))
  837. {
  838. str_to_number(vnum, arg1);
  839.  
  840. if ((pkMob = CMobManager::instance().Get(vnum)) == NULL)
  841. vnum = 0;
  842. }
  843. else
  844. {
  845. pkMob = CMobManager::Instance().Get(arg1, true);
  846.  
  847. if (pkMob)
  848. vnum = pkMob->m_table.dwVnum;
  849. }
  850.  
  851. if (vnum == 0)
  852. {
  853. ch->ChatPacket(CHAT_TYPE_INFO, "No such mob by that vnum");
  854. return;
  855. }
  856.  
  857. int dir = 1;
  858. long x,y;
  859.  
  860. if (*arg2)
  861. str_to_number(x, arg2);
  862. if (*arg3)
  863. str_to_number(y, arg3);
  864. if (*arg4)
  865. str_to_number(dir, arg4);
  866.  
  867.  
  868. CHARACTER_MANAGER::instance().SpawnMob(vnum,
  869. ch->GetMapIndex(),
  870. x*100,
  871. y*100,
  872. ch->GetZ(),
  873. pkMob->m_table.bType == CHAR_TYPE_STONE,
  874. dir);
  875. }
  876.  
  877. struct FuncPurge
  878. {
  879. LPCHARACTER m_pkGM;
  880. bool m_bAll;
  881.  
  882. FuncPurge(LPCHARACTER ch) : m_pkGM(ch), m_bAll(false)
  883. {
  884. }
  885.  
  886. void operator () (LPENTITY ent)
  887. {
  888. if (!ent->IsType(ENTITY_CHARACTER))
  889. return;
  890.  
  891. LPCHARACTER pkChr = (LPCHARACTER) ent;
  892.  
  893. int iDist = DISTANCE_APPROX(pkChr->GetX() - m_pkGM->GetX(), pkChr->GetY() - m_pkGM->GetY());
  894.  
  895. if (!m_bAll && iDist >= 1000) // 10미터 이상에 있는 것들은 purge 하지 않는다.
  896. return;
  897.  
  898. sys_log(0, "PURGE: %s %d", pkChr->GetName(), iDist);
  899.  
  900. #ifdef NEW_PET_SYSTEM
  901. if (!pkChr->IsOfflineShopNPC() && pkChr->GetRaceNum() != 30007 && pkChr->GetRaceNum() != 30007 && pkChr->GetRaceNum() != 30009 && pkChr->GetRaceNum() != 30010 && pkChr->GetRaceNum() != 30008 && pkChr->IsNPC() && pkChr->IsNPC() && !pkChr->IsPet() && !pkChr->IsNewPet() && pkChr->GetRider() == NULL)
  902. #else
  903. if (!pkChr->IsOfflineShopNPC() && pkChr->GetRaceNum() != 30000 && ppkChr->IsNPC() && !pkChr->IsPet() && pkChr->GetRider() == NULL)
  904. #endif
  905. {
  906. M2_DESTROY_CHARACTER(pkChr);
  907. }
  908. }
  909. };
  910.  
  911. ACMD(do_purge)
  912. {
  913. char arg1[256];
  914. one_argument(argument, arg1, sizeof(arg1));
  915.  
  916. FuncPurge func(ch);
  917.  
  918. if (*arg1 && !strcmp(arg1, "map"))
  919. {
  920. CHARACTER_MANAGER::instance().DestroyCharacterInMap(ch->GetMapIndex());
  921. }
  922. else
  923. {
  924. if (*arg1 && !strcmp(arg1, "all"))
  925. func.m_bAll = true;
  926. LPSECTREE sectree = ch->GetSectree();
  927. if (sectree) // #431
  928. sectree->ForEachAround(func);
  929. else
  930. sys_err("PURGE_ERROR.NULL_SECTREE(mapIndex=%d, pos=(%d, %d)", ch->GetMapIndex(), ch->GetX(), ch->GetY());
  931. }
  932. }
  933.  
  934. ACMD(reload_regen)
  935. {
  936. std::vector<LPEVENT> regenEvent = SECTREE_MANAGER::instance().GetRegenEvent(ch->GetMapIndex());
  937. for (std::vector<LPEVENT>::iterator it = regenEvent.begin(); it != regenEvent.end(); ++it)
  938. {
  939. event_cancel(&(*it));
  940. }
  941. FuncPurge func(ch);
  942. func.m_bAll = true;
  943. LPSECTREE_MAP lm = SECTREE_MANAGER::instance().GetMap(ch->GetMapIndex());
  944. lm->for_each(func);
  945. char * mapIndex;
  946. mapIndex = number_to_str(ch->GetMapIndex(), 10);
  947. SECTREE_MANAGER::instance().BuildMap(mapIndex, LocaleService_GetMapPath().c_str());
  948. }
  949.  
  950. ACMD(do_item_purge)
  951. {
  952. #ifdef NEW_PET_SYSTEM
  953. if (ch->GetNewPetSystem()->IsActivePet())
  954. {
  955. ch->ChatPacket(CHAT_TYPE_INFO, "PET_BLOCK");
  956. return ;
  957. }
  958. #endif
  959.  
  960. int i;
  961. LPITEM item;
  962.  
  963. for (i = 0; i < INVENTORY_AND_EQUIP_SLOT_MAX; ++i)
  964. {
  965. if ((item = ch->GetInventoryItem(i)))
  966. {
  967. ITEM_MANAGER::instance().RemoveItem(item, "PURGE");
  968. ch->SyncQuickslot(QUICKSLOT_TYPE_ITEM, i, 255);
  969. }
  970. }
  971. for (i = 0; i < DRAGON_SOUL_INVENTORY_MAX_NUM; ++i)
  972. {
  973. if ((item = ch->GetItem(TItemPos(DRAGON_SOUL_INVENTORY, i ))))
  974. {
  975. ITEM_MANAGER::instance().RemoveItem(item, "PURGE");
  976. }
  977. }
  978.  
  979. #ifdef __WEAPON_COSTUME_SYSTEM__
  980. if (ch)
  981. {
  982. ch->SetPart(PART_WEAPON, 0);
  983. ch->UpdatePacket();
  984. }
  985. #endif
  986. }
  987.  
  988. ACMD(do_state)
  989. {
  990. char arg1[256];
  991. LPCHARACTER tch;
  992.  
  993. one_argument(argument, arg1, sizeof(arg1));
  994. if (*arg1)
  995. {
  996. if (arg1[0] == '#')
  997. {
  998. tch = CHARACTER_MANAGER::instance().Find(strtoul(arg1+1, NULL, 10));
  999. }
  1000. else
  1001. {
  1002. LPDESC d = DESC_MANAGER::instance().FindByCharacterName(arg1);
  1003. if (!d)
  1004. tch = NULL;
  1005. else
  1006. tch = d->GetCharacter();
  1007. }
  1008. }
  1009. else
  1010. tch = ch;
  1011.  
  1012. if (!tch)
  1013. return;
  1014.  
  1015. char buf[256];
  1016. snprintf(buf, sizeof(buf), "%s's State: ", tch->GetName());
  1017.  
  1018. if (tch->IsPosition(POS_FIGHTING))
  1019. strlcat(buf, "Battle", sizeof(buf));
  1020. else if (tch->IsPosition(POS_DEAD))
  1021. strlcat(buf, "Dead", sizeof(buf));
  1022. else
  1023. strlcat(buf, "Standing", sizeof(buf));
  1024.  
  1025. if (ch->GetShop())
  1026. strlcat(buf, ", Shop", sizeof(buf));
  1027.  
  1028. if (ch->GetOfflineShop())
  1029. strlcat(buf, ", Offline Shop", sizeof(buf));
  1030.  
  1031. if (ch->GetExchange())
  1032. strlcat(buf, ", Exchange", sizeof(buf));
  1033.  
  1034. ch->ChatPacket(CHAT_TYPE_INFO, "%s", buf);
  1035.  
  1036. int len;
  1037. len = snprintf(buf, sizeof(buf), "Coordinate %ldx%ld (%ldx%ld)",
  1038. tch->GetX(), tch->GetY(), tch->GetX() / 100, tch->GetY() / 100);
  1039.  
  1040. if (len < 0 || len >= (int) sizeof(buf))
  1041. len = sizeof(buf) - 1;
  1042.  
  1043. LPSECTREE pSec = SECTREE_MANAGER::instance().Get(tch->GetMapIndex(), tch->GetX(), tch->GetY());
  1044. if (pSec)
  1045. {
  1046. TMapSetting& map_setting = SECTREE_MANAGER::instance().GetMap(tch->GetMapIndex())->m_setting;
  1047. snprintf(buf + len, sizeof(buf) - len, " MapIndex %ld Attribute %08X Local Position (%ld x %ld)", tch->GetMapIndex(), pSec->GetAttribute(tch->GetX(), tch->GetY()), (tch->GetX() - map_setting.iBaseX)/100, (tch->GetY() - map_setting.iBaseY)/100);
  1048. }
  1049.  
  1050. ch->ChatPacket(CHAT_TYPE_INFO, "%s", buf);
  1051. ch->ChatPacket(CHAT_TYPE_INFO, "LEV %d", tch->GetLevel());
  1052. ch->ChatPacket(CHAT_TYPE_INFO, "HP %d/%d", tch->GetHP(), tch->GetMaxHP());
  1053. ch->ChatPacket(CHAT_TYPE_INFO, "SP %d/%d", tch->GetSP(), tch->GetMaxSP());
  1054. ch->ChatPacket(CHAT_TYPE_INFO, "ATT %d MAGIC_ATT %d SPD %d CRIT %d%% PENE %d%% ATT_BONUS %d%%", tch->GetPoint(POINT_ATT_GRADE), tch->GetPoint(POINT_MAGIC_ATT_GRADE), tch->GetPoint(POINT_ATT_SPEED), tch->GetPoint(POINT_CRITICAL_PCT), tch->GetPoint(POINT_PENETRATE_PCT), tch->GetPoint(POINT_ATT_BONUS));
  1055. ch->ChatPacket(CHAT_TYPE_INFO, "DEF %d MAGIC_DEF %d BLOCK %d%% DODGE %d%% DEF_BONUS %d%%", tch->GetPoint(POINT_DEF_GRADE), tch->GetPoint(POINT_MAGIC_DEF_GRADE), tch->GetPoint(POINT_BLOCK), tch->GetPoint(POINT_DODGE), tch->GetPoint(POINT_DEF_BONUS));
  1056.  
  1057. ch->ChatPacket(CHAT_TYPE_INFO, "RESISTANCES:");
  1058. ch->ChatPacket(CHAT_TYPE_INFO, " WARR:%3d%% ASAS:%3d%% SURA:%3d%% SHAM:%3d%% WOLF:%3d%%", tch->GetPoint(POINT_RESIST_WARRIOR), tch->GetPoint(POINT_RESIST_ASSASSIN), tch->GetPoint(POINT_RESIST_SURA), tch->GetPoint(POINT_RESIST_SHAMAN), tch->GetPoint(POINT_RESIST_WOLFMAN));
  1059. ch->ChatPacket(CHAT_TYPE_INFO, " SWORD:%3d%% THSWORD:%3d%% DAGGER:%3d%% BELL:%3d%% FAN:%3d%% BOW:%3d%% CLAW:%3d%%", tch->GetPoint(POINT_RESIST_SWORD), tch->GetPoint(POINT_RESIST_TWOHAND), tch->GetPoint(POINT_RESIST_DAGGER), tch->GetPoint(POINT_RESIST_BELL), tch->GetPoint(POINT_RESIST_FAN), tch->GetPoint(POINT_RESIST_BOW), tch->GetPoint(POINT_RESIST_CLAW));
  1060. #ifdef __ANTI_RESIST_MAGIC_BONUS__
  1061. ch->ChatPacket(CHAT_TYPE_INFO, " FIRE:%3d%% ELEC:%3d%% MAGIC:%3d%% WIND:%3d%% CRIT:%3d%% PENE:%3d%% ANTI-MAGIC:%3d%%", tch->GetPoint(POINT_RESIST_FIRE), tch->GetPoint(POINT_RESIST_ELEC), tch->GetPoint(POINT_RESIST_MAGIC), tch->GetPoint(POINT_RESIST_WIND), tch->GetPoint(POINT_RESIST_CRITICAL), tch->GetPoint(POINT_RESIST_PENETRATE), tch->GetPoint(POINT_ANTI_RESIST_MAGIC));
  1062. #else
  1063. ch->ChatPacket(CHAT_TYPE_INFO, " FIRE:%3d%% ELEC:%3d%% MAGIC:%3d%% WIND:%3d%% CRIT:%3d%% PENE:%3d%%", tch->GetPoint(POINT_RESIST_FIRE), tch->GetPoint(POINT_RESIST_ELEC), tch->GetPoint(POINT_RESIST_MAGIC), tch->GetPoint(POINT_RESIST_WIND), tch->GetPoint(POINT_RESIST_CRITICAL), tch->GetPoint(POINT_RESIST_PENETRATE));
  1064. #endif
  1065. ch->ChatPacket(CHAT_TYPE_INFO, " ICE:%3d%% EARTH:%3d%% DARK:%3d%%", tch->GetPoint(POINT_RESIST_ICE), tch->GetPoint(POINT_RESIST_EARTH), tch->GetPoint(POINT_RESIST_DARK));
  1066.  
  1067. ch->ChatPacket(CHAT_TYPE_INFO, "MALL:");
  1068. ch->ChatPacket(CHAT_TYPE_INFO, " ATT:%3d%% DEF:%3d%% EXP:%3d%% ITEMx%d GOLDx%d", tch->GetPoint(POINT_MALL_ATTBONUS), tch->GetPoint(POINT_MALL_DEFBONUS), tch->GetPoint(POINT_MALL_EXPBONUS), tch->GetPoint(POINT_MALL_ITEMBONUS) / 10, tch->GetPoint(POINT_MALL_GOLDBONUS) / 10);
  1069.  
  1070. ch->ChatPacket(CHAT_TYPE_INFO, "BONUS:");
  1071. ch->ChatPacket(CHAT_TYPE_INFO, " SKILL:%3d%% NORMAL:%3d%% SKILL_DEF:%3d%% NORMAL_DEF:%3d%%",tch->GetPoint(POINT_SKILL_DAMAGE_BONUS), tch->GetPoint(POINT_NORMAL_HIT_DAMAGE_BONUS), tch->GetPoint(POINT_SKILL_DEFEND_BONUS), tch->GetPoint(POINT_NORMAL_HIT_DEFEND_BONUS));
  1072. ch->ChatPacket(CHAT_TYPE_INFO, " HUMAN:%3d%% ANIMAL:%3d%% ORC:%3d%% MILGYO:%3d%% UNDEAD:%3d%%", tch->GetPoint(POINT_ATTBONUS_HUMAN), tch->GetPoint(POINT_ATTBONUS_ANIMAL), tch->GetPoint(POINT_ATTBONUS_ORC), tch->GetPoint(POINT_ATTBONUS_MILGYO), tch->GetPoint(POINT_ATTBONUS_UNDEAD));
  1073. ch->ChatPacket(CHAT_TYPE_INFO, " DEVIL:%3d%% INSECT:%3d%% FIRE:%3d%% ICE:%3d%% DESERT:%3d%%", tch->GetPoint(POINT_ATTBONUS_DEVIL), tch->GetPoint(POINT_ATTBONUS_INSECT), tch->GetPoint(POINT_ATTBONUS_FIRE), tch->GetPoint(POINT_ATTBONUS_ICE), tch->GetPoint(POINT_ATTBONUS_DESERT));
  1074. ch->ChatPacket(CHAT_TYPE_INFO, " TREE:%3d%% MONSTER:%3d%%", tch->GetPoint(POINT_ATTBONUS_TREE), tch->GetPoint(POINT_ATTBONUS_MONSTER));
  1075. ch->ChatPacket(CHAT_TYPE_INFO, " WARR:%3d%% ASAS:%3d%% SURA:%3d%% SHAM:%3d%% WOLF:%3d%%", tch->GetPoint(POINT_ATTBONUS_WARRIOR), tch->GetPoint(POINT_ATTBONUS_ASSASSIN), tch->GetPoint(POINT_ATTBONUS_SURA), tch->GetPoint(POINT_ATTBONUS_SHAMAN), tch->GetPoint(POINT_ATTBONUS_WOLFMAN));
  1076.  
  1077. for (int i = 0; i < MAX_PRIV_NUM; ++i)
  1078. if (CPrivManager::instance().GetPriv(tch, i))
  1079. {
  1080. int iByEmpire = CPrivManager::instance().GetPrivByEmpire(tch->GetEmpire(), i);
  1081. int iByGuild = 0;
  1082.  
  1083. if (tch->GetGuild())
  1084. iByGuild = CPrivManager::instance().GetPrivByGuild(tch->GetGuild()->GetID(), i);
  1085.  
  1086. int iByPlayer = CPrivManager::instance().GetPrivByCharacter(tch->GetPlayerID(), i);
  1087.  
  1088. if (iByEmpire)
  1089. ch->ChatPacket(CHAT_TYPE_INFO, "%s for empire : %d", LC_TEXT(c_apszPrivNames[i]), iByEmpire);
  1090.  
  1091. if (iByGuild)
  1092. ch->ChatPacket(CHAT_TYPE_INFO, "%s for guild : %d", LC_TEXT(c_apszPrivNames[i]), iByGuild);
  1093.  
  1094. if (iByPlayer)
  1095. ch->ChatPacket(CHAT_TYPE_INFO, "%s for player : %d", LC_TEXT(c_apszPrivNames[i]), iByPlayer);
  1096. }
  1097. }
  1098.  
  1099. struct notice_packet_func
  1100. {
  1101. const char * m_str;
  1102.  
  1103. notice_packet_func(const char * str) : m_str(str)
  1104. {
  1105. }
  1106.  
  1107. void operator () (LPDESC d)
  1108. {
  1109. if (!d->GetCharacter())
  1110. return;
  1111.  
  1112. d->GetCharacter()->ChatPacket(CHAT_TYPE_NOTICE, "%s", m_str);
  1113. }
  1114. };
  1115.  
  1116. struct monarch_notice_packet_func
  1117. {
  1118. const char * m_str;
  1119. BYTE m_bEmpire;
  1120.  
  1121. monarch_notice_packet_func(BYTE bEmpire, const char * str) : m_str(str), m_bEmpire(bEmpire)
  1122. {
  1123. }
  1124.  
  1125. void operator () (LPDESC d)
  1126. {
  1127. if (!d->GetCharacter())
  1128. return;
  1129.  
  1130. if (m_bEmpire == d->GetCharacter()->GetEmpire())
  1131. {
  1132. d->GetCharacter()->ChatPacket(CHAT_TYPE_NOTICE, "%s", m_str);
  1133. }
  1134. }
  1135. };
  1136.  
  1137.  
  1138. void SendNotice(const char * c_pszBuf)
  1139. {
  1140. const DESC_MANAGER::DESC_SET & c_ref_set = DESC_MANAGER::instance().GetClientSet();
  1141. std::for_each(c_ref_set.begin(), c_ref_set.end(), notice_packet_func(c_pszBuf));
  1142. }
  1143.  
  1144. void SendMonarchNotice(BYTE bEmpire, const char* c_pszBuf)
  1145. {
  1146. const DESC_MANAGER::DESC_SET & c_ref_set = DESC_MANAGER::instance().GetClientSet();
  1147. std::for_each(c_ref_set.begin(), c_ref_set.end(), monarch_notice_packet_func(bEmpire, c_pszBuf));
  1148. }
  1149.  
  1150. struct notice_map_packet_func
  1151. {
  1152. const char* m_str;
  1153. int m_mapIndex;
  1154. bool m_bBigFont;
  1155.  
  1156. notice_map_packet_func(const char* str, int idx, bool bBigFont) : m_str(str), m_mapIndex(idx), m_bBigFont(bBigFont)
  1157. {
  1158. }
  1159.  
  1160. void operator() (LPDESC d)
  1161. {
  1162. if (d->GetCharacter() == NULL) return;
  1163. if (d->GetCharacter()->GetMapIndex() != m_mapIndex) return;
  1164.  
  1165. d->GetCharacter()->ChatPacket(m_bBigFont == true ? CHAT_TYPE_BIG_NOTICE : CHAT_TYPE_NOTICE, "%s", m_str);
  1166. }
  1167. };
  1168.  
  1169. void SendNoticeMap(const char* c_pszBuf, int nMapIndex, bool bBigFont)
  1170. {
  1171. const DESC_MANAGER::DESC_SET & c_ref_set = DESC_MANAGER::instance().GetClientSet();
  1172. std::for_each(c_ref_set.begin(), c_ref_set.end(), notice_map_packet_func(c_pszBuf, nMapIndex, bBigFont));
  1173. }
  1174.  
  1175. struct log_packet_func
  1176. {
  1177. const char * m_str;
  1178.  
  1179. log_packet_func(const char * str) : m_str(str)
  1180. {
  1181. }
  1182.  
  1183. void operator () (LPDESC d)
  1184. {
  1185. if (!d->GetCharacter())
  1186. return;
  1187.  
  1188. if (d->GetCharacter()->GetGMLevel() > GM_PLAYER)
  1189. d->GetCharacter()->ChatPacket(CHAT_TYPE_NOTICE, "%s", m_str);
  1190. }
  1191. };
  1192.  
  1193.  
  1194. void SendLog(const char * c_pszBuf)
  1195. {
  1196. const DESC_MANAGER::DESC_SET & c_ref_set = DESC_MANAGER::instance().GetClientSet();
  1197. std::for_each(c_ref_set.begin(), c_ref_set.end(), log_packet_func(c_pszBuf));
  1198. }
  1199.  
  1200. void BroadcastNotice(const char * c_pszBuf)
  1201. {
  1202. TPacketGGNotice p;
  1203. p.bHeader = HEADER_GG_NOTICE;
  1204. p.lSize = strlen(c_pszBuf) + 1;
  1205.  
  1206. TEMP_BUFFER buf;
  1207. buf.write(&p, sizeof(p));
  1208. buf.write(c_pszBuf, p.lSize);
  1209.  
  1210. P2P_MANAGER::instance().Send(buf.read_peek(), buf.size()); // HEADER_GG_NOTICE
  1211.  
  1212. SendNotice(c_pszBuf);
  1213. }
  1214.  
  1215. void BroadcastMonarchNotice(BYTE bEmpire, const char * c_pszBuf)
  1216. {
  1217. TPacketGGMonarchNotice p;
  1218. p.bHeader = HEADER_GG_MONARCH_NOTICE;
  1219. p.bEmpire = bEmpire;
  1220. p.lSize = strlen(c_pszBuf) + 1;
  1221.  
  1222. TEMP_BUFFER buf;
  1223. buf.write(&p, sizeof(p));
  1224. buf.write(c_pszBuf, p.lSize);
  1225.  
  1226. P2P_MANAGER::instance().Send(buf.read_peek(), buf.size());
  1227.  
  1228. SendMonarchNotice(bEmpire, c_pszBuf);
  1229. }
  1230.  
  1231. ACMD(do_notice)
  1232. {
  1233. char chatbuf[CHAT_MAX_LEN + 1];
  1234. snprintf(chatbuf, sizeof(chatbuf), "%s :%s", ch->GetName(), argument);
  1235. BroadcastNotice(chatbuf);
  1236. }
  1237.  
  1238. ACMD(do_map_notice)
  1239. {
  1240. SendNoticeMap(argument, ch->GetMapIndex(), false);
  1241. }
  1242.  
  1243. ACMD(do_big_notice)
  1244. {
  1245. ch->ChatPacket(CHAT_TYPE_BIG_NOTICE, "%s", argument);
  1246. }
  1247.  
  1248. ACMD(do_monarch_notice)
  1249. {
  1250. if (ch->IsMonarch() == true)
  1251. {
  1252. BroadcastMonarchNotice(ch->GetEmpire(), argument);
  1253. }
  1254. else
  1255. {
  1256. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("군주만이 사용 가능한 기능입니다"));
  1257. }
  1258. }
  1259.  
  1260. ACMD(do_who)
  1261. {
  1262. int iTotal;
  1263. int * paiEmpireUserCount;
  1264. int iLocal;
  1265.  
  1266. DESC_MANAGER::instance().GetUserCount(iTotal, &paiEmpireUserCount, iLocal);
  1267.  
  1268. ch->ChatPacket(CHAT_TYPE_INFO, "Total [%d] %d / %d / %d (this server %d)",
  1269. iTotal, paiEmpireUserCount[1], paiEmpireUserCount[2], paiEmpireUserCount[3], iLocal);
  1270. }
  1271.  
  1272. class user_func
  1273. {
  1274. public:
  1275. LPCHARACTER m_ch;
  1276. static int count;
  1277. static char str[128];
  1278. static int str_len;
  1279.  
  1280. user_func()
  1281. : m_ch(NULL)
  1282. {}
  1283.  
  1284. void initialize(LPCHARACTER ch)
  1285. {
  1286. m_ch = ch;
  1287. str_len = 0;
  1288. count = 0;
  1289. str[0] = '\0';
  1290. }
  1291.  
  1292. void operator () (LPDESC d)
  1293. {
  1294. if (!d->GetCharacter())
  1295. return;
  1296.  
  1297. int len = snprintf(str + str_len, sizeof(str) - str_len, "%-16s ", d->GetCharacter()->GetName());
  1298.  
  1299. if (len < 0 || len >= (int) sizeof(str) - str_len)
  1300. len = (sizeof(str) - str_len) - 1;
  1301.  
  1302. str_len += len;
  1303. ++count;
  1304.  
  1305. if (!(count % 4))
  1306. {
  1307. m_ch->ChatPacket(CHAT_TYPE_INFO, str);
  1308.  
  1309. str[0] = '\0';
  1310. str_len = 0;
  1311. }
  1312. }
  1313. };
  1314.  
  1315. int user_func::count = 0;
  1316. char user_func::str[128] = { 0, };
  1317. int user_func::str_len = 0;
  1318.  
  1319. ACMD(do_user)
  1320. {
  1321. const DESC_MANAGER::DESC_SET & c_ref_set = DESC_MANAGER::instance().GetClientSet();
  1322. user_func func;
  1323.  
  1324. func.initialize(ch);
  1325. std::for_each(c_ref_set.begin(), c_ref_set.end(), func);
  1326.  
  1327. if (func.count % 4)
  1328. ch->ChatPacket(CHAT_TYPE_INFO, func.str);
  1329.  
  1330. ch->ChatPacket(CHAT_TYPE_INFO, "Total %d", func.count);
  1331. }
  1332.  
  1333. struct FFindOfflineShop
  1334. {
  1335. const char * szName;
  1336. bool bResult;
  1337.  
  1338. FFindOfflineShop(const char * c_szName) : szName(c_szName), bResult(false) {};
  1339.  
  1340. void operator()(LPENTITY ent)
  1341. {
  1342. if (!ent)
  1343. return;
  1344.  
  1345. if (ent->IsType(ENTITY_CHARACTER))
  1346. {
  1347. LPCHARACTER ch = (LPCHARACTER)ent;
  1348. if (ch->IsOfflineShopNPC() && !strcmp(szName, ch->GetName()))
  1349. {
  1350. bResult = true;
  1351. ch->DestroyOfflineShop();
  1352. }
  1353. }
  1354. }
  1355. };
  1356.  
  1357. ACMD(do_disconnect)
  1358. {
  1359. char arg1[256];
  1360. char arg2[256];
  1361.  
  1362. //one_argument(argument, arg1, sizeof(arg1));
  1363. two_arguments(argument, arg1, sizeof(arg1), arg2, sizeof(arg2));
  1364.  
  1365. if (!*arg1)
  1366. {
  1367. ch->ChatPacket(CHAT_TYPE_INFO, "ex) /dc <player name>");
  1368. return;
  1369. }
  1370.  
  1371. if (*arg2 && !strcmp(arg2, "offlineshop"))
  1372. {
  1373. LPSECTREE_MAP pMap = SECTREE_MANAGER::instance().GetMap(ch->GetMapIndex());
  1374. if (pMap)
  1375. {
  1376. FFindOfflineShop offlineShop(arg1);
  1377. pMap->for_each(offlineShop);
  1378. if (offlineShop.bResult)
  1379. ch->ChatPacket(CHAT_TYPE_INFO, "%s offline shop is destroyed!", arg1);
  1380. }
  1381. }
  1382.  
  1383. LPDESC d = DESC_MANAGER::instance().FindByCharacterName(arg1);
  1384. LPCHARACTER tch = d ? d->GetCharacter() : NULL;
  1385.  
  1386. if (!tch)
  1387. {
  1388. ch->ChatPacket(CHAT_TYPE_INFO, "%s: no such a player.", arg1);
  1389. return;
  1390. }
  1391.  
  1392. if (tch == ch)
  1393. {
  1394. ch->ChatPacket(CHAT_TYPE_INFO, "cannot disconnect myself");
  1395. return;
  1396. }
  1397.  
  1398. DESC_MANAGER::instance().DestroyDesc(d);
  1399. }
  1400.  
  1401. ACMD(do_kill)
  1402. {
  1403. char arg1[256];
  1404. one_argument(argument, arg1, sizeof(arg1));
  1405.  
  1406. if (!*arg1)
  1407. {
  1408. ch->ChatPacket(CHAT_TYPE_INFO, "ex) /kill <player name>");
  1409. return;
  1410. }
  1411.  
  1412. LPDESC d = DESC_MANAGER::instance().FindByCharacterName(arg1);
  1413. LPCHARACTER tch = d ? d->GetCharacter() : NULL;
  1414.  
  1415. if (!tch)
  1416. {
  1417. ch->ChatPacket(CHAT_TYPE_INFO, "%s: no such a player", arg1);
  1418. return;
  1419. }
  1420.  
  1421. tch->Dead();
  1422. }
  1423.  
  1424. ACMD(do_bleeding)
  1425. {
  1426. char arg1[256];
  1427. one_argument(argument, arg1, sizeof(arg1));
  1428.  
  1429. if (!*arg1)
  1430. {
  1431. ch->ChatPacket(CHAT_TYPE_INFO, "ex) /bleeding <player name>");
  1432. return;
  1433. }
  1434.  
  1435. LPDESC d = DESC_MANAGER::instance().FindByCharacterName(arg1);
  1436. LPCHARACTER tch = d ? d->GetCharacter() : NULL;
  1437.  
  1438. if (!tch)
  1439. {
  1440. ch->ChatPacket(CHAT_TYPE_INFO, "%s: no such a player", arg1);
  1441. return;
  1442. }
  1443.  
  1444. tch->AttackedByBleeding(NULL);
  1445. }
  1446.  
  1447. ACMD(do_poison)
  1448. {
  1449. char arg1[256];
  1450. one_argument(argument, arg1, sizeof(arg1));
  1451.  
  1452. if (!*arg1)
  1453. {
  1454. ch->ChatPacket(CHAT_TYPE_INFO, "ex) /poison <player name>");
  1455. return;
  1456. }
  1457.  
  1458. LPDESC d = DESC_MANAGER::instance().FindByCharacterName(arg1);
  1459. LPCHARACTER tch = d ? d->GetCharacter() : NULL;
  1460.  
  1461. if (!tch)
  1462. {
  1463. ch->ChatPacket(CHAT_TYPE_INFO, "%s: no such a player", arg1);
  1464. return;
  1465. }
  1466.  
  1467. tch->AttackedByPoison(NULL);
  1468. }
  1469.  
  1470. #define MISC 0
  1471. #define BINARY 1
  1472. #define NUMBER 2
  1473.  
  1474. namespace DoSetTypes{
  1475. typedef enum do_set_types_s {GOLD, RACE, SEX, JOB, EXP, MAX_HP, MAX_SP, SKILL, ALIGNMENT, ALIGN, YENI_BIRIM} do_set_types_t;
  1476. }
  1477.  
  1478. const struct set_struct
  1479. {
  1480. const char *cmd;
  1481. const char type;
  1482. const char * help;
  1483. } set_fields[] = {
  1484. { "gold", NUMBER, NULL },
  1485. { "race", NUMBER, "0. Savasci, 1. Ninja, 2. Sura, 3. Saman, 4. Lycan" },
  1486. { "sex", NUMBER, "0. Erkek, 1. Kadin" },
  1487. { "job", NUMBER, "0. Yok, 1. Birinci, 2. Ikinci" },
  1488. { "exp", NUMBER, NULL },
  1489. { "max_hp", NUMBER, NULL },
  1490. { "max_sp", NUMBER, NULL },
  1491. { "skill", NUMBER, NULL },
  1492. { "alignment", NUMBER, NULL },
  1493. { "align", NUMBER, NULL },
  1494. { "won", NUMBER, NULL },
  1495. { "yenibirim", NUMBER, NULL },
  1496. { "\n", MISC, NULL }
  1497. };
  1498.  
  1499. ACMD(do_set)
  1500. {
  1501. char arg1[256], arg2[256], arg3[256];
  1502.  
  1503. LPCHARACTER tch = NULL;
  1504.  
  1505. int i, len;
  1506. const char* line;
  1507.  
  1508. line = two_arguments(argument, arg1, sizeof(arg1), arg2, sizeof(arg2));
  1509. one_argument(line, arg3, sizeof(arg3));
  1510.  
  1511. if (!*arg1 || !*arg2 || !*arg3)
  1512. {
  1513. ch->ChatPacket(CHAT_TYPE_INFO, "Kullanim: set <name> <field> <value>");
  1514. ch->ChatPacket(CHAT_TYPE_INFO, "List of the fields available:");
  1515. for (i = 0; *(set_fields[i].cmd) != '\n'; i++)
  1516. {
  1517. ch->ChatPacket(CHAT_TYPE_INFO, " %d. %s", i+1, set_fields[i].cmd);
  1518. if (set_fields[i].help != NULL)
  1519. ch->ChatPacket(CHAT_TYPE_INFO, " Yardim: %s", set_fields[i].help);
  1520. }
  1521. return;
  1522. }
  1523.  
  1524. tch = CHARACTER_MANAGER::instance().FindPC(arg1);
  1525.  
  1526. if (!tch)
  1527. {
  1528. ch->ChatPacket(CHAT_TYPE_INFO, "%s not exist", arg1);
  1529. return;
  1530. }
  1531.  
  1532. len = strlen(arg2);
  1533.  
  1534. for (i = 0; *(set_fields[i].cmd) != '\n'; i++)
  1535. if (!strncmp(arg2, set_fields[i].cmd, len))
  1536. break;
  1537.  
  1538. switch (i)
  1539. {
  1540. case DoSetTypes::GOLD: // gold
  1541. {
  1542. long long gold = 0;
  1543. str_to_number(gold, arg3);
  1544. DBManager::instance().SendMoneyLog(MONEY_LOG_MISC, 3, gold);
  1545. long long before_gold = tch->GetGold();
  1546. tch->PointChange(POINT_GOLD, gold, true);
  1547. long long after_gold = tch->GetGold();
  1548. if (0 == after_gold && 0 != before_gold)
  1549. {
  1550. LogManager::instance().CharLog(tch, gold, "ZERO_GOLD", "GM");
  1551. }
  1552. }
  1553. break;
  1554.  
  1555. case DoSetTypes::RACE: // race
  1556. {
  1557. int amount = 0;
  1558. str_to_number(amount, arg3);
  1559. amount = MINMAX(0, amount, JOB_MAX_NUM);
  1560. ESex mySex = GET_SEX(tch);
  1561. DWORD dwRace = MAIN_RACE_WARRIOR_M;
  1562. switch (amount)
  1563. {
  1564. case JOB_WARRIOR:
  1565. dwRace = (mySex==SEX_MALE)?MAIN_RACE_WARRIOR_M:MAIN_RACE_WARRIOR_W;
  1566. break;
  1567. case JOB_ASSASSIN:
  1568. dwRace = (mySex==SEX_MALE)?MAIN_RACE_ASSASSIN_M:MAIN_RACE_ASSASSIN_W;
  1569. break;
  1570. case JOB_SURA:
  1571. dwRace = (mySex==SEX_MALE)?MAIN_RACE_SURA_M:MAIN_RACE_SURA_W;
  1572. break;
  1573. case JOB_SHAMAN:
  1574. dwRace = (mySex==SEX_MALE)?MAIN_RACE_SHAMAN_M:MAIN_RACE_SHAMAN_W;
  1575. break;
  1576. case JOB_WOLFMAN:
  1577. dwRace = (mySex==SEX_MALE)?MAIN_RACE_WOLFMAN_M:MAIN_RACE_WOLFMAN_M;
  1578. break;
  1579. }
  1580. if (dwRace!=tch->GetRaceNum())
  1581. {
  1582. tch->SetRace(dwRace);
  1583. tch->ClearSkill();
  1584. tch->SetSkillGroup(0);
  1585. // quick mesh change workaround begin
  1586. tch->SetPolymorph(101);
  1587. tch->SetPolymorph(0);
  1588. // quick mesh change workaround end
  1589. }
  1590. }
  1591. break;
  1592.  
  1593. case DoSetTypes::SEX: // sex
  1594. {
  1595. int amount = 0;
  1596. str_to_number(amount, arg3);
  1597. amount = MINMAX(SEX_MALE, amount, SEX_FEMALE);
  1598. if (amount != GET_SEX(tch))
  1599. {
  1600. tch->ChangeSex();
  1601. // quick mesh change workaround begin
  1602. tch->SetPolymorph(101);
  1603. tch->SetPolymorph(0);
  1604. // quick mesh change workaround end
  1605. }
  1606. }
  1607. break;
  1608.  
  1609. case DoSetTypes::JOB: // job
  1610. {
  1611. int amount = 0;
  1612. str_to_number(amount, arg3);
  1613. amount = MINMAX(0, amount, 2);
  1614. if (amount != tch->GetSkillGroup())
  1615. {
  1616. tch->ClearSkill();
  1617. tch->SetSkillGroup(amount);
  1618. }
  1619. }
  1620. break;
  1621.  
  1622. case DoSetTypes::EXP: // exp
  1623. {
  1624. int amount = 0;
  1625. str_to_number(amount, arg3);
  1626. tch->PointChange(POINT_EXP, amount, true);
  1627. }
  1628. break;
  1629.  
  1630. case DoSetTypes::MAX_HP: // max_hp
  1631. {
  1632. int amount = 0;
  1633. str_to_number(amount, arg3);
  1634. tch->PointChange(POINT_MAX_HP, amount, true);
  1635. }
  1636. break;
  1637.  
  1638. case DoSetTypes::MAX_SP: // max_sp
  1639. {
  1640. int amount = 0;
  1641. str_to_number(amount, arg3);
  1642. tch->PointChange(POINT_MAX_SP, amount, true);
  1643. }
  1644. break;
  1645.  
  1646. case DoSetTypes::SKILL: // active skill point
  1647. {
  1648. int amount = 0;
  1649. str_to_number(amount, arg3);
  1650. tch->PointChange(POINT_SKILL, amount, true);
  1651. }
  1652. break;
  1653.  
  1654. case DoSetTypes::ALIGN: // alignment
  1655. case DoSetTypes::ALIGNMENT: // alignment
  1656. {
  1657. int amount = 0;
  1658. str_to_number(amount, arg3);
  1659. tch->UpdateAlignment(amount - ch->GetRealAlignment());
  1660. }
  1661. break;
  1662.  
  1663. case DoSetTypes::YENI_BIRIM:
  1664. {
  1665. int yeniBirim = 0;
  1666. str_to_number(yeniBirim, arg3);
  1667. if(yeniBirim + tch->yeniBirim_miktar() > YENIBIRIM_MAX)
  1668. return;
  1669. tch->yeniBirim_guncelle(tch->yeniBirim_miktar()+yeniBirim);
  1670. }
  1671. break;
  1672. }
  1673.  
  1674. if (set_fields[i].type == NUMBER)
  1675. {
  1676. long long amount = 0;
  1677. str_to_number(amount, arg3);
  1678. ch->ChatPacket(CHAT_TYPE_INFO, "%s's %s set to [%lld]", tch->GetName(), set_fields[i].cmd, amount);
  1679. }
  1680. }
  1681.  
  1682. ACMD(do_reset)
  1683. {
  1684. ch->PointChange(POINT_HP, ch->GetMaxHP() - ch->GetHP());
  1685. ch->PointChange(POINT_SP, ch->GetMaxSP() - ch->GetSP());
  1686. ch->Save();
  1687. }
  1688.  
  1689. ACMD(do_advance)
  1690. {
  1691. char arg1[256], arg2[256];
  1692. two_arguments(argument, arg1, sizeof(arg1), arg2, sizeof(arg2));
  1693.  
  1694. if (!*arg1 || !*arg2)
  1695. {
  1696. ch->ChatPacket(CHAT_TYPE_INFO, "Syntax: advance <name> <level>");
  1697. return;
  1698. }
  1699.  
  1700. LPCHARACTER tch = CHARACTER_MANAGER::instance().FindPC(arg1);
  1701.  
  1702. if (!tch)
  1703. {
  1704. ch->ChatPacket(CHAT_TYPE_INFO, "%s not exist", arg1);
  1705. return;
  1706. }
  1707.  
  1708. int level = 0;
  1709. str_to_number(level, arg2);
  1710.  
  1711. tch->ResetPoint(MINMAX(0, level, PLAYER_MAX_LEVEL_CONST));
  1712. }
  1713.  
  1714. ACMD(do_respawn)
  1715. {
  1716. char arg1[256];
  1717. one_argument(argument, arg1, sizeof(arg1));
  1718.  
  1719. if (*arg1 && !strcasecmp(arg1, "all"))
  1720. {
  1721. ch->ChatPacket(CHAT_TYPE_INFO, "Respaw everywhere");
  1722. regen_reset(0, 0);
  1723. }
  1724. else
  1725. {
  1726. ch->ChatPacket(CHAT_TYPE_INFO, "Respaw around");
  1727. regen_reset(ch->GetX(), ch->GetY());
  1728. }
  1729. }
  1730.  
  1731. ACMD(do_safebox_size)
  1732. {
  1733.  
  1734. char arg1[256];
  1735. one_argument(argument, arg1, sizeof(arg1));
  1736.  
  1737. int size = 0;
  1738.  
  1739. if (*arg1)
  1740. str_to_number(size, arg1);
  1741.  
  1742. if (size > 3 || size < 0)
  1743. size = 0;
  1744.  
  1745. ch->ChatPacket(CHAT_TYPE_INFO, "Safebox size set to %d", size);
  1746. ch->ChangeSafeboxSize(size);
  1747. }
  1748.  
  1749. ACMD(do_makeguild)
  1750. {
  1751. if (ch->GetGuild())
  1752. return;
  1753.  
  1754. CGuildManager& gm = CGuildManager::instance();
  1755.  
  1756. char arg1[256];
  1757. one_argument(argument, arg1, sizeof(arg1));
  1758.  
  1759. TGuildCreateParameter cp;
  1760. memset(&cp, 0, sizeof(cp));
  1761.  
  1762. cp.master = ch;
  1763. strlcpy(cp.name, arg1, sizeof(cp.name));
  1764.  
  1765. if (!check_name(cp.name))
  1766. {
  1767. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("적합하지 않은 길드 이름 입니다."));
  1768. return;
  1769. }
  1770.  
  1771. gm.CreateGuild(cp);
  1772. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("(%s) 길드가 생성되었습니다. [임시]"), cp.name);
  1773. }
  1774.  
  1775. ACMD(do_deleteguild)
  1776. {
  1777. if (ch->GetGuild())
  1778. ch->GetGuild()->RequestDisband(ch->GetPlayerID());
  1779. }
  1780.  
  1781. ACMD(do_greset)
  1782. {
  1783. if (ch->GetGuild())
  1784. ch->GetGuild()->Reset();
  1785. }
  1786.  
  1787. // REFINE_ROD_HACK_BUG_FIX
  1788. ACMD(do_refine_rod)
  1789. {
  1790. char arg1[256];
  1791. one_argument(argument, arg1, sizeof(arg1));
  1792.  
  1793. BYTE cell = 0;
  1794. str_to_number(cell, arg1);
  1795. LPITEM item = ch->GetInventoryItem(cell);
  1796. if (item)
  1797. fishing::RealRefineRod(ch, item);
  1798. }
  1799. // END_OF_REFINE_ROD_HACK_BUG_FIX
  1800.  
  1801. // REFINE_PICK
  1802. ACMD(do_refine_pick)
  1803. {
  1804. char arg1[256];
  1805. one_argument(argument, arg1, sizeof(arg1));
  1806.  
  1807. BYTE cell = 0;
  1808. str_to_number(cell, arg1);
  1809. LPITEM item = ch->GetInventoryItem(cell);
  1810. if (item)
  1811. {
  1812. mining::CHEAT_MAX_PICK(ch, item);
  1813. mining::RealRefinePick(ch, item);
  1814. }
  1815. }
  1816.  
  1817. ACMD(do_max_pick)
  1818. {
  1819. char arg1[256];
  1820. one_argument(argument, arg1, sizeof(arg1));
  1821.  
  1822. BYTE cell = 0;
  1823. str_to_number(cell, arg1);
  1824. LPITEM item = ch->GetInventoryItem(cell);
  1825. if (item)
  1826. {
  1827. mining::CHEAT_MAX_PICK(ch, item);
  1828. }
  1829. }
  1830. // END_OF_REFINE_PICK
  1831.  
  1832.  
  1833. ACMD(do_fishing_simul)
  1834. {
  1835. char arg1[256];
  1836. char arg2[256];
  1837. char arg3[256];
  1838. argument = one_argument(argument, arg1, sizeof(arg1));
  1839. two_arguments(argument, arg2, sizeof(arg2), arg3, sizeof(arg3));
  1840.  
  1841. int count = 1000;
  1842. int prob_idx = 0;
  1843. int level = 100;
  1844.  
  1845. ch->ChatPacket(CHAT_TYPE_INFO, "Usage: fishing_simul <level> <prob index> <count>");
  1846.  
  1847. if (*arg1)
  1848. str_to_number(level, arg1);
  1849.  
  1850. if (*arg2)
  1851. str_to_number(prob_idx, arg2);
  1852.  
  1853. if (*arg3)
  1854. str_to_number(count, arg3);
  1855.  
  1856. fishing::Simulation(level, count, prob_idx, ch);
  1857. }
  1858.  
  1859. ACMD(do_invisibility)
  1860. {
  1861. if (ch->IsAffectFlag(AFF_INVISIBILITY))
  1862. {
  1863. ch->RemoveAffect(AFFECT_INVISIBILITY);
  1864. }
  1865. else
  1866. {
  1867. ch->AddAffect(AFFECT_INVISIBILITY, POINT_NONE, 0, AFF_INVISIBILITY, INFINITE_AFFECT_DURATION, 0, true);
  1868. }
  1869. }
  1870.  
  1871. ACMD(do_event_flag)
  1872. {
  1873. char arg1[256];
  1874. char arg2[256];
  1875.  
  1876. two_arguments(argument, arg1, sizeof(arg1), arg2, sizeof(arg2));
  1877.  
  1878. if (!(*arg1) || !(*arg2))
  1879. return;
  1880.  
  1881. int value = 0;
  1882. str_to_number(value, arg2);
  1883.  
  1884. if (!strcmp(arg1, "mob_item") ||
  1885. !strcmp(arg1, "mob_exp") ||
  1886. !strcmp(arg1, "mob_gold") ||
  1887. !strcmp(arg1, "mob_dam") ||
  1888. !strcmp(arg1, "mob_gold_pct") ||
  1889. !strcmp(arg1, "mob_item_buyer") ||
  1890. !strcmp(arg1, "mob_exp_buyer") ||
  1891. !strcmp(arg1, "mob_gold_buyer") ||
  1892. !strcmp(arg1, "mob_gold_pct_buyer")
  1893. )
  1894. value = MINMAX(0, value, 1000);
  1895.  
  1896. //quest::CQuestManager::instance().SetEventFlag(arg1, atoi(arg2));
  1897. quest::CQuestManager::instance().RequestSetEventFlag(arg1, value);
  1898. ch->ChatPacket(CHAT_TYPE_INFO, "RequestSetEventFlag %s %d", arg1, value);
  1899. sys_log(0, "RequestSetEventFlag %s %d", arg1, value);
  1900. }
  1901.  
  1902. ACMD(do_get_event_flag)
  1903. {
  1904. quest::CQuestManager::instance().SendEventFlagList(ch);
  1905. }
  1906.  
  1907. ACMD(do_private)
  1908. {
  1909. char arg1[256];
  1910. one_argument(argument, arg1, sizeof(arg1));
  1911.  
  1912. if (!*arg1)
  1913. {
  1914. ch->ChatPacket(CHAT_TYPE_INFO, "Usage: private <map index>");
  1915. return;
  1916. }
  1917.  
  1918. long lMapIndex;
  1919. long map_index = 0;
  1920. str_to_number(map_index, arg1);
  1921. if ((lMapIndex = SECTREE_MANAGER::instance().CreatePrivateMap(map_index)))
  1922. {
  1923. ch->SaveExitLocation();
  1924.  
  1925. LPSECTREE_MAP pkSectreeMap = SECTREE_MANAGER::instance().GetMap(lMapIndex);
  1926. ch->WarpSet(pkSectreeMap->m_setting.posSpawn.x, pkSectreeMap->m_setting.posSpawn.y, lMapIndex);
  1927. }
  1928. else
  1929. ch->ChatPacket(CHAT_TYPE_INFO, "Can't find map by index %d", map_index);
  1930. }
  1931.  
  1932. ACMD(do_qf)
  1933. {
  1934. char arg1[256];
  1935.  
  1936. one_argument(argument, arg1, sizeof(arg1));
  1937.  
  1938. if (!*arg1)
  1939. return;
  1940.  
  1941. quest::PC* pPC = quest::CQuestManager::instance().GetPCForce(ch->GetPlayerID());
  1942. std::string questname = pPC->GetCurrentQuestName();
  1943.  
  1944. if (!questname.empty())
  1945. {
  1946. int value = quest::CQuestManager::Instance().GetQuestStateIndex(questname, arg1);
  1947.  
  1948. pPC->SetFlag(questname + ".__status", value);
  1949. pPC->ClearTimer();
  1950.  
  1951. quest::PC::QuestInfoIterator it = pPC->quest_begin();
  1952. unsigned int questindex = quest::CQuestManager::instance().GetQuestIndexByName(questname);
  1953.  
  1954. while (it!= pPC->quest_end())
  1955. {
  1956. if (it->first == questindex)
  1957. {
  1958. it->second.st = value;
  1959. break;
  1960. }
  1961.  
  1962. ++it;
  1963. }
  1964.  
  1965. ch->ChatPacket(CHAT_TYPE_INFO, "setting quest state flag %s %s %d", questname.c_str(), arg1, value);
  1966. }
  1967. else
  1968. {
  1969. ch->ChatPacket(CHAT_TYPE_INFO, "setting quest state flag failed");
  1970. }
  1971. }
  1972.  
  1973. LPCHARACTER chHori, chForge, chLib, chTemple, chTraining, chTree, chPortal, chBall;
  1974.  
  1975. ACMD(do_b1)
  1976. {
  1977. //호리병 478 579
  1978. chHori = CHARACTER_MANAGER::instance().SpawnMobRange(14017, ch->GetMapIndex(), 304222, 742858, 304222, 742858, true, false);
  1979. chHori->AddAffect(AFFECT_DUNGEON_UNIQUE, POINT_NONE, 0, AFF_BUILDING_CONSTRUCTION_SMALL, 65535, 0, true);
  1980. chHori->AddAffect(AFFECT_DUNGEON_UNIQUE, POINT_NONE, 0, AFF_DUNGEON_UNIQUE, 65535, 0, true);
  1981.  
  1982. for (int i = 0; i < 30; ++i)
  1983. {
  1984. int rot = number(0, 359);
  1985. float fx, fy;
  1986. GetDeltaByDegree(rot, 800, &fx, &fy);
  1987.  
  1988. LPCHARACTER tch = CHARACTER_MANAGER::instance().SpawnMobRange(number(701, 706),
  1989. ch->GetMapIndex(),
  1990. 304222 + (int)fx,
  1991. 742858 + (int)fy,
  1992. 304222 + (int)fx,
  1993. 742858 + (int)fy,
  1994. true,
  1995. false);
  1996. tch->SetAggressive();
  1997. }
  1998.  
  1999. for (int i = 0; i < 5; ++i)
  2000. {
  2001. int rot = number(0, 359);
  2002. float fx, fy;
  2003. GetDeltaByDegree(rot, 800, &fx, &fy);
  2004.  
  2005. LPCHARACTER tch = CHARACTER_MANAGER::instance().SpawnMobRange(8009,
  2006. ch->GetMapIndex(),
  2007. 304222 + (int)fx,
  2008. 742858 + (int)fy,
  2009. 304222 + (int)fx,
  2010. 742858 + (int)fy,
  2011. true,
  2012. false);
  2013. tch->SetAggressive();
  2014. }
  2015. }
  2016.  
  2017. ACMD(do_b2)
  2018. {
  2019. chHori->RemoveAffect(AFFECT_DUNGEON_UNIQUE);
  2020. }
  2021.  
  2022. ACMD(do_b3)
  2023. {
  2024. // 포지 492 547
  2025. chForge = CHARACTER_MANAGER::instance().SpawnMobRange(14003, ch->GetMapIndex(), 307500, 746300, 307500, 746300, true, false);
  2026. chForge->AddAffect(AFFECT_DUNGEON_UNIQUE, POINT_NONE, 0, AFF_DUNGEON_UNIQUE, 65535, 0, true);
  2027. //높은탑 509 589 -> 도서관
  2028. chLib = CHARACTER_MANAGER::instance().SpawnMobRange(14007, ch->GetMapIndex(), 307900, 744500, 307900, 744500, true, false);
  2029. chLib->AddAffect(AFFECT_DUNGEON_UNIQUE, POINT_NONE, 0, AFF_DUNGEON_UNIQUE, 65535, 0, true);
  2030. //욕조 513 606 -> 힘의신전
  2031. chTemple = CHARACTER_MANAGER::instance().SpawnMobRange(14004, ch->GetMapIndex(), 307700, 741600, 307700, 741600, true, false);
  2032. chTemple->AddAffect(AFFECT_DUNGEON_UNIQUE, POINT_NONE, 0, AFF_DUNGEON_UNIQUE, 65535, 0, true);
  2033. //권투장 490 625
  2034. chTraining= CHARACTER_MANAGER::instance().SpawnMobRange(14010, ch->GetMapIndex(), 307100, 739500, 307100, 739500, true, false);
  2035. chTraining->AddAffect(AFFECT_DUNGEON_UNIQUE, POINT_NONE, 0, AFF_DUNGEON_UNIQUE, 65535, 0, true);
  2036. //나무 466 614
  2037. chTree= CHARACTER_MANAGER::instance().SpawnMobRange(14013, ch->GetMapIndex(), 300800, 741600, 300800, 741600, true, false);
  2038. chTree->AddAffect(AFFECT_DUNGEON_UNIQUE, POINT_NONE, 0, AFF_DUNGEON_UNIQUE, 65535, 0, true);
  2039. //포탈 439 615
  2040. chPortal= CHARACTER_MANAGER::instance().SpawnMobRange(14001, ch->GetMapIndex(), 300900, 744500, 300900, 744500, true, false);
  2041. chPortal->AddAffect(AFFECT_DUNGEON_UNIQUE, POINT_NONE, 0, AFF_DUNGEON_UNIQUE, 65535, 0, true);
  2042. // 구슬 436 600
  2043. chBall = CHARACTER_MANAGER::instance().SpawnMobRange(14012, ch->GetMapIndex(), 302500, 746600, 302500, 746600, true, false);
  2044. chBall->AddAffect(AFFECT_DUNGEON_UNIQUE, POINT_NONE, 0, AFF_DUNGEON_UNIQUE, 65535, 0, true);
  2045. }
  2046.  
  2047. ACMD(do_b4)
  2048. {
  2049. chLib->AddAffect(AFFECT_DUNGEON_UNIQUE, POINT_NONE, 0, AFF_BUILDING_UPGRADE, 65535, 0, true);
  2050.  
  2051. for (int i = 0; i < 30; ++i)
  2052. {
  2053. int rot = number(0, 359);
  2054. float fx, fy;
  2055. GetDeltaByDegree(rot, 1200, &fx, &fy);
  2056.  
  2057. LPCHARACTER tch = CHARACTER_MANAGER::instance().SpawnMobRange(number(701, 706),
  2058. ch->GetMapIndex(),
  2059. 307900 + (int)fx,
  2060. 744500 + (int)fy,
  2061. 307900 + (int)fx,
  2062. 744500 + (int)fy,
  2063. true,
  2064. false);
  2065. tch->SetAggressive();
  2066. }
  2067.  
  2068. for (int i = 0; i < 5; ++i)
  2069. {
  2070. int rot = number(0, 359);
  2071. float fx, fy;
  2072. GetDeltaByDegree(rot, 1200, &fx, &fy);
  2073.  
  2074. LPCHARACTER tch = CHARACTER_MANAGER::instance().SpawnMobRange(8009,
  2075. ch->GetMapIndex(),
  2076. 307900 + (int)fx,
  2077. 744500 + (int)fy,
  2078. 307900 + (int)fx,
  2079. 744500 + (int)fy,
  2080. true,
  2081. false);
  2082. tch->SetAggressive();
  2083. }
  2084.  
  2085. }
  2086.  
  2087. ACMD(do_b5)
  2088. {
  2089. M2_DESTROY_CHARACTER(chLib);
  2090. //chHori->RemoveAffect(AFFECT_DUNGEON_UNIQUE);
  2091. chLib = CHARACTER_MANAGER::instance().SpawnMobRange(14008, ch->GetMapIndex(), 307900, 744500, 307900, 744500, true, false);
  2092. chLib->AddAffect(AFFECT_DUNGEON_UNIQUE, POINT_NONE, 0, AFF_DUNGEON_UNIQUE, 65535, 0, true);
  2093. }
  2094.  
  2095. ACMD(do_b6)
  2096. {
  2097. chLib->AddAffect(AFFECT_DUNGEON_UNIQUE, POINT_NONE, 0, AFF_BUILDING_UPGRADE, 65535, 0, true);
  2098. }
  2099. ACMD(do_b7)
  2100. {
  2101. M2_DESTROY_CHARACTER(chLib);
  2102. //chHori->RemoveAffect(AFFECT_DUNGEON_UNIQUE);
  2103. chLib = CHARACTER_MANAGER::instance().SpawnMobRange(14009, ch->GetMapIndex(), 307900, 744500, 307900, 744500, true, false);
  2104. chLib->AddAffect(AFFECT_DUNGEON_UNIQUE, POINT_NONE, 0, AFF_DUNGEON_UNIQUE, 65535, 0, true);
  2105. }
  2106.  
  2107. ACMD(do_book)
  2108. {
  2109. char arg1[256];
  2110.  
  2111. one_argument(argument, arg1, sizeof(arg1));
  2112.  
  2113. CSkillProto * pkProto;
  2114.  
  2115. if (isnhdigit(*arg1))
  2116. {
  2117. DWORD vnum = 0;
  2118. str_to_number(vnum, arg1);
  2119. pkProto = CSkillManager::instance().Get(vnum);
  2120. }
  2121. else
  2122. pkProto = CSkillManager::instance().Get(arg1);
  2123.  
  2124. if (!pkProto)
  2125. {
  2126. ch->ChatPacket(CHAT_TYPE_INFO, "There is no such a skill.");
  2127. return;
  2128. }
  2129.  
  2130. LPITEM item = ch->AutoGiveItem(50300);
  2131. item->SetSocket(0, pkProto->dwVnum);
  2132. }
  2133.  
  2134. ACMD(do_setskillother)
  2135. {
  2136. char arg1[256], arg2[256], arg3[256];
  2137. argument = two_arguments(argument, arg1, sizeof(arg1), arg2, sizeof(arg2));
  2138. one_argument(argument, arg3, sizeof(arg3));
  2139.  
  2140. if (!*arg1 || !*arg2 || !*arg3 || !isdigit(*arg3))
  2141. {
  2142. ch->ChatPacket(CHAT_TYPE_INFO, "Syntax: setskillother <target> <skillname> <lev>");
  2143. return;
  2144. }
  2145.  
  2146. LPCHARACTER tch;
  2147.  
  2148. tch = CHARACTER_MANAGER::instance().FindPC(arg1);
  2149.  
  2150. if (!tch)
  2151. {
  2152. ch->ChatPacket(CHAT_TYPE_INFO, "There is no such character.");
  2153. return;
  2154. }
  2155.  
  2156. CSkillProto * pk;
  2157.  
  2158. if (isdigit(*arg2))
  2159. {
  2160. DWORD vnum = 0;
  2161. str_to_number(vnum, arg2);
  2162. pk = CSkillManager::instance().Get(vnum);
  2163. }
  2164. else
  2165. pk = CSkillManager::instance().Get(arg2);
  2166.  
  2167. if (!pk)
  2168. {
  2169. ch->ChatPacket(CHAT_TYPE_INFO, "No such a skill by that name.");
  2170. return;
  2171. }
  2172.  
  2173. BYTE level = 0;
  2174. str_to_number(level, arg3);
  2175. tch->SetSkillLevel(pk->dwVnum, level);
  2176. tch->ComputePoints();
  2177. tch->SkillLevelPacket();
  2178. }
  2179.  
  2180. ACMD(do_setskill)
  2181. {
  2182. char arg1[256], arg2[256];
  2183. two_arguments(argument, arg1, sizeof(arg1), arg2, sizeof(arg2));
  2184.  
  2185. if (!*arg1 || !*arg2 || !isdigit(*arg2))
  2186. {
  2187. ch->ChatPacket(CHAT_TYPE_INFO, "Syntax: setskill <name> <lev>");
  2188. return;
  2189. }
  2190.  
  2191. CSkillProto * pk;
  2192.  
  2193. if (isdigit(*arg1))
  2194. {
  2195. DWORD vnum = 0;
  2196. str_to_number(vnum, arg1);
  2197. pk = CSkillManager::instance().Get(vnum);
  2198. }
  2199.  
  2200. else
  2201. pk = CSkillManager::instance().Get(arg1);
  2202.  
  2203. if (!pk)
  2204. {
  2205. ch->ChatPacket(CHAT_TYPE_INFO, "No such a skill by that name.");
  2206. return;
  2207. }
  2208.  
  2209. BYTE level = 0;
  2210. str_to_number(level, arg2);
  2211. ch->SetSkillLevel(pk->dwVnum, level);
  2212. ch->ComputePoints();
  2213. ch->SkillLevelPacket();
  2214. }
  2215.  
  2216. ACMD(do_set_skill_point)
  2217. {
  2218. char arg1[256];
  2219. one_argument(argument, arg1, sizeof(arg1));
  2220.  
  2221. int skill_point = 0;
  2222. if (*arg1)
  2223. str_to_number(skill_point, arg1);
  2224.  
  2225. ch->SetRealPoint(POINT_SKILL, skill_point);
  2226. ch->SetPoint(POINT_SKILL, ch->GetRealPoint(POINT_SKILL));
  2227. ch->PointChange(POINT_SKILL, 0);
  2228. }
  2229.  
  2230. ACMD(do_set_skill_group)
  2231. {
  2232. char arg1[256];
  2233. one_argument(argument, arg1, sizeof(arg1));
  2234.  
  2235. int skill_group = 0;
  2236. if (*arg1)
  2237. str_to_number(skill_group, arg1);
  2238.  
  2239. ch->SetSkillGroup(skill_group);
  2240.  
  2241. ch->ClearSkill();
  2242. ch->ChatPacket(CHAT_TYPE_INFO, "skill group to %d.", skill_group);
  2243. }
  2244.  
  2245. ACMD(do_reload)
  2246. {
  2247. char arg1[256];
  2248. one_argument(argument, arg1, sizeof(arg1));
  2249.  
  2250. if (*arg1)
  2251. {
  2252. switch (LOWER(*arg1))
  2253. {
  2254. case 'u':
  2255. ch->ChatPacket(CHAT_TYPE_INFO, "Reloading state_user_count.");
  2256. LoadStateUserCount();
  2257. break;
  2258.  
  2259. case 'p':
  2260. ch->ChatPacket(CHAT_TYPE_INFO, "Reloading prototype tables,");
  2261. db_clientdesc->DBPacket(HEADER_GD_RELOAD_PROTO, 0, NULL, 0);
  2262. break;
  2263.  
  2264. case 's':
  2265. ch->ChatPacket(CHAT_TYPE_INFO, "Reloading notice string.");
  2266. DBManager::instance().LoadDBString();
  2267. break;
  2268.  
  2269. case 'q':
  2270. ch->ChatPacket(CHAT_TYPE_INFO, "Reloading quest.");
  2271. quest::CQuestManager::instance().Reload();
  2272. break;
  2273.  
  2274. case 'f':
  2275. fishing::Initialize();
  2276. break;
  2277.  
  2278. //RELOAD_ADMIN
  2279. case 'a':
  2280. ch->ChatPacket(CHAT_TYPE_INFO, "Reloading Admin infomation.");
  2281. db_clientdesc->DBPacket(HEADER_GD_RELOAD_ADMIN, 0, NULL, 0);
  2282. sys_log(0, "Reloading admin infomation.");
  2283. break;
  2284. //END_RELOAD_ADMIN
  2285. case 'c': // cube
  2286. // 로컬 프로세스만 갱산한다.
  2287. Cube_init();
  2288. break;
  2289. default:
  2290. const int FILE_NAME_LEN = 256;
  2291. if (strstr(arg1, "drop"))
  2292. {
  2293. char szETCDropItemFileName[FILE_NAME_LEN];
  2294. char szMOBDropItemFileName[FILE_NAME_LEN];
  2295. char szSpecialItemGroupFileName[FILE_NAME_LEN];
  2296.  
  2297. snprintf(szETCDropItemFileName, sizeof(szETCDropItemFileName),
  2298. "%s/etc_drop_item.txt", LocaleService_GetBasePath().c_str());
  2299. snprintf(szMOBDropItemFileName, sizeof(szMOBDropItemFileName),
  2300. "%s/mob_drop_item.txt", LocaleService_GetBasePath().c_str());
  2301. snprintf(szSpecialItemGroupFileName, sizeof(szSpecialItemGroupFileName),
  2302. "%s/special_item_group.txt", LocaleService_GetBasePath().c_str());
  2303.  
  2304. ch->ChatPacket(CHAT_TYPE_INFO, "Reloading: ETCDropItem: %s", szETCDropItemFileName);
  2305. if (!ITEM_MANAGER::instance().ReadEtcDropItemFile(szETCDropItemFileName, true))
  2306. ch->ChatPacket(CHAT_TYPE_INFO, "failed to reload ETCDropItem: %s", szETCDropItemFileName);
  2307. else
  2308. ch->ChatPacket(CHAT_TYPE_INFO, "reload success: ETCDropItem: %s", szETCDropItemFileName);
  2309.  
  2310. ch->ChatPacket(CHAT_TYPE_INFO, "Reloading: SpecialItemGroup: %s", szSpecialItemGroupFileName);
  2311. if (!ITEM_MANAGER::instance().ReadSpecialDropItemFile(szSpecialItemGroupFileName, true))
  2312. ch->ChatPacket(CHAT_TYPE_INFO, "failed to reload SpecialItemGroup: %s", szSpecialItemGroupFileName);
  2313. else
  2314. ch->ChatPacket(CHAT_TYPE_INFO, "reload success: SpecialItemGroup: %s", szSpecialItemGroupFileName);
  2315.  
  2316. ch->ChatPacket(CHAT_TYPE_INFO, "Reloading: MOBDropItemFile: %s", szMOBDropItemFileName);
  2317. if (!ITEM_MANAGER::instance().ReadMonsterDropItemGroup(szMOBDropItemFileName, true))
  2318. ch->ChatPacket(CHAT_TYPE_INFO, "failed to reload MOBDropItemFile: %s", szMOBDropItemFileName);
  2319. else
  2320. ch->ChatPacket(CHAT_TYPE_INFO, "reload success: MOBDropItemFile: %s", szMOBDropItemFileName);
  2321. }
  2322. else if (strstr(arg1, "group"))
  2323. {
  2324. char szGroupFileName[FILE_NAME_LEN];
  2325. char szGroupGroupFileName[FILE_NAME_LEN];
  2326.  
  2327. snprintf(szGroupFileName, sizeof(szGroupGroupFileName),
  2328. "%s/group.txt", LocaleService_GetBasePath().c_str());
  2329. snprintf(szGroupGroupFileName, sizeof(szGroupGroupFileName),
  2330. "%s/group_group.txt", LocaleService_GetBasePath().c_str());
  2331.  
  2332. ch->ChatPacket(CHAT_TYPE_INFO, "Reloading: mob groups: %s", szGroupFileName);
  2333. if (!CMobManager::instance().LoadGroup(szGroupFileName, true))
  2334. ch->ChatPacket(CHAT_TYPE_INFO, "failed to reload mob groups: %s", szGroupFileName);
  2335.  
  2336. ch->ChatPacket(CHAT_TYPE_INFO, "Reloading: mob group group: %s", szGroupGroupFileName);
  2337. if (!CMobManager::instance().LoadGroupGroup(szGroupGroupFileName, true))
  2338. ch->ChatPacket(CHAT_TYPE_INFO, "failed to reload mob group group: %s", szGroupGroupFileName);
  2339. }
  2340. else if (strstr(arg1, "regen"))
  2341. {
  2342. SendNoticeMap("Reloading regens!", ch->GetMapIndex(), false);
  2343. regen_free_map(ch->GetMapIndex());
  2344. CHARACTER_MANAGER::instance().DestroyCharacterInMap(ch->GetMapIndex());
  2345. regen_reload(ch->GetMapIndex());
  2346. SendNoticeMap("Regens reloaded!", ch->GetMapIndex(), false);
  2347. }
  2348. break;
  2349. }
  2350. }
  2351. else
  2352. {
  2353. ch->ChatPacket(CHAT_TYPE_INFO, "Reloading state_user_count.");
  2354. LoadStateUserCount();
  2355.  
  2356. ch->ChatPacket(CHAT_TYPE_INFO, "Reloading prototype tables,");
  2357. db_clientdesc->DBPacket(HEADER_GD_RELOAD_PROTO, 0, NULL, 0);
  2358.  
  2359. ch->ChatPacket(CHAT_TYPE_INFO, "Reloading notice string.");
  2360. DBManager::instance().LoadDBString();
  2361. }
  2362. }
  2363.  
  2364. ACMD(do_cooltime)
  2365. {
  2366. ch->DisableCooltime();
  2367. }
  2368.  
  2369. ACMD(do_level)
  2370. {
  2371. char arg2[256];
  2372. one_argument(argument, arg2, sizeof(arg2));
  2373.  
  2374. if (!*arg2)
  2375. {
  2376. ch->ChatPacket(CHAT_TYPE_INFO, "Syntax: level <level>");
  2377. return;
  2378. }
  2379.  
  2380. int level = 0;
  2381. str_to_number(level, arg2);
  2382. ch->ResetPoint(MINMAX(1, level, PLAYER_MAX_LEVEL_CONST));
  2383.  
  2384. ch->ClearSkill();
  2385. ch->ClearSubSkill();
  2386. }
  2387.  
  2388. ACMD(do_gwlist)
  2389. {
  2390. ch->ChatPacket(CHAT_TYPE_NOTICE, LC_TEXT("현재 전쟁중인 길드 입니다"));
  2391. CGuildManager::instance().ShowGuildWarList(ch);
  2392. }
  2393.  
  2394. ACMD(do_stop_guild_war)
  2395. {
  2396. char arg1[256], arg2[256];
  2397. two_arguments(argument, arg1, sizeof(arg1), arg2, sizeof(arg2));
  2398.  
  2399. if (!*arg1 || !*arg2)
  2400. return;
  2401.  
  2402. int id1 = 0, id2 = 0;
  2403.  
  2404. str_to_number(id1, arg1);
  2405. str_to_number(id2, arg2);
  2406.  
  2407. if (!id1 || !id2)
  2408. return;
  2409.  
  2410. if (id1 > id2)
  2411. {
  2412. std::swap(id1, id2);
  2413. }
  2414.  
  2415. ch->ChatPacket(CHAT_TYPE_TALKING, "%d %d", id1, id2);
  2416. CGuildManager::instance().RequestEndWar(id1, id2);
  2417. }
  2418.  
  2419. ACMD(do_cancel_guild_war)
  2420. {
  2421. char arg1[256], arg2[256];
  2422. two_arguments(argument, arg1, sizeof(arg1), arg2, sizeof(arg2));
  2423.  
  2424. int id1 = 0, id2 = 0;
  2425. str_to_number(id1, arg1);
  2426. str_to_number(id2, arg2);
  2427.  
  2428. if (id1 > id2)
  2429. std::swap(id1, id2);
  2430.  
  2431. CGuildManager::instance().RequestCancelWar(id1, id2);
  2432. }
  2433.  
  2434. ACMD(do_guild_state)
  2435. {
  2436. char arg1[256];
  2437. one_argument(argument, arg1, sizeof(arg1));
  2438.  
  2439. CGuild* pGuild = CGuildManager::instance().FindGuildByName(arg1);
  2440. if (pGuild != NULL)
  2441. {
  2442. ch->ChatPacket(CHAT_TYPE_INFO, "GuildID: %d", pGuild->GetID());
  2443. ch->ChatPacket(CHAT_TYPE_INFO, "GuildMasterPID: %d", pGuild->GetMasterPID());
  2444. ch->ChatPacket(CHAT_TYPE_INFO, "IsInWar: %d", pGuild->UnderAnyWar());
  2445. }
  2446. else
  2447. {
  2448. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("%s: 존재하지 않는 길드 입니다."), arg1);
  2449. }
  2450. }
  2451.  
  2452. struct FuncWeaken
  2453. {
  2454. LPCHARACTER m_pkGM;
  2455. bool m_bAll;
  2456.  
  2457. FuncWeaken(LPCHARACTER ch) : m_pkGM(ch), m_bAll(false)
  2458. {
  2459. }
  2460.  
  2461. void operator () (LPENTITY ent)
  2462. {
  2463. if (!ent->IsType(ENTITY_CHARACTER))
  2464. return;
  2465.  
  2466. LPCHARACTER pkChr = (LPCHARACTER) ent;
  2467.  
  2468. int iDist = DISTANCE_APPROX(pkChr->GetX() - m_pkGM->GetX(), pkChr->GetY() - m_pkGM->GetY());
  2469.  
  2470. if (!m_bAll && iDist >= 1000) // 10미터 이상에 있는 것들은 purge 하지 않는다.
  2471. return;
  2472.  
  2473. if (pkChr->IsNPC())
  2474. pkChr->PointChange(POINT_HP, (10 - pkChr->GetHP()));
  2475. }
  2476. };
  2477.  
  2478. ACMD(do_weaken)
  2479. {
  2480. char arg1[256];
  2481. one_argument(argument, arg1, sizeof(arg1));
  2482.  
  2483. FuncWeaken func(ch);
  2484.  
  2485. if (*arg1 && !strcmp(arg1, "all"))
  2486. func.m_bAll = true;
  2487.  
  2488. ch->GetSectree()->ForEachAround(func);
  2489. }
  2490.  
  2491. ACMD(do_getqf)
  2492. {
  2493. char arg1[256];
  2494.  
  2495. one_argument(argument, arg1, sizeof(arg1));
  2496.  
  2497. LPCHARACTER tch;
  2498.  
  2499. if (!*arg1)
  2500. tch = ch;
  2501. else
  2502. {
  2503. tch = CHARACTER_MANAGER::instance().FindPC(arg1);
  2504.  
  2505. if (!tch)
  2506. {
  2507. ch->ChatPacket(CHAT_TYPE_INFO, "There is no such character.");
  2508. return;
  2509. }
  2510. }
  2511.  
  2512. quest::PC* pPC = quest::CQuestManager::instance().GetPC(tch->GetPlayerID());
  2513.  
  2514. if (pPC)
  2515. pPC->SendFlagList(ch);
  2516. }
  2517.  
  2518. ACMD(do_set_state)
  2519. {
  2520. char arg1[256];
  2521. char arg2[256];
  2522.  
  2523. //argument = one_argument(argument, arg1, sizeof(arg1));
  2524. two_arguments(argument, arg1, sizeof(arg1), arg2, sizeof(arg2));
  2525.  
  2526. if (!*arg1 || !*arg2)
  2527. return;
  2528.  
  2529. quest::PC* pPC = quest::CQuestManager::instance().GetPCForce(ch->GetPlayerID());
  2530. std::string questname = arg1;
  2531. std::string statename = arg2;
  2532.  
  2533. if (!questname.empty())
  2534. {
  2535. int value = quest::CQuestManager::Instance().GetQuestStateIndex(questname, statename);
  2536.  
  2537. pPC->SetFlag(questname + ".__status", value);
  2538. pPC->ClearTimer();
  2539.  
  2540. quest::PC::QuestInfoIterator it = pPC->quest_begin();
  2541. unsigned int questindex = quest::CQuestManager::instance().GetQuestIndexByName(questname);
  2542.  
  2543. while (it!= pPC->quest_end())
  2544. {
  2545. if (it->first == questindex)
  2546. {
  2547. it->second.st = value;
  2548. break;
  2549. }
  2550.  
  2551. ++it;
  2552. }
  2553.  
  2554. ch->ChatPacket(CHAT_TYPE_INFO, "setting quest state flag %s %s %d", questname.c_str(), arg1, value);
  2555. }
  2556. else
  2557. {
  2558. ch->ChatPacket(CHAT_TYPE_INFO, "setting quest state flag failed");
  2559. }
  2560. }
  2561.  
  2562. ACMD(do_setqf)
  2563. {
  2564. char arg1[256];
  2565. char arg2[256];
  2566. char arg3[256];
  2567.  
  2568. one_argument(two_arguments(argument, arg1, sizeof(arg1), arg2, sizeof(arg2)), arg3, sizeof(arg3));
  2569.  
  2570. if (!*arg1)
  2571. {
  2572. ch->ChatPacket(CHAT_TYPE_INFO, "Syntax: setqf <flagname> <value> [<character name>]");
  2573. return;
  2574. }
  2575.  
  2576. LPCHARACTER tch = ch;
  2577.  
  2578. if (*arg3)
  2579. tch = CHARACTER_MANAGER::instance().FindPC(arg3);
  2580.  
  2581. if (!tch)
  2582. {
  2583. ch->ChatPacket(CHAT_TYPE_INFO, "There is no such character.");
  2584. return;
  2585. }
  2586.  
  2587. quest::PC* pPC = quest::CQuestManager::instance().GetPC(tch->GetPlayerID());
  2588.  
  2589. if (pPC)
  2590. {
  2591. int value = 0;
  2592. str_to_number(value, arg2);
  2593. pPC->SetFlag(arg1, value);
  2594. ch->ChatPacket(CHAT_TYPE_INFO, "Quest flag set: %s %d", arg1, value);
  2595. }
  2596. }
  2597.  
  2598. ACMD(do_delqf)
  2599. {
  2600. char arg1[256];
  2601. char arg2[256];
  2602.  
  2603. two_arguments(argument, arg1, sizeof(arg1), arg2, sizeof(arg2));
  2604.  
  2605. if (!*arg1)
  2606. {
  2607. ch->ChatPacket(CHAT_TYPE_INFO, "Syntax: delqf <flagname> [<character name>]");
  2608. return;
  2609. }
  2610.  
  2611. LPCHARACTER tch = ch;
  2612.  
  2613. if (*arg2)
  2614. tch = CHARACTER_MANAGER::instance().FindPC(arg2);
  2615.  
  2616. if (!tch)
  2617. {
  2618. ch->ChatPacket(CHAT_TYPE_INFO, "There is no such character.");
  2619. return;
  2620. }
  2621.  
  2622. quest::PC* pPC = quest::CQuestManager::instance().GetPC(tch->GetPlayerID());
  2623.  
  2624. if (pPC)
  2625. {
  2626. if (pPC->DeleteFlag(arg1))
  2627. ch->ChatPacket(CHAT_TYPE_INFO, "Delete success.");
  2628. else
  2629. ch->ChatPacket(CHAT_TYPE_INFO, "Delete failed. Quest flag does not exist.");
  2630. }
  2631. }
  2632.  
  2633. ACMD(do_forgetme)
  2634. {
  2635. ch->ForgetMyAttacker();
  2636. }
  2637.  
  2638. ACMD(do_aggregate)
  2639. {
  2640. ch->AggregateMonster();
  2641. }
  2642.  
  2643. ACMD(do_attract_ranger)
  2644. {
  2645. ch->AttractRanger();
  2646. }
  2647.  
  2648. ACMD(do_pull_monster)
  2649. {
  2650. ch->PullMonster();
  2651. }
  2652.  
  2653. ACMD(do_polymorph)
  2654. {
  2655. char arg1[256], arg2[256];
  2656.  
  2657. two_arguments(argument, arg1, sizeof(arg1), arg2, sizeof(arg2));
  2658. if (*arg1)
  2659. {
  2660. DWORD dwVnum = 0;
  2661. str_to_number(dwVnum, arg1);
  2662. bool bMaintainStat = false;
  2663. if (*arg2)
  2664. {
  2665. int value = 0;
  2666. str_to_number(value, arg2);
  2667. bMaintainStat = (value>0);
  2668. }
  2669.  
  2670. ch->SetPolymorph(dwVnum, bMaintainStat);
  2671. }
  2672. }
  2673.  
  2674. ACMD(do_polymorph_item)
  2675. {
  2676. char arg1[256];
  2677.  
  2678. one_argument(argument, arg1, sizeof(arg1));
  2679.  
  2680. if (*arg1)
  2681. {
  2682. DWORD dwVnum = 0;
  2683. str_to_number(dwVnum, arg1);
  2684.  
  2685. LPITEM item = ITEM_MANAGER::instance().CreateItem(70104, 1, 0, true);
  2686. if (item)
  2687. {
  2688. item->SetSocket(0, dwVnum);
  2689. int iEmptyPos = ch->GetEmptyInventory(item->GetSize());
  2690.  
  2691. if (iEmptyPos != -1)
  2692. {
  2693. item->AddToCharacter(ch, TItemPos(INVENTORY, iEmptyPos));
  2694. LogManager::instance().ItemLog(ch, item, "GM", item->GetName());
  2695. }
  2696. else
  2697. {
  2698. M2_DESTROY_ITEM(item);
  2699. ch->ChatPacket(CHAT_TYPE_INFO, "Envanter dolu.");
  2700. }
  2701. }
  2702. else
  2703. {
  2704. ch->ChatPacket(CHAT_TYPE_INFO, "#%d item not exist by that vnum.", 70103);
  2705. }
  2706. //ch->SetPolymorph(dwVnum, bMaintainStat);
  2707. }
  2708. }
  2709.  
  2710. ACMD(do_priv_empire)
  2711. {
  2712. char arg1[256] = {0};
  2713. char arg2[256] = {0};
  2714. char arg3[256] = {0};
  2715. char arg4[256] = {0};
  2716. int empire = 0;
  2717. int type = 0;
  2718. int value = 0;
  2719. int duration = 0;
  2720.  
  2721. const char* line = two_arguments(argument, arg1, sizeof(arg1), arg2, sizeof(arg2));
  2722.  
  2723. if (!*arg1 || !*arg2)
  2724. goto USAGE;
  2725.  
  2726. if (!line)
  2727. goto USAGE;
  2728.  
  2729. two_arguments(line, arg3, sizeof(arg3), arg4, sizeof(arg4));
  2730.  
  2731. if (!*arg3 || !*arg4)
  2732. goto USAGE;
  2733.  
  2734. str_to_number(empire, arg1);
  2735. str_to_number(type, arg2);
  2736. str_to_number(value, arg3);
  2737. value = MINMAX(0, value, 1000);
  2738. str_to_number(duration, arg4);
  2739.  
  2740. if (empire < 0 || 3 < empire)
  2741. goto USAGE;
  2742.  
  2743. if (type < 1 || 4 < type)
  2744. goto USAGE;
  2745.  
  2746. if (value < 0)
  2747. goto USAGE;
  2748.  
  2749. if (duration < 0)
  2750. goto USAGE;
  2751.  
  2752. // 시간 단위로 변경
  2753. duration = duration * (60*60);
  2754.  
  2755. sys_log(0, "_give_empire_privileage(empire=%d, type=%d, value=%d, duration=%d) by command",
  2756. empire, type, value, duration);
  2757. CPrivManager::instance().RequestGiveEmpirePriv(empire, type, value, duration);
  2758. return;
  2759.  
  2760. USAGE:
  2761. ch->ChatPacket(CHAT_TYPE_INFO, "usage : priv_empire <empire> <type> <value> <duration>");
  2762. ch->ChatPacket(CHAT_TYPE_INFO, " <empire> 0 - 3 (0==all)");
  2763. ch->ChatPacket(CHAT_TYPE_INFO, " <type> 1:item_drop, 2:gold_drop, 3:gold10_drop, 4:exp");
  2764. ch->ChatPacket(CHAT_TYPE_INFO, " <value> percent");
  2765. ch->ChatPacket(CHAT_TYPE_INFO, " <duration> hour");
  2766. }
  2767.  
  2768. /**
  2769. * @version 05/06/08 Bang2ni - 길드 보너스 퀘스트 진행 안되는 문제 수정.(스크립트가 작성안됨.)
  2770. * quest/priv_guild.quest 로 부터 스크립트 읽어오게 수정됨
  2771. */
  2772. ACMD(do_priv_guild)
  2773. {
  2774. static const char msg[] = { '\0' };
  2775.  
  2776. char arg1[256];
  2777. one_argument(argument, arg1, sizeof(arg1));
  2778.  
  2779. if (*arg1)
  2780. {
  2781. CGuild * g = CGuildManager::instance().FindGuildByName(arg1);
  2782.  
  2783. if (!g)
  2784. {
  2785. DWORD guild_id = 0;
  2786. str_to_number(guild_id, arg1);
  2787. g = CGuildManager::instance().FindGuild(guild_id);
  2788. }
  2789.  
  2790. if (!g)
  2791. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("그런 이름 또는 번호의 길드가 없습니다."));
  2792. else
  2793. {
  2794. char buf[1024+1];
  2795. snprintf(buf, sizeof(buf), msg, g->GetID());
  2796.  
  2797. using namespace quest;
  2798. PC * pc = CQuestManager::instance().GetPC(ch->GetPlayerID());
  2799. QuestState qs = CQuestManager::instance().OpenState("ADMIN_QUEST", QUEST_FISH_REFINE_STATE_INDEX);
  2800. luaL_loadbuffer(qs.co, buf, strlen(buf), "ADMIN_QUEST");
  2801. pc->SetQuest("ADMIN_QUEST", qs);
  2802.  
  2803. QuestState & rqs = *pc->GetRunningQuestState();
  2804.  
  2805. if (!CQuestManager::instance().RunState(rqs))
  2806. {
  2807. CQuestManager::instance().CloseState(rqs);
  2808. pc->EndRunning();
  2809. return;
  2810. }
  2811. }
  2812. }
  2813. }
  2814.  
  2815. ACMD(do_mount_test)
  2816. {
  2817. char arg1[256];
  2818.  
  2819. one_argument(argument, arg1, sizeof(arg1));
  2820.  
  2821. if (*arg1)
  2822. {
  2823. DWORD vnum = 0;
  2824. str_to_number(vnum, arg1);
  2825. ch->MountVnum(vnum);
  2826. }
  2827. }
  2828.  
  2829. ACMD(do_observer)
  2830. {
  2831. ch->SetObserverMode(!ch->IsObserverMode());
  2832. }
  2833.  
  2834. ACMD(do_socket_item)
  2835. {
  2836. char arg1[256], arg2[256];
  2837. two_arguments(argument, arg1, sizeof(arg1), arg2, sizeof(arg2));
  2838.  
  2839. if (*arg1)
  2840. {
  2841. DWORD dwVnum = 0;
  2842. str_to_number(dwVnum, arg1);
  2843.  
  2844. int iSocketCount = 0;
  2845. str_to_number(iSocketCount, arg2);
  2846.  
  2847. if (!iSocketCount || iSocketCount >= ITEM_SOCKET_MAX_NUM)
  2848. iSocketCount = 3;
  2849.  
  2850. if (!dwVnum)
  2851. {
  2852. if (!ITEM_MANAGER::instance().GetVnum(arg1, dwVnum))
  2853. {
  2854. ch->ChatPacket(CHAT_TYPE_INFO, "#%d item not exist by that vnum.", dwVnum);
  2855. return;
  2856. }
  2857. }
  2858.  
  2859. LPITEM item = ch->AutoGiveItem(dwVnum);
  2860.  
  2861. if (item)
  2862. {
  2863. for (int i = 0; i < iSocketCount; ++i)
  2864. item->SetSocket(i, 1);
  2865. }
  2866. else
  2867. {
  2868. ch->ChatPacket(CHAT_TYPE_INFO, "#%d cannot create item.", dwVnum);
  2869. }
  2870. }
  2871. }
  2872.  
  2873. ACMD(do_xmas)
  2874. {
  2875. char arg1[256];
  2876. one_argument(argument, arg1, sizeof(arg1));
  2877.  
  2878. int flag = 0;
  2879.  
  2880. if (*arg1)
  2881. str_to_number(flag, arg1);
  2882.  
  2883. switch (subcmd)
  2884. {
  2885. case SCMD_XMAS_SNOW:
  2886. quest::CQuestManager::instance().RequestSetEventFlag("xmas_snow", flag);
  2887. break;
  2888.  
  2889. case SCMD_XMAS_BOOM:
  2890. quest::CQuestManager::instance().RequestSetEventFlag("xmas_boom", flag);
  2891. break;
  2892.  
  2893. case SCMD_XMAS_SANTA:
  2894. quest::CQuestManager::instance().RequestSetEventFlag("xmas_santa", flag);
  2895. break;
  2896. }
  2897. }
  2898.  
  2899.  
  2900. // BLOCK_CHAT
  2901. ACMD(do_block_chat_list)
  2902. {
  2903. // GM이 아니거나 block_chat_privilege가 없는 사람은 명령어 사용 불가
  2904. if (!ch || (ch->GetGMLevel() < GM_HIGH_WIZARD && ch->GetQuestFlag("chat_privilege.block") <= 0))
  2905. {
  2906. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("그런 명령어는 없습니다"));
  2907. return;
  2908. }
  2909.  
  2910. DBManager::instance().ReturnQuery(QID_BLOCK_CHAT_LIST, ch->GetPlayerID(), NULL,
  2911. "SELECT p.name, a.lDuration FROM affect%s as a, player%s as p WHERE a.bType = %d AND a.dwPID = p.id",
  2912. get_table_postfix(), get_table_postfix(), AFFECT_BLOCK_CHAT);
  2913. }
  2914.  
  2915. ACMD(do_vote_block_chat)
  2916. {
  2917. return;
  2918.  
  2919. char arg1[256];
  2920. argument = one_argument(argument, arg1, sizeof(arg1));
  2921.  
  2922. if (!*arg1)
  2923. {
  2924. ch->ChatPacket(CHAT_TYPE_INFO, "Usage: vote_block_chat <name>");
  2925. return;
  2926. }
  2927.  
  2928. const char* name = arg1;
  2929. long lBlockDuration = 10;
  2930. sys_log(0, "vote_block_chat %s %d", name, lBlockDuration);
  2931.  
  2932. LPCHARACTER tch = CHARACTER_MANAGER::instance().FindPC(name);
  2933.  
  2934. if (!tch)
  2935. {
  2936. CCI * pkCCI = P2P_MANAGER::instance().Find(name);
  2937.  
  2938. if (pkCCI)
  2939. {
  2940. TPacketGGBlockChat p;
  2941.  
  2942. p.bHeader = HEADER_GG_BLOCK_CHAT;
  2943. strlcpy(p.szName, name, sizeof(p.szName));
  2944. p.lBlockDuration = lBlockDuration;
  2945. P2P_MANAGER::instance().Send(&p, sizeof(TPacketGGBlockChat));
  2946. }
  2947. else
  2948. {
  2949. TPacketBlockChat p;
  2950.  
  2951. strlcpy(p.szName, name, sizeof(p.szName));
  2952. p.lDuration = lBlockDuration;
  2953. db_clientdesc->DBPacket(HEADER_GD_BLOCK_CHAT, ch ? ch->GetDesc()->GetHandle() : 0, &p, sizeof(p));
  2954.  
  2955. }
  2956.  
  2957. if (ch)
  2958. ch->ChatPacket(CHAT_TYPE_INFO, "Chat block requested.");
  2959.  
  2960. return;
  2961. }
  2962.  
  2963. if (tch && ch != tch)
  2964. tch->AddAffect(AFFECT_BLOCK_CHAT, POINT_NONE, 0, AFF_NONE, lBlockDuration, 0, true);
  2965. }
  2966.  
  2967. ACMD(do_block_chat)
  2968. {
  2969. // GM이 아니거나 block_chat_privilege가 없는 사람은 명령어 사용 불가
  2970. if (ch && (ch->GetGMLevel() < GM_HIGH_WIZARD && ch->GetQuestFlag("chat_privilege.block") <= 0))
  2971. {
  2972. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("그런 명령어는 없습니다"));
  2973. return;
  2974. }
  2975.  
  2976. char arg1[256];
  2977. argument = one_argument(argument, arg1, sizeof(arg1));
  2978.  
  2979. if (!*arg1)
  2980. {
  2981. if (ch)
  2982. ch->ChatPacket(CHAT_TYPE_INFO, "Usage: block_chat <name> <time> (0 to off)");
  2983.  
  2984. return;
  2985. }
  2986.  
  2987. const char* name = arg1;
  2988. long lBlockDuration = parse_time_str(argument);
  2989.  
  2990. if (lBlockDuration < 0)
  2991. {
  2992. if (ch)
  2993. {
  2994. ch->ChatPacket(CHAT_TYPE_INFO, "잘못된 형식의 시간입니다. h, m, s를 붙여서 지정해 주십시오.");
  2995. ch->ChatPacket(CHAT_TYPE_INFO, "예) 10s, 10m, 1m 30s");
  2996. }
  2997. return;
  2998. }
  2999.  
  3000. sys_log(0, "BLOCK CHAT %s %d", name, lBlockDuration);
  3001.  
  3002. LPCHARACTER tch = CHARACTER_MANAGER::instance().FindPC(name);
  3003.  
  3004. if (!tch)
  3005. {
  3006. CCI * pkCCI = P2P_MANAGER::instance().Find(name);
  3007.  
  3008. if (pkCCI)
  3009. {
  3010. TPacketGGBlockChat p;
  3011.  
  3012. p.bHeader = HEADER_GG_BLOCK_CHAT;
  3013. strlcpy(p.szName, name, sizeof(p.szName));
  3014. p.lBlockDuration = lBlockDuration;
  3015. P2P_MANAGER::instance().Send(&p, sizeof(TPacketGGBlockChat));
  3016. }
  3017. else
  3018. {
  3019. TPacketBlockChat p;
  3020.  
  3021. strlcpy(p.szName, name, sizeof(p.szName));
  3022. p.lDuration = lBlockDuration;
  3023. db_clientdesc->DBPacket(HEADER_GD_BLOCK_CHAT, ch ? ch->GetDesc()->GetHandle() : 0, &p, sizeof(p));
  3024. }
  3025.  
  3026. if (ch)
  3027. ch->ChatPacket(CHAT_TYPE_INFO, "Chat block requested.");
  3028.  
  3029. return;
  3030. }
  3031.  
  3032. if (tch && ch != tch)
  3033. tch->AddAffect(AFFECT_BLOCK_CHAT, POINT_NONE, 0, AFF_NONE, lBlockDuration, 0, true);
  3034. }
  3035. // END_OF_BLOCK_CHAT
  3036.  
  3037. // BUILD_BUILDING
  3038. ACMD(do_build)
  3039. {
  3040. using namespace building;
  3041.  
  3042. char arg1[256], arg2[256], arg3[256], arg4[256];
  3043. const char * line = one_argument(argument, arg1, sizeof(arg1));
  3044. BYTE GMLevel = ch->GetGMLevel();
  3045.  
  3046. CLand * pkLand = CManager::instance().FindLand(ch->GetMapIndex(), ch->GetX(), ch->GetY());
  3047.  
  3048. // NOTE: 조건 체크들은 클라이언트와 서버가 함께 하기 때문에 문제가 있을 때는
  3049. // 메세지를 전송하지 않고 에러를 출력한다.
  3050. if (!pkLand)
  3051. {
  3052. sys_err("%s trying to build on not buildable area.", ch->GetName());
  3053. return;
  3054. }
  3055.  
  3056. if (!*arg1)
  3057. {
  3058. ch->ChatPacket(CHAT_TYPE_INFO, "Invalid syntax: no command");
  3059. return;
  3060. }
  3061.  
  3062. // 건설 권한 체크
  3063. if (GMLevel == GM_PLAYER)
  3064. {
  3065. // 플레이어가 집을 지을 때는 땅이 내껀지 확인해야 한다.
  3066. if ((!ch->GetGuild() || ch->GetGuild()->GetID() != pkLand->GetOwner()))
  3067. {
  3068. sys_err("%s trying to build on not owned land.", ch->GetName());
  3069. return;
  3070. }
  3071.  
  3072. // 내가 길마인가?
  3073. if (ch->GetGuild()->GetMasterPID() != ch->GetPlayerID())
  3074. {
  3075. sys_err("%s trying to build while not the guild master.", ch->GetName());
  3076. return;
  3077. }
  3078. }
  3079.  
  3080. switch (LOWER(*arg1))
  3081. {
  3082. case 'c':
  3083. {
  3084. // /build c vnum x y x_rot y_rot z_rot
  3085. char arg5[256], arg6[256];
  3086. line = one_argument(two_arguments(line, arg1, sizeof(arg1), arg2, sizeof(arg2)), arg3, sizeof(arg3)); // vnum x y
  3087. one_argument(two_arguments(line, arg4, sizeof(arg4), arg5, sizeof(arg5)), arg6, sizeof(arg6)); // x_rot y_rot z_rot
  3088.  
  3089. if (!*arg1 || !*arg2 || !*arg3 || !*arg4 || !*arg5 || !*arg6)
  3090. {
  3091. ch->ChatPacket(CHAT_TYPE_INFO, "Invalid syntax");
  3092. return;
  3093. }
  3094.  
  3095. DWORD dwVnum = 0;
  3096. str_to_number(dwVnum, arg1);
  3097.  
  3098. using namespace building;
  3099.  
  3100. const TObjectProto * t = CManager::instance().GetObjectProto(dwVnum);
  3101. if (!t)
  3102. {
  3103. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("존재하지 않는 건물입니다."));
  3104. return;
  3105. }
  3106.  
  3107. const DWORD BUILDING_MAX_PRICE = 100000000;
  3108.  
  3109. if (t->dwGroupVnum)
  3110. {
  3111. if (pkLand->FindObjectByGroup(t->dwGroupVnum))
  3112. {
  3113. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("같이 지을 수 없는 종류의 건물이 지어져 있습니다."));
  3114. return;
  3115. }
  3116. }
  3117.  
  3118. // 건물 종속성 체크 (이 건물이 지어져 있어야함)
  3119. if (t->dwDependOnGroupVnum)
  3120. {
  3121. // const TObjectProto * dependent = CManager::instance().GetObjectProto(dwVnum);
  3122. // if (dependent)
  3123. {
  3124. // 지어져있는가?
  3125. if (!pkLand->FindObjectByGroup(t->dwDependOnGroupVnum))
  3126. {
  3127. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("건설에 필요한 건물이 지어져 있지 않습니다."));
  3128. return;
  3129. }
  3130. }
  3131. }
  3132.  
  3133. if (test_server || GMLevel == GM_PLAYER)
  3134. {
  3135. // GM이 아닐경우만 (테섭에서는 GM도 소모)
  3136. // 건설 비용 체크
  3137. if (t->dwPrice > BUILDING_MAX_PRICE)
  3138. {
  3139. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("건물 비용 정보 이상으로 건설 작업에 실패했습니다."));
  3140. return;
  3141. }
  3142.  
  3143. if (ch->GetGold() < (int)t->dwPrice)
  3144. {
  3145. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("건설 비용이 부족합니다."));
  3146. return;
  3147. }
  3148.  
  3149. // 아이템 자재 개수 체크
  3150.  
  3151. int i;
  3152. for (i = 0; i < OBJECT_MATERIAL_MAX_NUM; ++i)
  3153. {
  3154. DWORD dwItemVnum = t->kMaterials[i].dwItemVnum;
  3155. DWORD dwItemCount = t->kMaterials[i].dwCount;
  3156.  
  3157. if (dwItemVnum == 0)
  3158. break;
  3159.  
  3160. if ((int) dwItemCount > ch->CountSpecifyItem(dwItemVnum))
  3161. {
  3162. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("자재가 부족하여 건설할 수 없습니다."));
  3163. return;
  3164. }
  3165. }
  3166. }
  3167.  
  3168. float x_rot = atof(arg4);
  3169. float y_rot = atof(arg5);
  3170. float z_rot = atof(arg6);
  3171. // 20050811.myevan.건물 회전 기능 봉인 해제
  3172. /*
  3173. if (x_rot != 0.0f || y_rot != 0.0f || z_rot != 0.0f)
  3174. {
  3175. ch->ChatPacket(CHAT_TYPE_INFO, "건물 회전 기능은 아직 제공되지 않습니다");
  3176. return;
  3177. }
  3178. */
  3179.  
  3180. long map_x = 0;
  3181. str_to_number(map_x, arg2);
  3182. long map_y = 0;
  3183. str_to_number(map_y, arg3);
  3184.  
  3185. bool isSuccess = pkLand->RequestCreateObject(dwVnum,
  3186. ch->GetMapIndex(),
  3187. map_x,
  3188. map_y,
  3189. x_rot,
  3190. y_rot,
  3191. z_rot, true);
  3192.  
  3193. if (!isSuccess)
  3194. {
  3195. if (test_server)
  3196. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("건물을 지을 수 없는 위치입니다."));
  3197. return;
  3198. }
  3199.  
  3200. if (test_server || GMLevel == GM_PLAYER)
  3201. // 건설 재료 소모하기 (테섭에서는 GM도 소모)
  3202. {
  3203. // 건설 비용 소모
  3204. ch->PointChange(POINT_GOLD, -static_cast<long long>(t->dwPrice));
  3205.  
  3206. // 아이템 자재 사용하기
  3207. {
  3208. int i;
  3209. for (i = 0; i < OBJECT_MATERIAL_MAX_NUM; ++i)
  3210. {
  3211. DWORD dwItemVnum = t->kMaterials[i].dwItemVnum;
  3212. DWORD dwItemCount = t->kMaterials[i].dwCount;
  3213.  
  3214. if (dwItemVnum == 0)
  3215. break;
  3216.  
  3217. sys_log(0, "BUILD: material %d %u %u", i, dwItemVnum, dwItemCount);
  3218. ch->RemoveSpecifyItem(dwItemVnum, dwItemCount);
  3219. }
  3220. }
  3221. }
  3222. }
  3223. break;
  3224.  
  3225. case 'd' :
  3226. // build (d)elete ObjectID
  3227. {
  3228. one_argument(line, arg1, sizeof(arg1));
  3229.  
  3230. if (!*arg1)
  3231. {
  3232. ch->ChatPacket(CHAT_TYPE_INFO, "Invalid syntax");
  3233. return;
  3234. }
  3235.  
  3236. DWORD vid = 0;
  3237. str_to_number(vid, arg1);
  3238. pkLand->RequestDeleteObjectByVID(vid);
  3239. }
  3240. break;
  3241.  
  3242. // BUILD_WALL
  3243.  
  3244. // build w n/e/w/s
  3245. case 'w' :
  3246. if (GMLevel > GM_PLAYER)
  3247. {
  3248. int mapIndex = ch->GetMapIndex();
  3249.  
  3250. one_argument(line, arg1, sizeof(arg1));
  3251.  
  3252. sys_log(0, "guild.wall.build map[%d] direction[%s]", mapIndex, arg1);
  3253.  
  3254. switch (arg1[0])
  3255. {
  3256. case 's':
  3257. pkLand->RequestCreateWall(mapIndex, 0.0f);
  3258. break;
  3259. case 'n':
  3260. pkLand->RequestCreateWall(mapIndex, 180.0f);
  3261. break;
  3262. case 'e':
  3263. pkLand->RequestCreateWall(mapIndex, 90.0f);
  3264. break;
  3265. case 'w':
  3266. pkLand->RequestCreateWall(mapIndex, 270.0f);
  3267. break;
  3268. default:
  3269. ch->ChatPacket(CHAT_TYPE_INFO, "guild.wall.build unknown_direction[%s]", arg1);
  3270. sys_err("guild.wall.build unknown_direction[%s]", arg1);
  3271. break;
  3272. }
  3273.  
  3274. }
  3275. break;
  3276.  
  3277. case 'e':
  3278. if (GMLevel > GM_PLAYER)
  3279. {
  3280. pkLand->RequestDeleteWall();
  3281. }
  3282. break;
  3283.  
  3284. case 'W' :
  3285. // 담장 세우기
  3286. // build (w)all 담장번호 담장크기 대문동 대문서 대문남 대문북
  3287.  
  3288. if (GMLevel > GM_PLAYER)
  3289. {
  3290. int setID = 0, wallSize = 0;
  3291. char arg5[256], arg6[256];
  3292. line = two_arguments(line, arg1, sizeof(arg1), arg2, sizeof(arg2));
  3293. line = two_arguments(line, arg3, sizeof(arg3), arg4, sizeof(arg4));
  3294. two_arguments(line, arg5, sizeof(arg5), arg6, sizeof(arg6));
  3295.  
  3296. str_to_number(setID, arg1);
  3297. str_to_number(wallSize, arg2);
  3298.  
  3299. if (setID != 14105 && setID != 14115 && setID != 14125)
  3300. {
  3301. sys_log(0, "BUILD_WALL: wrong wall set id %d", setID);
  3302. break;
  3303. }
  3304. else
  3305. {
  3306. bool door_east = false;
  3307. str_to_number(door_east, arg3);
  3308. bool door_west = false;
  3309. str_to_number(door_west, arg4);
  3310. bool door_south = false;
  3311. str_to_number(door_south, arg5);
  3312. bool door_north = false;
  3313. str_to_number(door_north, arg6);
  3314. pkLand->RequestCreateWallBlocks(setID, ch->GetMapIndex(), wallSize, door_east, door_west, door_south, door_north);
  3315. }
  3316. }
  3317. break;
  3318.  
  3319. case 'E' :
  3320. // 담장 지우기
  3321. // build (e)rase 담장셋ID
  3322. if (GMLevel > GM_PLAYER)
  3323. {
  3324. one_argument(line, arg1, sizeof(arg1));
  3325. DWORD id = 0;
  3326. str_to_number(id, arg1);
  3327. pkLand->RequestDeleteWallBlocks(id);
  3328. }
  3329. break;
  3330.  
  3331. default:
  3332. ch->ChatPacket(CHAT_TYPE_INFO, "Invalid command %s", arg1);
  3333. break;
  3334. }
  3335. }
  3336. // END_OF_BUILD_BUILDING
  3337.  
  3338. ACMD(do_clear_quest)
  3339. {
  3340. char arg1[256];
  3341.  
  3342. one_argument(argument, arg1, sizeof(arg1));
  3343.  
  3344. if (!*arg1)
  3345. return;
  3346.  
  3347. quest::PC* pPC = quest::CQuestManager::instance().GetPCForce(ch->GetPlayerID());
  3348. pPC->ClearQuest(arg1);
  3349. }
  3350.  
  3351. ACMD(do_horse_state)
  3352. {
  3353. ch->ChatPacket(CHAT_TYPE_INFO, "Horse Information:");
  3354. ch->ChatPacket(CHAT_TYPE_INFO, " Level %d", ch->GetHorseLevel());
  3355. ch->ChatPacket(CHAT_TYPE_INFO, " Health %d/%d (%d%%)", ch->GetHorseHealth(), ch->GetHorseMaxHealth(), ch->GetHorseHealth() * 100 / ch->GetHorseMaxHealth());
  3356. ch->ChatPacket(CHAT_TYPE_INFO, " Stam %d/%d (%d%%)", ch->GetHorseStamina(), ch->GetHorseMaxStamina(), ch->GetHorseStamina() * 100 / ch->GetHorseMaxStamina());
  3357. }
  3358.  
  3359. ACMD(do_horse_level)
  3360. {
  3361. char arg1[256] = {0};
  3362. char arg2[256] = {0};
  3363. LPCHARACTER victim;
  3364. int level = 0;
  3365.  
  3366. two_arguments(argument, arg1, sizeof(arg1), arg2, sizeof(arg2));
  3367.  
  3368. if (!*arg1 || !*arg2)
  3369. {
  3370. ch->ChatPacket(CHAT_TYPE_INFO, "usage : /horse_level <name> <level>");
  3371. return;
  3372. }
  3373.  
  3374. victim = CHARACTER_MANAGER::instance().FindPC(arg1);
  3375.  
  3376. if (NULL == victim)
  3377. {
  3378. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("존재하지 않는 캐릭터 입니다."));
  3379. return;
  3380. }
  3381.  
  3382. str_to_number(level, arg2);
  3383. level = MINMAX(0, level, HORSE_MAX_LEVEL);
  3384.  
  3385. ch->ChatPacket(CHAT_TYPE_INFO, "horse level set (%s: %d)", victim->GetName(), level);
  3386.  
  3387. victim->SetHorseLevel(level);
  3388. victim->ComputePoints();
  3389. victim->SkillLevelPacket();
  3390. return;
  3391.  
  3392. /*-----
  3393. char arg1[256];
  3394. one_argument(argument, arg1, sizeof(arg1));
  3395.  
  3396. int level = MINMAX(0, atoi(arg1), HORSE_MAX_LEVEL);
  3397.  
  3398. ch->ChatPacket(CHAT_TYPE_INFO, "horse level set to %d.", level);
  3399. ch->SetHorseLevel(level);
  3400. ch->ComputePoints();
  3401. ch->SkillLevelPacket();
  3402. return;
  3403. -----*/
  3404. }
  3405.  
  3406. ACMD(do_horse_ride)
  3407. {
  3408. if (ch->IsHorseRiding())
  3409. ch->StopRiding();
  3410. else
  3411. ch->StartRiding();
  3412. }
  3413.  
  3414. ACMD(do_horse_summon)
  3415. {
  3416. ch->HorseSummon(true, true);
  3417. }
  3418.  
  3419. ACMD(do_horse_unsummon)
  3420. {
  3421. ch->HorseSummon(false, true);
  3422. }
  3423.  
  3424. ACMD(do_horse_set_stat)
  3425. {
  3426. char arg1[256], arg2[256];
  3427.  
  3428. two_arguments(argument, arg1, sizeof(arg1), arg2, sizeof(arg2));
  3429.  
  3430. if (*arg1 && *arg2)
  3431. {
  3432. int hp = 0;
  3433. str_to_number(hp, arg1);
  3434. int stam = 0;
  3435. str_to_number(stam, arg2);
  3436. ch->UpdateHorseHealth(hp - ch->GetHorseHealth());
  3437. ch->UpdateHorseStamina(stam - ch->GetHorseStamina());
  3438. }
  3439. else
  3440. {
  3441. ch->ChatPacket(CHAT_TYPE_INFO, "Usage : /horse_set_stat <hp> <stamina>");
  3442. }
  3443. }
  3444.  
  3445. ACMD(do_save_attribute_to_image) // command "/saveati" for alias
  3446. {
  3447. char szFileName[256];
  3448. char szMapIndex[256];
  3449.  
  3450. two_arguments(argument, szMapIndex, sizeof(szMapIndex), szFileName, sizeof(szFileName));
  3451.  
  3452. if (!*szMapIndex || !*szFileName)
  3453. {
  3454. ch->ChatPacket(CHAT_TYPE_INFO, "Syntax: /saveati <map_index> <filename>");
  3455. return;
  3456. }
  3457.  
  3458. long lMapIndex = 0;
  3459. str_to_number(lMapIndex, szMapIndex);
  3460.  
  3461. if (SECTREE_MANAGER::instance().SaveAttributeToImage(lMapIndex, szFileName))
  3462. ch->ChatPacket(CHAT_TYPE_INFO, "Save done.");
  3463. else
  3464. ch->ChatPacket(CHAT_TYPE_INFO, "Save failed.");
  3465. }
  3466.  
  3467. ACMD(do_affect_remove)
  3468. {
  3469. char arg1[256];
  3470. char arg2[256];
  3471.  
  3472. two_arguments(argument, arg1, sizeof(arg1), arg2, sizeof(arg2));
  3473.  
  3474. if (!*arg1 || !*arg2)
  3475. {
  3476. ch->ChatPacket(CHAT_TYPE_INFO, "Syntax: /affect_remove <player name>");
  3477. ch->ChatPacket(CHAT_TYPE_INFO, "Syntax: /affect_remove <type> <point>");
  3478.  
  3479. LPCHARACTER tch = ch;
  3480.  
  3481. if (*arg1)
  3482. if (!(tch = CHARACTER_MANAGER::instance().FindPC(arg1)))
  3483. tch = ch;
  3484.  
  3485. ch->ChatPacket(CHAT_TYPE_INFO, "-- Affect List of %s -------------------------------", tch->GetName());
  3486. ch->ChatPacket(CHAT_TYPE_INFO, "Type Point Modif Duration Flag");
  3487.  
  3488. const std::list<CAffect *> & cont = tch->GetAffectContainer();
  3489.  
  3490. itertype(cont) it = cont.begin();
  3491.  
  3492. while (it != cont.end())
  3493. {
  3494. CAffect * pkAff = *it++;
  3495.  
  3496. ch->ChatPacket(CHAT_TYPE_INFO, "%4d %5d %5d %8d %u",
  3497. pkAff->dwType, pkAff->bApplyOn, pkAff->lApplyValue, pkAff->lDuration, pkAff->dwFlag);
  3498. }
  3499. return;
  3500. }
  3501.  
  3502. bool removed = false;
  3503.  
  3504. CAffect * af;
  3505.  
  3506. DWORD type = 0;
  3507. str_to_number(type, arg1);
  3508. BYTE point = 0;
  3509. str_to_number(point, arg2);
  3510. while ((af = ch->FindAffect(type, point)))
  3511. {
  3512. ch->RemoveAffect(af);
  3513. removed = true;
  3514. }
  3515.  
  3516. if (removed)
  3517. ch->ChatPacket(CHAT_TYPE_INFO, "Affect successfully removed.");
  3518. else
  3519. ch->ChatPacket(CHAT_TYPE_INFO, "Not affected by that type and point.");
  3520. }
  3521.  
  3522. ACMD(do_change_attr)
  3523. {
  3524. LPITEM weapon = ch->GetWear(WEAR_WEAPON);
  3525. if (weapon)
  3526. weapon->ChangeAttribute();
  3527. }
  3528.  
  3529. ACMD(do_add_attr)
  3530. {
  3531. LPITEM weapon = ch->GetWear(WEAR_WEAPON);
  3532. if (weapon)
  3533. weapon->AddAttribute();
  3534. }
  3535.  
  3536. ACMD(do_add_socket)
  3537. {
  3538. LPITEM weapon = ch->GetWear(WEAR_WEAPON);
  3539. if (weapon)
  3540. weapon->AddSocket();
  3541. }
  3542.  
  3543. ACMD(do_show_arena_list)
  3544. {
  3545. CArenaManager::instance().SendArenaMapListTo(ch);
  3546. }
  3547.  
  3548. ACMD(do_end_all_duel)
  3549. {
  3550. CArenaManager::instance().EndAllDuel();
  3551. }
  3552.  
  3553. ACMD(do_end_duel)
  3554. {
  3555. char szName[256];
  3556.  
  3557. one_argument(argument, szName, sizeof(szName));
  3558.  
  3559. LPCHARACTER pChar = CHARACTER_MANAGER::instance().FindPC(szName);
  3560. if (pChar == NULL)
  3561. {
  3562. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("존재하지 않는 캐릭터 입니다."));
  3563. return;
  3564. }
  3565.  
  3566. if (CArenaManager::instance().EndDuel(pChar->GetPlayerID()) == false)
  3567. {
  3568. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("대련 강제 종료 실패"));
  3569. }
  3570. else
  3571. {
  3572. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("대련 강제 종료 성공"));
  3573. }
  3574. }
  3575.  
  3576. ACMD(do_duel)
  3577. {
  3578. char szName1[256];
  3579. char szName2[256];
  3580. char szSet[256];
  3581. char szMinute[256];
  3582. int set = 0;
  3583. int minute = 0;
  3584.  
  3585. argument = two_arguments(argument, szName1, sizeof(szName1), szName2, sizeof(szName2));
  3586. two_arguments(argument, szSet, sizeof(szSet), szMinute, sizeof(szMinute));
  3587.  
  3588. str_to_number(set, szSet);
  3589.  
  3590. if (set < 0) set = 1;
  3591. if (set > 5) set = 5;
  3592.  
  3593. if (!str_to_number(minute, szMinute))
  3594. {
  3595. // 캐나다는 기본 10분.
  3596. if (LC_IsCanada() == true)
  3597. {
  3598. minute = 10;
  3599. }
  3600. else
  3601. {
  3602. minute = 5;
  3603. }
  3604. }
  3605. if (minute < 5)
  3606. minute = 5;
  3607.  
  3608. LPCHARACTER pChar1 = CHARACTER_MANAGER::instance().FindPC(szName1);
  3609. LPCHARACTER pChar2 = CHARACTER_MANAGER::instance().FindPC(szName2);
  3610.  
  3611. if (pChar1 != NULL && pChar2 != NULL)
  3612. {
  3613. pChar1->RemoveGoodAffect();
  3614. pChar2->RemoveGoodAffect();
  3615.  
  3616. pChar1->RemoveBadAffect();
  3617. pChar2->RemoveBadAffect();
  3618.  
  3619. LPPARTY pParty = pChar1->GetParty();
  3620. if (pParty != NULL)
  3621. {
  3622. if (pParty->GetMemberCount() == 2)
  3623. {
  3624. CPartyManager::instance().DeleteParty(pParty);
  3625. }
  3626. else
  3627. {
  3628. pChar1->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<파티> 파티에서 나가셨습니다."));
  3629. pParty->Quit(pChar1->GetPlayerID());
  3630. }
  3631. }
  3632.  
  3633. pParty = pChar2->GetParty();
  3634. if (pParty != NULL)
  3635. {
  3636. if (pParty->GetMemberCount() == 2)
  3637. {
  3638. CPartyManager::instance().DeleteParty(pParty);
  3639. }
  3640. else
  3641. {
  3642. pChar2->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<파티> 파티에서 나가셨습니다."));
  3643. pParty->Quit(pChar2->GetPlayerID());
  3644. }
  3645. }
  3646.  
  3647. if (CArenaManager::instance().StartDuel(pChar1, pChar2, set, minute) == true)
  3648. {
  3649. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("대련이 성공적으로 시작 되었습니다."));
  3650. }
  3651. else
  3652. {
  3653. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("대련 시작에 문제가 있습니다."));
  3654. }
  3655. }
  3656. else
  3657. {
  3658. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("대련자가 없습니다."));
  3659. }
  3660. }
  3661.  
  3662. ACMD(do_stat_plus_amount)
  3663. {
  3664. char szPoint[256];
  3665.  
  3666. one_argument(argument, szPoint, sizeof(szPoint));
  3667.  
  3668. if (*szPoint == '\0')
  3669. return;
  3670.  
  3671. if (ch->IsPolymorphed())
  3672. {
  3673. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("둔갑 중에는 능력을 올릴 수 없습니다."));
  3674. return;
  3675. }
  3676.  
  3677. int nRemainPoint = ch->GetPoint(POINT_STAT);
  3678.  
  3679. if (nRemainPoint <= 0)
  3680. {
  3681. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("남은 스탯 포인트가 없습니다."));
  3682. return;
  3683. }
  3684.  
  3685. int nPoint = 0;
  3686. str_to_number(nPoint, szPoint);
  3687.  
  3688. if (nRemainPoint < nPoint)
  3689. {
  3690. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("남은 스탯 포인트가 적습니다."));
  3691. return;
  3692. }
  3693.  
  3694. if (nPoint < 0)
  3695. {
  3696. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("값을 잘못 입력하였습니다."));
  3697. return;
  3698. }
  3699.  
  3700. switch (subcmd)
  3701. {
  3702. case POINT_HT : // 체력 vagabond stat?ayarlar?cmd_general.cpp 651 - char.cpp 5904
  3703. if (nPoint + ch->GetPoint(POINT_HT) > 90)
  3704. {
  3705. nPoint = 90 - ch->GetPoint(POINT_HT);
  3706. }
  3707. break;
  3708.  
  3709. case POINT_IQ : // 지능
  3710. if (nPoint + ch->GetPoint(POINT_IQ) > 90)
  3711. {
  3712. nPoint = 90 - ch->GetPoint(POINT_IQ);
  3713. }
  3714. break;
  3715.  
  3716. case POINT_ST : // 근력
  3717. if (nPoint + ch->GetPoint(POINT_ST) > 90)
  3718. {
  3719. nPoint = 90 - ch->GetPoint(POINT_ST);
  3720. }
  3721. break;
  3722.  
  3723. case POINT_DX : // 민첩
  3724. if (nPoint + ch->GetPoint(POINT_DX) > 90)
  3725. {
  3726. nPoint = 90 - ch->GetPoint(POINT_DX);
  3727. }
  3728. break;
  3729.  
  3730. default :
  3731. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("명령어의 서브 커맨드가 잘못 되었습니다."));
  3732. return;
  3733. break;
  3734. }
  3735.  
  3736. if (nPoint != 0)
  3737. {
  3738. ch->SetRealPoint(subcmd, ch->GetRealPoint(subcmd) + nPoint);
  3739. ch->SetPoint(subcmd, ch->GetPoint(subcmd) + nPoint);
  3740. ch->ComputePoints();
  3741. ch->PointChange(subcmd, 0);
  3742.  
  3743. ch->PointChange(POINT_STAT, -nPoint);
  3744. ch->ComputePoints();
  3745. }
  3746. }
  3747.  
  3748. struct tTwoPID
  3749. {
  3750. int pid1;
  3751. int pid2;
  3752. };
  3753.  
  3754. ACMD(do_break_marriage)
  3755. {
  3756. char arg1[256], arg2[256];
  3757. two_arguments(argument, arg1, sizeof(arg1), arg2, sizeof(arg2));
  3758.  
  3759. tTwoPID pids = { 0, 0 };
  3760.  
  3761. str_to_number(pids.pid1, arg1);
  3762. str_to_number(pids.pid2, arg2);
  3763.  
  3764. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("플레이어 %d 와 플레이어 %d를 파혼시킵니다.."), pids.pid1, pids.pid2);
  3765. db_clientdesc->DBPacket(HEADER_GD_BREAK_MARRIAGE, 0, &pids, sizeof(pids));
  3766. }
  3767.  
  3768. ACMD(do_effect)
  3769. {
  3770. char arg1[256];
  3771.  
  3772. one_argument(argument, arg1, sizeof(arg1));
  3773.  
  3774. int effect_type = 0;
  3775. str_to_number(effect_type, arg1);
  3776. ch->EffectPacket(effect_type);
  3777. }
  3778.  
  3779.  
  3780. struct FCountInMap
  3781. {
  3782. int m_Count[4];
  3783. FCountInMap() { memset(m_Count, 0, sizeof(int) * 4); }
  3784. void operator()(LPENTITY ent)
  3785. {
  3786. if (ent->IsType(ENTITY_CHARACTER))
  3787. {
  3788. LPCHARACTER ch = (LPCHARACTER) ent;
  3789. if (ch && ch->IsPC())
  3790. ++m_Count[ch->GetEmpire()];
  3791. }
  3792. }
  3793. int GetCount(BYTE bEmpire) { return m_Count[bEmpire]; }
  3794. };
  3795.  
  3796. ACMD(do_threeway_war_info)
  3797. {
  3798. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("각제국 진행 정보"));
  3799. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("선택 맵 정보 성지 %d 통로 %d %d %d"), GetSungziMapIndex(), GetPassMapIndex(1), GetPassMapIndex(2), GetPassMapIndex(3));
  3800. ch->ChatPacket(CHAT_TYPE_INFO, "ThreewayPhase %d", CThreeWayWar::instance().GetRegenFlag());
  3801.  
  3802. for (int n = 1; n < 4; ++n)
  3803. {
  3804. LPSECTREE_MAP pSecMap = SECTREE_MANAGER::instance().GetMap(GetSungziMapIndex());
  3805.  
  3806. FCountInMap c;
  3807.  
  3808. if (pSecMap)
  3809. {
  3810. pSecMap->for_each(c);
  3811. }
  3812.  
  3813. ch->ChatPacket(CHAT_TYPE_INFO, "%s killscore %d usercount %d",
  3814. EMPIRE_NAME(n),
  3815. CThreeWayWar::instance().GetKillScore(n),
  3816. c.GetCount(n));
  3817. }
  3818. }
  3819.  
  3820. ACMD(do_threeway_war_myinfo)
  3821. {
  3822. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("나의 삼거리 진행정보"));
  3823. ch->ChatPacket(CHAT_TYPE_INFO, "Deadcount %d",
  3824. CThreeWayWar::instance().GetReviveTokenForPlayer(ch->GetPlayerID()));
  3825. }
  3826.  
  3827. ACMD(do_rmcandidacy)
  3828. {
  3829. char arg1[256];
  3830.  
  3831. one_argument(argument, arg1, sizeof(arg1));
  3832.  
  3833. if (!*arg1)
  3834. {
  3835. ch->ChatPacket(CHAT_TYPE_INFO, "Usage: rmcandidacy <name>");
  3836. return;
  3837. }
  3838.  
  3839. LPCHARACTER tch = CHARACTER_MANAGER::instance().FindPC(arg1);
  3840.  
  3841. if (!tch)
  3842. {
  3843. CCI * pkCCI = P2P_MANAGER::instance().Find(arg1);
  3844.  
  3845. if (pkCCI)
  3846. {
  3847. if (pkCCI->bChannel != g_bChannel)
  3848. {
  3849. ch->ChatPacket(CHAT_TYPE_INFO, "Target is in %d channel (my channel %d)", pkCCI->bChannel, g_bChannel);
  3850. return;
  3851. }
  3852. }
  3853. }
  3854.  
  3855. db_clientdesc->DBPacket(HEADER_GD_RMCANDIDACY, 0, NULL, 32);
  3856. db_clientdesc->Packet(arg1, 32);
  3857. }
  3858.  
  3859. ACMD(do_setmonarch)
  3860. {
  3861. char arg1[256];
  3862.  
  3863. one_argument(argument, arg1, sizeof(arg1));
  3864.  
  3865. if (!*arg1)
  3866. {
  3867. ch->ChatPacket(CHAT_TYPE_INFO, "Usage: setmonarch <name>");
  3868. return;
  3869. }
  3870.  
  3871. db_clientdesc->DBPacket(HEADER_GD_SETMONARCH, 0, NULL, 32);
  3872. db_clientdesc->Packet(arg1, 32);
  3873. }
  3874.  
  3875. ACMD(do_rmmonarch)
  3876. {
  3877. char arg1[256];
  3878.  
  3879. one_argument(argument, arg1, sizeof(arg1));
  3880.  
  3881. if (!*arg1)
  3882. {
  3883. ch->ChatPacket(CHAT_TYPE_INFO, "Usage: rmmonarch <name>");
  3884. return;
  3885. }
  3886.  
  3887. db_clientdesc->DBPacket(HEADER_GD_RMMONARCH, 0, NULL, 32);
  3888. db_clientdesc->Packet(arg1, 32);
  3889. }
  3890.  
  3891. ACMD(do_check_monarch_money)
  3892. {
  3893. char arg1[256];
  3894.  
  3895. one_argument(argument, arg1, sizeof(arg1));
  3896.  
  3897. if (!*arg1)
  3898. return;
  3899.  
  3900. int empire = 0;
  3901. str_to_number(empire, arg1);
  3902. int NationMoney = CMonarch::instance().GetMoney(empire);
  3903.  
  3904. ch->ChatPacket(CHAT_TYPE_INFO, "국고: %d 원", NationMoney);
  3905. }
  3906.  
  3907. ACMD(do_reset_subskill)
  3908. {
  3909. char arg1[256];
  3910.  
  3911. one_argument(argument, arg1, sizeof(arg1));
  3912.  
  3913. if (!*arg1)
  3914. {
  3915. ch->ChatPacket(CHAT_TYPE_INFO, "Usage: reset_subskill <name>");
  3916. return;
  3917. }
  3918.  
  3919. LPCHARACTER tch = CHARACTER_MANAGER::instance().FindPC(arg1);
  3920.  
  3921. if (tch == NULL)
  3922. return;
  3923.  
  3924. tch->ClearSubSkill();
  3925. ch->ChatPacket(CHAT_TYPE_INFO, "Subskill of [%s] was reset", tch->GetName());
  3926. }
  3927.  
  3928. ACMD(do_siege)
  3929. {
  3930. char arg1[256], arg2[256];
  3931. two_arguments(argument, arg1, sizeof(arg1), arg2, sizeof(arg2));
  3932.  
  3933. int empire = strtol(arg1, NULL, 10);
  3934. int tower_count = strtol(arg2, NULL, 10);
  3935.  
  3936. if (empire == 0) empire = number(1, 3);
  3937. if (tower_count < 5 || tower_count > 10) tower_count = number(5, 10);
  3938.  
  3939. TPacketGGSiege packet;
  3940. packet.bHeader = HEADER_GG_SIEGE;
  3941. packet.bEmpire = empire;
  3942. packet.bTowerCount = tower_count;
  3943.  
  3944. P2P_MANAGER::instance().Send(&packet, sizeof(TPacketGGSiege));
  3945.  
  3946. switch (castle_siege(empire, tower_count))
  3947. {
  3948. case 0 :
  3949. ch->ChatPacket(CHAT_TYPE_INFO, "SIEGE FAILED");
  3950. break;
  3951. case 1 :
  3952. ch->ChatPacket(CHAT_TYPE_INFO, "SIEGE START Empire(%d) Tower(%d)", empire, tower_count);
  3953. break;
  3954. case 2 :
  3955. ch->ChatPacket(CHAT_TYPE_INFO, "SIEGE END");
  3956. break;
  3957. }
  3958. }
  3959.  
  3960. ACMD(do_temp)
  3961. {
  3962. if (false == test_server)
  3963. return;
  3964.  
  3965. char arg1[256], arg2[256];
  3966. two_arguments(argument, arg1, sizeof(arg1), arg2, sizeof(arg2));
  3967.  
  3968. if (0 == arg1[0] || 0 == arg2[0])
  3969. {
  3970. ch->ChatPacket(CHAT_TYPE_INFO, "Usage: empire money");
  3971. return;
  3972. }
  3973.  
  3974. int empire = 0;
  3975. str_to_number(empire, arg1);
  3976. int money = 0;
  3977. str_to_number(money, arg2);
  3978.  
  3979. CMonarch::instance().SendtoDBAddMoney(money, empire, ch);
  3980. }
  3981.  
  3982. ACMD(do_frog)
  3983. {
  3984. char arg1[256];
  3985. one_argument(argument, arg1, sizeof(arg1));
  3986.  
  3987. if (0 == arg1[0])
  3988. {
  3989. ch->ChatPacket(CHAT_TYPE_INFO, "Usage: empire(1, 2, 3)");
  3990. return;
  3991. }
  3992.  
  3993. int empire = 0;
  3994. str_to_number(empire, arg1);
  3995.  
  3996. switch (empire)
  3997. {
  3998. case 1:
  3999. case 2:
  4000. case 3:
  4001. if (IS_CASTLE_MAP(ch->GetMapIndex()))
  4002. {
  4003. castle_spawn_frog(empire);
  4004. castle_save();
  4005. }
  4006. else
  4007. ch->ChatPacket(CHAT_TYPE_INFO, "You must spawn frog in castle");
  4008. break;
  4009.  
  4010. default:
  4011. ch->ChatPacket(CHAT_TYPE_INFO, "Usage: empire(1, 2, 3)");
  4012. break;
  4013. }
  4014.  
  4015. }
  4016.  
  4017. ACMD(do_flush)
  4018. {
  4019. char arg1[256];
  4020. one_argument(argument, arg1, sizeof(arg1));
  4021.  
  4022. if (0 == arg1[0])
  4023. {
  4024. ch->ChatPacket(CHAT_TYPE_INFO, "usage : /flush player_id");
  4025. return;
  4026. }
  4027.  
  4028. DWORD pid = (DWORD) strtoul(arg1, NULL, 10);
  4029.  
  4030. db_clientdesc->DBPacketHeader(HEADER_GD_FLUSH_CACHE, 0, sizeof(DWORD));
  4031. db_clientdesc->Packet(&pid, sizeof(DWORD));
  4032. }
  4033.  
  4034. ACMD(do_eclipse)
  4035. {
  4036. char arg1[256];
  4037. one_argument(argument, arg1, sizeof(arg1));
  4038.  
  4039. if (strtol(arg1, NULL, 10) == 1)
  4040. {
  4041. quest::CQuestManager::instance().RequestSetEventFlag("eclipse", 1);
  4042. }
  4043. else
  4044. {
  4045. quest::CQuestManager::instance().RequestSetEventFlag("eclipse", 0);
  4046. }
  4047. }
  4048.  
  4049. ACMD(do_weeklyevent)
  4050. {
  4051. char arg1[256];
  4052. int empire = 0;
  4053.  
  4054. if (CBattleArena::instance().IsRunning() == false)
  4055. {
  4056. one_argument(argument, arg1, sizeof(arg1));
  4057.  
  4058. empire = strtol(arg1, NULL, 10);
  4059.  
  4060. if (empire == 1 || empire == 2 || empire == 3)
  4061. {
  4062. CBattleArena::instance().Start(empire);
  4063. }
  4064. else
  4065. {
  4066. CBattleArena::instance().Start(rand()%3 + 1);
  4067. }
  4068. ch->ChatPacket(CHAT_TYPE_INFO, "Weekly Event Start");
  4069. }
  4070. else
  4071. {
  4072. CBattleArena::instance().ForceEnd();
  4073. ch->ChatPacket(CHAT_TYPE_INFO, "Weekly Event End");
  4074. }
  4075. }
  4076.  
  4077. ACMD(do_event_helper)
  4078. {
  4079. char arg1[256];
  4080. int mode = 0;
  4081.  
  4082. one_argument(argument, arg1, sizeof(arg1));
  4083. str_to_number(mode, arg1);
  4084.  
  4085. if (mode == 1)
  4086. {
  4087. xmas::SpawnEventHelper(true);
  4088. ch->ChatPacket(CHAT_TYPE_INFO, "Event Helper Spawn");
  4089. }
  4090. else
  4091. {
  4092. xmas::SpawnEventHelper(false);
  4093. ch->ChatPacket(CHAT_TYPE_INFO, "Event Helper Delete");
  4094. }
  4095. }
  4096.  
  4097. struct FMobCounter
  4098. {
  4099. int nCount;
  4100.  
  4101. void operator () (LPENTITY ent)
  4102. {
  4103. if (ent->IsType(ENTITY_CHARACTER))
  4104. {
  4105. LPCHARACTER pChar = static_cast<LPCHARACTER>(ent);
  4106.  
  4107. if (pChar->IsMonster() == true || pChar->IsStone())
  4108. {
  4109. nCount++;
  4110. }
  4111. }
  4112. }
  4113. };
  4114.  
  4115. ACMD(do_get_mob_count)
  4116. {
  4117. LPSECTREE_MAP pSectree = SECTREE_MANAGER::instance().GetMap(ch->GetMapIndex());
  4118.  
  4119. if (pSectree == NULL)
  4120. return;
  4121.  
  4122. FMobCounter f;
  4123. f.nCount = 0;
  4124.  
  4125. pSectree->for_each(f);
  4126.  
  4127. ch->ChatPacket(CHAT_TYPE_INFO, "MapIndex: %d MobCount %d", ch->GetMapIndex(), f.nCount);
  4128. }
  4129.  
  4130. ACMD(do_clear_land)
  4131. {
  4132. const building::CLand* pLand = building::CManager::instance().FindLand(ch->GetMapIndex(), ch->GetX(), ch->GetY());
  4133.  
  4134. if( NULL == pLand )
  4135. {
  4136. return;
  4137. }
  4138.  
  4139. ch->ChatPacket(CHAT_TYPE_INFO, "Guild Land(%d) Cleared", pLand->GetID());
  4140.  
  4141. building::CManager::instance().ClearLand(pLand->GetID());
  4142. }
  4143.  
  4144. ACMD(do_special_item)
  4145. {
  4146. ITEM_MANAGER::instance().ConvSpecialDropItemFile();
  4147. }
  4148.  
  4149. ACMD(do_set_stat)
  4150. {
  4151. char szName [256];
  4152. char szChangeAmount[256];
  4153.  
  4154. two_arguments (argument, szName, sizeof (szName), szChangeAmount, sizeof(szChangeAmount));
  4155.  
  4156. if (*szName == NULL || *szChangeAmount == '\0')
  4157. {
  4158. ch->ChatPacket (CHAT_TYPE_INFO, "Invalid argument.");
  4159. return;
  4160. }
  4161.  
  4162. LPCHARACTER tch = CHARACTER_MANAGER::instance().FindPC(szName);
  4163.  
  4164. if (!tch)
  4165. {
  4166. CCI * pkCCI = P2P_MANAGER::instance().Find(szName);
  4167.  
  4168. if (pkCCI)
  4169. {
  4170. ch->ChatPacket (CHAT_TYPE_INFO, "Cannot find player(%s). %s is not in your game server.", szName, szName);
  4171. return;
  4172. }
  4173. else
  4174. {
  4175. ch->ChatPacket (CHAT_TYPE_INFO, "Cannot find player(%s). Perhaps %s doesn't login or exist.", szName, szName);
  4176. return;
  4177. }
  4178. }
  4179. else
  4180. {
  4181. if (tch->IsPolymorphed())
  4182. {
  4183. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("둔갑 중에는 능력을 올릴 수 없습니다."));
  4184. return;
  4185. }
  4186.  
  4187. if (subcmd != POINT_HT && subcmd != POINT_IQ && subcmd != POINT_ST && subcmd != POINT_DX)
  4188. {
  4189. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("명령어의 서브 커맨드가 잘못 되었습니다."));
  4190. return;
  4191. }
  4192. int nRemainPoint = tch->GetPoint(POINT_STAT);
  4193. int nCurPoint = tch->GetRealPoint(subcmd);
  4194. int nChangeAmount = 0;
  4195. str_to_number(nChangeAmount, szChangeAmount);
  4196. int nPoint = nCurPoint + nChangeAmount;
  4197.  
  4198. int n;
  4199. switch (subcmd)
  4200. {
  4201. case POINT_HT:
  4202. if (nPoint < JobInitialPoints[tch->GetJob()].ht)
  4203. {
  4204. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Cannot set stat under initial stat."));
  4205. return;
  4206. }
  4207. n = 0;
  4208. break;
  4209. case POINT_IQ:
  4210. if (nPoint < JobInitialPoints[tch->GetJob()].iq)
  4211. {
  4212. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Cannot set stat under initial stat."));
  4213. return;
  4214. }
  4215. n = 1;
  4216. break;
  4217. case POINT_ST:
  4218. if (nPoint < JobInitialPoints[tch->GetJob()].st)
  4219. {
  4220. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Cannot set stat under initial stat."));
  4221. return;
  4222. }
  4223. n = 2;
  4224. break;
  4225. case POINT_DX:
  4226. if (nPoint < JobInitialPoints[tch->GetJob()].dx)
  4227. {
  4228. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Cannot set stat under initial stat."));
  4229. return;
  4230. }
  4231. n = 3;
  4232. break;
  4233. }
  4234.  
  4235. if (nPoint > 90)
  4236. {
  4237. nChangeAmount -= nPoint - 90;
  4238. nPoint = 90;
  4239. }
  4240.  
  4241. if (nRemainPoint < nChangeAmount)
  4242. {
  4243. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("남은 스탯 포인트가 적습니다."));
  4244. return;
  4245. }
  4246.  
  4247. tch->SetRealPoint(subcmd, nPoint);
  4248. tch->SetPoint(subcmd, tch->GetPoint(subcmd) + nChangeAmount);
  4249. tch->ComputePoints();
  4250. tch->PointChange(subcmd, 0);
  4251.  
  4252. tch->PointChange(POINT_STAT, -nChangeAmount);
  4253. tch->ComputePoints();
  4254.  
  4255. const char* stat_name[4] = {"con", "int", "str", "dex"};
  4256.  
  4257. ch->ChatPacket(CHAT_TYPE_INFO, "%s's %s change %d to %d", szName, stat_name[n], nCurPoint, nPoint);
  4258. }
  4259. }
  4260.  
  4261. ACMD(do_get_item_id_list)
  4262. {
  4263. for (int i = 0; i < INVENTORY_AND_EQUIP_SLOT_MAX; i++)
  4264. {
  4265. LPITEM item = ch->GetInventoryItem(i);
  4266. if (item != NULL)
  4267. ch->ChatPacket(CHAT_TYPE_INFO, "cell : %d, name : %s, id : %d", item->GetCell(), item->GetName(), item->GetID());
  4268. }
  4269. }
  4270.  
  4271. ACMD(do_set_socket)
  4272. {
  4273. char arg1 [256];
  4274. char arg2 [256];
  4275. char arg3 [256];
  4276.  
  4277. one_argument (two_arguments (argument, arg1, sizeof (arg1), arg2, sizeof(arg2)), arg3, sizeof (arg3));
  4278.  
  4279. int item_id, socket_num, value;
  4280. if (!str_to_number (item_id, arg1) || !str_to_number (socket_num, arg2) || !str_to_number (value, arg3))
  4281. return;
  4282.  
  4283. LPITEM item = ITEM_MANAGER::instance().Find (item_id);
  4284. if (item)
  4285. item->SetSocket (socket_num, value);
  4286. }
  4287.  
  4288. ACMD (do_can_dead)
  4289. {
  4290. if (subcmd)
  4291. ch->SetArmada();
  4292. else
  4293. ch->ResetArmada();
  4294. }
  4295.  
  4296. ACMD (do_full_set)
  4297. {
  4298. extern void do_all_skill_master(LPCHARACTER ch, const char *argument, int cmd, int subcmd);
  4299. do_all_skill_master(ch, NULL, 0, 0);
  4300. extern void do_item_full_set(LPCHARACTER ch, const char *argument, int cmd, int subcmd);
  4301. do_item_full_set(ch, NULL, 0, 0);
  4302. extern void do_attr_full_set(LPCHARACTER ch, const char *argument, int cmd, int subcmd);
  4303. do_attr_full_set(ch, NULL, 0, 0);
  4304.  
  4305. }
  4306.  
  4307. ACMD (do_all_skill_master)
  4308. {
  4309. ch->SetHorseLevel(SKILL_MAX_LEVEL);
  4310. for (int i = 0; i < SKILL_MAX_NUM; i++)
  4311. {
  4312. if (true == ch->CanUseSkill(i))
  4313. {
  4314. ch->SetSkillLevel(i, SKILL_MAX_LEVEL);
  4315. }
  4316. else
  4317. {
  4318. switch(i)
  4319. {
  4320. case SKILL_HORSE_WILDATTACK:
  4321. case SKILL_HORSE_CHARGE:
  4322. case SKILL_HORSE_ESCAPE:
  4323. case SKILL_HORSE_WILDATTACK_RANGE:
  4324. ch->SetSkillLevel(i, SKILL_MAX_LEVEL);
  4325. break;
  4326. }
  4327. }
  4328. }
  4329. ch->ComputePoints();
  4330. ch->SkillLevelPacket();
  4331. }
  4332.  
  4333. ACMD (do_item_full_set)
  4334. {
  4335. BYTE job = ch->GetJob();
  4336. LPITEM item;
  4337. for (int i = 0; i < 6; i++)
  4338. {
  4339. item = ch->GetWear(i);
  4340. if (item != NULL)
  4341. ch->UnequipItem(item);
  4342. }
  4343.  
  4344. item = ch->GetWear(WEAR_SHIELD);
  4345. if (item != NULL)
  4346. ch->UnequipItem(item);
  4347.  
  4348. switch (job)
  4349. {
  4350. case JOB_WARRIOR:
  4351. {
  4352. item = ITEM_MANAGER::instance().CreateItem(11299);
  4353. if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))
  4354. M2_DESTROY_ITEM(item);
  4355. item = ITEM_MANAGER::instance().CreateItem(13049);
  4356. if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))
  4357. M2_DESTROY_ITEM(item);
  4358. item = ITEM_MANAGER::instance().CreateItem(15189);
  4359. if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))
  4360. M2_DESTROY_ITEM(item);
  4361. item = ITEM_MANAGER::instance().CreateItem(3159);
  4362. if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))
  4363. M2_DESTROY_ITEM(item);
  4364. item = ITEM_MANAGER::instance().CreateItem(12249);
  4365. if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))
  4366. M2_DESTROY_ITEM(item);
  4367. item = ITEM_MANAGER::instance().CreateItem(14109);
  4368. if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))
  4369. M2_DESTROY_ITEM(item);
  4370. item = ITEM_MANAGER::instance().CreateItem(17109);
  4371. if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))
  4372. M2_DESTROY_ITEM(item);
  4373. item = ITEM_MANAGER::instance().CreateItem(16109);
  4374. if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))
  4375. M2_DESTROY_ITEM(item);
  4376. }
  4377. break;
  4378.  
  4379. case JOB_ASSASSIN:
  4380. {
  4381. item = ITEM_MANAGER::instance().CreateItem(11499);
  4382. if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))
  4383. M2_DESTROY_ITEM(item);
  4384. item = ITEM_MANAGER::instance().CreateItem(13049);
  4385. if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))
  4386. M2_DESTROY_ITEM(item);
  4387. item = ITEM_MANAGER::instance().CreateItem(15189);
  4388. if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))
  4389. M2_DESTROY_ITEM(item);
  4390. item = ITEM_MANAGER::instance().CreateItem(1139);
  4391. if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))
  4392. M2_DESTROY_ITEM(item);
  4393. item = ITEM_MANAGER::instance().CreateItem(12389);
  4394. if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))
  4395. M2_DESTROY_ITEM(item);
  4396. item = ITEM_MANAGER::instance().CreateItem(14109);
  4397. if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))
  4398. M2_DESTROY_ITEM(item);
  4399. item = ITEM_MANAGER::instance().CreateItem(17189);
  4400. if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))
  4401. M2_DESTROY_ITEM(item);
  4402. item = ITEM_MANAGER::instance().CreateItem(16189);
  4403. if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))
  4404. M2_DESTROY_ITEM(item);
  4405. }
  4406. break;
  4407.  
  4408. case JOB_SURA:
  4409. {
  4410. item = ITEM_MANAGER::instance().CreateItem(11699);
  4411. if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))
  4412. M2_DESTROY_ITEM(item);
  4413. item = ITEM_MANAGER::instance().CreateItem(13049);
  4414. if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))
  4415. M2_DESTROY_ITEM(item);
  4416. item = ITEM_MANAGER::instance().CreateItem(15189);
  4417. if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))
  4418. M2_DESTROY_ITEM(item);
  4419. item = ITEM_MANAGER::instance().CreateItem(189);
  4420. if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))
  4421. M2_DESTROY_ITEM(item);
  4422. item = ITEM_MANAGER::instance().CreateItem(12529);
  4423. if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))
  4424. M2_DESTROY_ITEM(item);
  4425. item = ITEM_MANAGER::instance().CreateItem(14109);
  4426. if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))
  4427. M2_DESTROY_ITEM(item);
  4428. item = ITEM_MANAGER::instance().CreateItem(17209);
  4429. if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))
  4430. M2_DESTROY_ITEM(item);
  4431. item = ITEM_MANAGER::instance().CreateItem(16209);
  4432. if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))
  4433. M2_DESTROY_ITEM(item);
  4434. }
  4435. break;
  4436.  
  4437. case JOB_SHAMAN:
  4438. {
  4439. item = ITEM_MANAGER::instance().CreateItem(11899);
  4440. if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))
  4441. M2_DESTROY_ITEM(item);
  4442. item = ITEM_MANAGER::instance().CreateItem(13049);
  4443. if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))
  4444. M2_DESTROY_ITEM(item);
  4445. item = ITEM_MANAGER::instance().CreateItem(15189);
  4446. if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))
  4447. M2_DESTROY_ITEM(item);
  4448. item = ITEM_MANAGER::instance().CreateItem(7159);
  4449. if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))
  4450. M2_DESTROY_ITEM(item);
  4451. item = ITEM_MANAGER::instance().CreateItem(12669);
  4452. if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))
  4453. M2_DESTROY_ITEM(item);
  4454. item = ITEM_MANAGER::instance().CreateItem(14109);
  4455. if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))
  4456. M2_DESTROY_ITEM(item);
  4457. item = ITEM_MANAGER::instance().CreateItem(17209);
  4458. if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))
  4459. M2_DESTROY_ITEM(item);
  4460. item = ITEM_MANAGER::instance().CreateItem(16209);
  4461. if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))
  4462. M2_DESTROY_ITEM(item);
  4463. }
  4464. break;
  4465.  
  4466. case JOB_WOLFMAN:
  4467. {
  4468. item = ITEM_MANAGER::instance().CreateItem(21079);
  4469. if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))
  4470. M2_DESTROY_ITEM(item);
  4471. item = ITEM_MANAGER::instance().CreateItem(13049);
  4472. if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))
  4473. M2_DESTROY_ITEM(item);
  4474. item = ITEM_MANAGER::instance().CreateItem(15189);
  4475. if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))
  4476. M2_DESTROY_ITEM(item);
  4477. item = ITEM_MANAGER::instance().CreateItem(6069);
  4478. if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))
  4479. M2_DESTROY_ITEM(item);
  4480. item = ITEM_MANAGER::instance().CreateItem(21529);
  4481. if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))
  4482. M2_DESTROY_ITEM(item);
  4483. item = ITEM_MANAGER::instance().CreateItem(14109);
  4484. if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))
  4485. M2_DESTROY_ITEM(item);
  4486. item = ITEM_MANAGER::instance().CreateItem(17109);
  4487. if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))
  4488. M2_DESTROY_ITEM(item);
  4489. item = ITEM_MANAGER::instance().CreateItem(16109);
  4490. if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))
  4491. M2_DESTROY_ITEM(item);
  4492. }
  4493. break;
  4494. }
  4495. }
  4496.  
  4497. ACMD (do_attr_full_set)
  4498. {
  4499. BYTE job = ch->GetJob();
  4500. LPITEM item;
  4501.  
  4502. switch (job)
  4503. {
  4504. case JOB_WARRIOR:
  4505. {
  4506. item = ch->GetWear(WEAR_WEAPON);
  4507. if (item != NULL)
  4508. {
  4509. item->ClearAttribute();
  4510. item->SetForceAttribute(0, APPLY_CAST_SPEED, 20);
  4511. item->SetForceAttribute(1, APPLY_CRITICAL_PCT, 10);
  4512. item->SetForceAttribute(2, APPLY_PENETRATE_PCT, 10);
  4513. item->SetForceAttribute(3, APPLY_ATTBONUS_DEVIL, 20);
  4514. item->SetForceAttribute(4, APPLY_STR, 12);
  4515. }
  4516.  
  4517. item = ch->GetWear(WEAR_HEAD);
  4518. if (item != NULL)
  4519. {
  4520. item->ClearAttribute();
  4521. item->SetForceAttribute(0, APPLY_ATT_SPEED, 8);
  4522. item->SetForceAttribute(1, APPLY_HP_REGEN, 30);
  4523. item->SetForceAttribute(2, APPLY_SP_REGEN, 30);
  4524. item->SetForceAttribute(3, APPLY_DODGE, 15);
  4525. item->SetForceAttribute(4, APPLY_STEAL_SP, 10);
  4526. }
  4527.  
  4528. item = ch->GetWear(WEAR_SHIELD);
  4529. if (item != NULL)
  4530. {
  4531. item->ClearAttribute();
  4532. item->SetForceAttribute(0, APPLY_CON, 12);
  4533. item->SetForceAttribute(1, APPLY_BLOCK, 15);
  4534. item->SetForceAttribute(2, APPLY_REFLECT_MELEE, 10);
  4535. item->SetForceAttribute(3, APPLY_IMMUNE_STUN, 1);
  4536. item->SetForceAttribute(4, APPLY_IMMUNE_SLOW, 1);
  4537. }
  4538.  
  4539. item = ch->GetWear(WEAR_BODY);
  4540. if (item != NULL)
  4541. {
  4542. item->ClearAttribute();
  4543. item->SetForceAttribute(0, APPLY_MAX_HP, 2000);
  4544. item->SetForceAttribute(1, APPLY_CAST_SPEED, 20);
  4545. item->SetForceAttribute(2, APPLY_STEAL_HP, 10);
  4546. item->SetForceAttribute(3, APPLY_REFLECT_MELEE, 10);
  4547. item->SetForceAttribute(4, APPLY_ATT_GRADE_BONUS, 50);
  4548. }
  4549.  
  4550. item = ch->GetWear(WEAR_FOOTS);
  4551. if (item != NULL)
  4552. {
  4553. item->ClearAttribute();
  4554. item->SetForceAttribute(0, APPLY_MAX_HP, 2000);
  4555. item->SetForceAttribute(1, APPLY_MAX_SP, 80);
  4556. item->SetForceAttribute(2, APPLY_MOV_SPEED, 8);
  4557. item->SetForceAttribute(3, APPLY_ATT_SPEED, 8);
  4558. item->SetForceAttribute(4, APPLY_CRITICAL_PCT, 10);
  4559. }
  4560.  
  4561. item = ch->GetWear(WEAR_WRIST);
  4562. if (item != NULL)
  4563. {
  4564. item->ClearAttribute();
  4565. item->SetForceAttribute(0, APPLY_MAX_HP, 2000);
  4566. item->SetForceAttribute(1, APPLY_MAX_SP, 80);
  4567. item->SetForceAttribute(2, APPLY_PENETRATE_PCT, 10);
  4568. item->SetForceAttribute(3, APPLY_STEAL_HP, 10);
  4569. item->SetForceAttribute(4, APPLY_MANA_BURN_PCT, 10);
  4570. }
  4571.  
  4572. item = ch->GetWear(WEAR_NECK);
  4573. if (item != NULL)
  4574. {
  4575. item->ClearAttribute();
  4576. item->SetForceAttribute(0, APPLY_MAX_HP, 2000);
  4577. item->SetForceAttribute(1, APPLY_MAX_SP, 80);
  4578. item->SetForceAttribute(2, APPLY_CRITICAL_PCT, 10);
  4579. item->SetForceAttribute(3, APPLY_PENETRATE_PCT, 10);
  4580. item->SetForceAttribute(4, APPLY_STEAL_SP, 10);
  4581. }
  4582.  
  4583. item = ch->GetWear(WEAR_EAR);
  4584. if (item != NULL)
  4585. {
  4586. item->ClearAttribute();
  4587. item->SetForceAttribute(0, APPLY_MOV_SPEED, 20);
  4588. item->SetForceAttribute(1, APPLY_MANA_BURN_PCT, 10);
  4589. item->SetForceAttribute(2, APPLY_POISON_REDUCE, 5);
  4590. item->SetForceAttribute(3, APPLY_ATTBONUS_DEVIL, 20);
  4591. item->SetForceAttribute(4, APPLY_ATTBONUS_UNDEAD, 20);
  4592. }
  4593. }
  4594. break;
  4595.  
  4596. case JOB_ASSASSIN:
  4597. {
  4598. item = ch->GetWear(WEAR_WEAPON);
  4599. if (item != NULL)
  4600. {
  4601. item->ClearAttribute();
  4602. item->SetForceAttribute(0, APPLY_CAST_SPEED, 20);
  4603. item->SetForceAttribute(1, APPLY_CRITICAL_PCT, 10);
  4604. item->SetForceAttribute(2, APPLY_PENETRATE_PCT, 10);
  4605. item->SetForceAttribute(3, APPLY_ATTBONUS_DEVIL, 20);
  4606. item->SetForceAttribute(4, APPLY_DEX, 12);
  4607. }
  4608.  
  4609. item = ch->GetWear(WEAR_HEAD);
  4610. if (item != NULL)
  4611. {
  4612. item->ClearAttribute();
  4613. item->SetForceAttribute(0, APPLY_ATT_SPEED, 8);
  4614. item->SetForceAttribute(1, APPLY_HP_REGEN, 30);
  4615. item->SetForceAttribute(2, APPLY_SP_REGEN, 30);
  4616. item->SetForceAttribute(3, APPLY_DODGE, 15);
  4617. item->SetForceAttribute(4, APPLY_STEAL_SP, 10);
  4618. }
  4619.  
  4620. item = ch->GetWear(WEAR_SHIELD);
  4621. if (item != NULL)
  4622. {
  4623. item->ClearAttribute();
  4624. item->SetForceAttribute(0, APPLY_CON, 12);
  4625. item->SetForceAttribute(1, APPLY_BLOCK, 15);
  4626. item->SetForceAttribute(2, APPLY_REFLECT_MELEE, 10);
  4627. item->SetForceAttribute(3, APPLY_IMMUNE_STUN, 1);
  4628. item->SetForceAttribute(4, APPLY_IMMUNE_SLOW, 1);
  4629. }
  4630.  
  4631. item = ch->GetWear(WEAR_BODY);
  4632. if (item != NULL)
  4633. {
  4634. item->ClearAttribute();
  4635. item->SetForceAttribute(0, APPLY_MAX_HP, 2000);
  4636. item->SetForceAttribute(1, APPLY_CAST_SPEED, 20);
  4637. item->SetForceAttribute(2, APPLY_STEAL_HP, 10);
  4638. item->SetForceAttribute(3, APPLY_REFLECT_MELEE, 10);
  4639. item->SetForceAttribute(4, APPLY_ATT_GRADE_BONUS, 50);
  4640. }
  4641.  
  4642. item = ch->GetWear(WEAR_FOOTS);
  4643. if (item != NULL)
  4644. {
  4645. item->ClearAttribute();
  4646. item->SetForceAttribute(0, APPLY_MAX_HP, 2000);
  4647. item->SetForceAttribute(1, APPLY_MAX_SP, 80);
  4648. item->SetForceAttribute(2, APPLY_MOV_SPEED, 8);
  4649. item->SetForceAttribute(3, APPLY_ATT_SPEED, 8);
  4650. item->SetForceAttribute(4, APPLY_CRITICAL_PCT, 10);
  4651. }
  4652.  
  4653. item = ch->GetWear(WEAR_WRIST);
  4654. if (item != NULL)
  4655. {
  4656. item->ClearAttribute();
  4657. item->SetForceAttribute(0, APPLY_MAX_HP, 2000);
  4658. item->SetForceAttribute(1, APPLY_MAX_SP, 80);
  4659. item->SetForceAttribute(2, APPLY_PENETRATE_PCT, 10);
  4660. item->SetForceAttribute(3, APPLY_STEAL_HP, 10);
  4661. item->SetForceAttribute(4, APPLY_MANA_BURN_PCT, 10);
  4662. }
  4663.  
  4664. item = ch->GetWear(WEAR_NECK);
  4665. if (item != NULL)
  4666. {
  4667. item->ClearAttribute();
  4668. item->SetForceAttribute(0, APPLY_MAX_HP, 2000);
  4669. item->SetForceAttribute(1, APPLY_MAX_SP, 80);
  4670. item->SetForceAttribute(2, APPLY_CRITICAL_PCT, 10);
  4671. item->SetForceAttribute(3, APPLY_PENETRATE_PCT, 10);
  4672. item->SetForceAttribute(4, APPLY_STEAL_SP, 10);
  4673. }
  4674.  
  4675. item = ch->GetWear(WEAR_EAR);
  4676. if (item != NULL)
  4677. {
  4678. item->ClearAttribute();
  4679. item->SetForceAttribute(0, APPLY_MOV_SPEED, 20);
  4680. item->SetForceAttribute(1, APPLY_MANA_BURN_PCT, 10);
  4681. item->SetForceAttribute(2, APPLY_POISON_REDUCE, 5);
  4682. item->SetForceAttribute(3, APPLY_ATTBONUS_DEVIL, 20);
  4683. item->SetForceAttribute(4, APPLY_ATTBONUS_UNDEAD, 20);
  4684. }
  4685. }
  4686. break;
  4687.  
  4688. case JOB_SURA:
  4689. {
  4690. item = ch->GetWear(WEAR_WEAPON);
  4691. if (item != NULL)
  4692. {
  4693. item->ClearAttribute();
  4694. item->SetForceAttribute(0, APPLY_CAST_SPEED, 20);
  4695. item->SetForceAttribute(1, APPLY_CRITICAL_PCT, 10);
  4696. item->SetForceAttribute(2, APPLY_PENETRATE_PCT, 10);
  4697. item->SetForceAttribute(3, APPLY_ATTBONUS_DEVIL, 20);
  4698. item->SetForceAttribute(4, APPLY_INT, 12);
  4699. }
  4700.  
  4701. item = ch->GetWear(WEAR_HEAD);
  4702. if (item != NULL)
  4703. {
  4704. item->ClearAttribute();
  4705. item->SetForceAttribute(0, APPLY_ATT_SPEED, 8);
  4706. item->SetForceAttribute(1, APPLY_HP_REGEN, 30);
  4707. item->SetForceAttribute(2, APPLY_SP_REGEN, 30);
  4708. item->SetForceAttribute(3, APPLY_DODGE, 15);
  4709. item->SetForceAttribute(4, APPLY_STEAL_SP, 10);
  4710. }
  4711.  
  4712. item = ch->GetWear(WEAR_SHIELD);
  4713. if (item != NULL)
  4714. {
  4715. item->ClearAttribute();
  4716. item->SetForceAttribute(0, APPLY_CON, 12);
  4717. item->SetForceAttribute(1, APPLY_BLOCK, 15);
  4718. item->SetForceAttribute(2, APPLY_REFLECT_MELEE, 10);
  4719. item->SetForceAttribute(3, APPLY_IMMUNE_STUN, 1);
  4720. item->SetForceAttribute(4, APPLY_IMMUNE_SLOW, 1);
  4721. }
  4722.  
  4723. item = ch->GetWear(WEAR_BODY);
  4724. if (item != NULL)
  4725. {
  4726. item->ClearAttribute();
  4727. item->SetForceAttribute(0, APPLY_MAX_HP, 2000);
  4728. item->SetForceAttribute(1, APPLY_CAST_SPEED, 20);
  4729. item->SetForceAttribute(2, APPLY_STEAL_HP, 10);
  4730. item->SetForceAttribute(3, APPLY_REFLECT_MELEE, 10);
  4731. item->SetForceAttribute(4, APPLY_ATT_GRADE_BONUS, 50);
  4732. }
  4733.  
  4734. item = ch->GetWear(WEAR_FOOTS);
  4735. if (item != NULL)
  4736. {
  4737. item->ClearAttribute();
  4738. item->SetForceAttribute(0, APPLY_MAX_HP, 2000);
  4739. item->SetForceAttribute(1, APPLY_MAX_SP, 80);
  4740. item->SetForceAttribute(2, APPLY_MOV_SPEED, 8);
  4741. item->SetForceAttribute(3, APPLY_ATT_SPEED, 8);
  4742. item->SetForceAttribute(4, APPLY_CRITICAL_PCT, 10);
  4743. }
  4744.  
  4745. item = ch->GetWear(WEAR_WRIST);
  4746. if (item != NULL)
  4747. {
  4748. item->ClearAttribute();
  4749. item->SetForceAttribute(0, APPLY_MAX_HP, 2000);
  4750. item->SetForceAttribute(1, APPLY_MAX_SP, 80);
  4751. item->SetForceAttribute(2, APPLY_PENETRATE_PCT, 10);
  4752. item->SetForceAttribute(3, APPLY_STEAL_HP, 10);
  4753. item->SetForceAttribute(4, APPLY_MANA_BURN_PCT, 10);
  4754. }
  4755.  
  4756. item = ch->GetWear(WEAR_NECK);
  4757. if (item != NULL)
  4758. {
  4759. item->ClearAttribute();
  4760. item->SetForceAttribute(0, APPLY_MAX_HP, 2000);
  4761. item->SetForceAttribute(1, APPLY_MAX_SP, 80);
  4762. item->SetForceAttribute(2, APPLY_CRITICAL_PCT, 10);
  4763. item->SetForceAttribute(3, APPLY_PENETRATE_PCT, 10);
  4764. item->SetForceAttribute(4, APPLY_STEAL_SP, 10);
  4765. }
  4766.  
  4767. item = ch->GetWear(WEAR_EAR);
  4768. if (item != NULL)
  4769. {
  4770. item->ClearAttribute();
  4771. item->SetForceAttribute(0, APPLY_MOV_SPEED, 20);
  4772. item->SetForceAttribute(1, APPLY_MANA_BURN_PCT, 10);
  4773. item->SetForceAttribute(2, APPLY_POISON_REDUCE, 5);
  4774. item->SetForceAttribute(3, APPLY_ATTBONUS_DEVIL, 20);
  4775. item->SetForceAttribute(4, APPLY_ATTBONUS_UNDEAD, 20);
  4776. }
  4777. }
  4778. break;
  4779.  
  4780. case JOB_SHAMAN:
  4781. {
  4782. item = ch->GetWear(WEAR_WEAPON);
  4783. if (item != NULL)
  4784. {
  4785. item->ClearAttribute();
  4786. item->SetForceAttribute(0, APPLY_CAST_SPEED, 20);
  4787. item->SetForceAttribute(1, APPLY_CRITICAL_PCT, 10);
  4788. item->SetForceAttribute(2, APPLY_PENETRATE_PCT, 10);
  4789. item->SetForceAttribute(3, APPLY_ATTBONUS_DEVIL, 20);
  4790. item->SetForceAttribute(4, APPLY_INT, 12);
  4791. }
  4792.  
  4793. item = ch->GetWear(WEAR_HEAD);
  4794. if (item != NULL)
  4795. {
  4796. item->ClearAttribute();
  4797. item->SetForceAttribute(0, APPLY_ATT_SPEED, 8);
  4798. item->SetForceAttribute(1, APPLY_HP_REGEN, 30);
  4799. item->SetForceAttribute(2, APPLY_SP_REGEN, 30);
  4800. item->SetForceAttribute(3, APPLY_DODGE, 15);
  4801. item->SetForceAttribute(4, APPLY_STEAL_SP, 10);
  4802. }
  4803.  
  4804. item = ch->GetWear(WEAR_SHIELD);
  4805. if (item != NULL)
  4806. {
  4807. item->ClearAttribute();
  4808. item->SetForceAttribute(0, APPLY_CON, 12);
  4809. item->SetForceAttribute(1, APPLY_BLOCK, 15);
  4810. item->SetForceAttribute(2, APPLY_REFLECT_MELEE, 10);
  4811. item->SetForceAttribute(3, APPLY_IMMUNE_STUN, 1);
  4812. item->SetForceAttribute(4, APPLY_IMMUNE_SLOW, 1);
  4813. }
  4814.  
  4815. item = ch->GetWear(WEAR_BODY);
  4816. if (item != NULL)
  4817. {
  4818. item->ClearAttribute();
  4819. item->SetForceAttribute(0, APPLY_MAX_HP, 2000);
  4820. item->SetForceAttribute(1, APPLY_CAST_SPEED, 20);
  4821. item->SetForceAttribute(2, APPLY_STEAL_HP, 10);
  4822. item->SetForceAttribute(3, APPLY_REFLECT_MELEE, 10);
  4823. item->SetForceAttribute(4, APPLY_ATT_GRADE_BONUS, 50);
  4824. }
  4825.  
  4826. item = ch->GetWear(WEAR_FOOTS);
  4827. if (item != NULL)
  4828. {
  4829. item->ClearAttribute();
  4830. item->SetForceAttribute(0, APPLY_MAX_HP, 2000);
  4831. item->SetForceAttribute(1, APPLY_MAX_SP, 80);
  4832. item->SetForceAttribute(2, APPLY_MOV_SPEED, 8);
  4833. item->SetForceAttribute(3, APPLY_ATT_SPEED, 8);
  4834. item->SetForceAttribute(4, APPLY_CRITICAL_PCT, 10);
  4835. }
  4836.  
  4837. item = ch->GetWear(WEAR_WRIST);
  4838. if (item != NULL)
  4839. {
  4840. item->ClearAttribute();
  4841. item->SetForceAttribute(0, APPLY_MAX_HP, 2000);
  4842. item->SetForceAttribute(1, APPLY_MAX_SP, 80);
  4843. item->SetForceAttribute(2, APPLY_PENETRATE_PCT, 10);
  4844. item->SetForceAttribute(3, APPLY_STEAL_HP, 10);
  4845. item->SetForceAttribute(4, APPLY_MANA_BURN_PCT, 10);
  4846. }
  4847.  
  4848. item = ch->GetWear(WEAR_NECK);
  4849. if (item != NULL)
  4850. {
  4851. item->ClearAttribute();
  4852. item->SetForceAttribute(0, APPLY_MAX_HP, 2000);
  4853. item->SetForceAttribute(1, APPLY_MAX_SP, 80);
  4854. item->SetForceAttribute(2, APPLY_CRITICAL_PCT, 10);
  4855. item->SetForceAttribute(3, APPLY_PENETRATE_PCT, 10);
  4856. item->SetForceAttribute(4, APPLY_STEAL_SP, 10);
  4857. }
  4858.  
  4859. item = ch->GetWear(WEAR_EAR);
  4860. if (item != NULL)
  4861. {
  4862. item->ClearAttribute();
  4863. item->SetForceAttribute(0, APPLY_MOV_SPEED, 20);
  4864. item->SetForceAttribute(1, APPLY_MANA_BURN_PCT, 10);
  4865. item->SetForceAttribute(2, APPLY_POISON_REDUCE, 5);
  4866. item->SetForceAttribute(3, APPLY_ATTBONUS_DEVIL, 20);
  4867. item->SetForceAttribute(4, APPLY_ATTBONUS_UNDEAD, 20);
  4868. }
  4869. }
  4870. break;
  4871.  
  4872. case JOB_WOLFMAN:
  4873. {
  4874. item = ch->GetWear(WEAR_WEAPON);
  4875. if (item != NULL)
  4876. {
  4877. item->ClearAttribute();
  4878. item->SetForceAttribute(0, APPLY_CAST_SPEED, 20);
  4879. item->SetForceAttribute(1, APPLY_CRITICAL_PCT, 10);
  4880. item->SetForceAttribute(2, APPLY_PENETRATE_PCT, 10);
  4881. item->SetForceAttribute(3, APPLY_ATTBONUS_DEVIL, 20);
  4882. item->SetForceAttribute(4, APPLY_STR, 12);
  4883. }
  4884.  
  4885. item = ch->GetWear(WEAR_HEAD);
  4886. if (item != NULL)
  4887. {
  4888. item->ClearAttribute();
  4889. item->SetForceAttribute(0, APPLY_ATT_SPEED, 8);
  4890. item->SetForceAttribute(1, APPLY_HP_REGEN, 30);
  4891. item->SetForceAttribute(2, APPLY_SP_REGEN, 30);
  4892. item->SetForceAttribute(3, APPLY_DODGE, 15);
  4893. item->SetForceAttribute(4, APPLY_STEAL_SP, 10);
  4894. }
  4895.  
  4896. item = ch->GetWear(WEAR_SHIELD);
  4897. if (item != NULL)
  4898. {
  4899. item->ClearAttribute();
  4900. item->SetForceAttribute(0, APPLY_CON, 12);
  4901. item->SetForceAttribute(1, APPLY_BLOCK, 15);
  4902. item->SetForceAttribute(2, APPLY_REFLECT_MELEE, 10);
  4903. item->SetForceAttribute(3, APPLY_IMMUNE_STUN, 1);
  4904. item->SetForceAttribute(4, APPLY_IMMUNE_SLOW, 1);
  4905. }
  4906.  
  4907. item = ch->GetWear(WEAR_BODY);
  4908. if (item != NULL)
  4909. {
  4910. item->ClearAttribute();
  4911. item->SetForceAttribute(0, APPLY_MAX_HP, 2000);
  4912. item->SetForceAttribute(1, APPLY_CAST_SPEED, 20);
  4913. item->SetForceAttribute(2, APPLY_STEAL_HP, 10);
  4914. item->SetForceAttribute(3, APPLY_REFLECT_MELEE, 10);
  4915. item->SetForceAttribute(4, APPLY_ATT_GRADE_BONUS, 50);
  4916. }
  4917.  
  4918. item = ch->GetWear(WEAR_FOOTS);
  4919. if (item != NULL)
  4920. {
  4921. item->ClearAttribute();
  4922. item->SetForceAttribute(0, APPLY_MAX_HP, 2000);
  4923. item->SetForceAttribute(1, APPLY_MAX_SP, 80);
  4924. item->SetForceAttribute(2, APPLY_MOV_SPEED, 8);
  4925. item->SetForceAttribute(3, APPLY_ATT_SPEED, 8);
  4926. item->SetForceAttribute(4, APPLY_CRITICAL_PCT, 10);
  4927. }
  4928.  
  4929. item = ch->GetWear(WEAR_WRIST);
  4930. if (item != NULL)
  4931. {
  4932. item->ClearAttribute();
  4933. item->SetForceAttribute(0, APPLY_MAX_HP, 2000);
  4934. item->SetForceAttribute(1, APPLY_MAX_SP, 80);
  4935. item->SetForceAttribute(2, APPLY_PENETRATE_PCT, 10);
  4936. item->SetForceAttribute(3, APPLY_STEAL_HP, 10);
  4937. item->SetForceAttribute(4, APPLY_MANA_BURN_PCT, 10);
  4938. }
  4939.  
  4940. item = ch->GetWear(WEAR_NECK);
  4941. if (item != NULL)
  4942. {
  4943. item->ClearAttribute();
  4944. item->SetForceAttribute(0, APPLY_MAX_HP, 2000);
  4945. item->SetForceAttribute(1, APPLY_MAX_SP, 80);
  4946. item->SetForceAttribute(2, APPLY_CRITICAL_PCT, 10);
  4947. item->SetForceAttribute(3, APPLY_PENETRATE_PCT, 10);
  4948. item->SetForceAttribute(4, APPLY_STEAL_SP, 10);
  4949. }
  4950.  
  4951. item = ch->GetWear(WEAR_EAR);
  4952. if (item != NULL)
  4953. {
  4954. item->ClearAttribute();
  4955. item->SetForceAttribute(0, APPLY_MOV_SPEED, 20);
  4956. item->SetForceAttribute(1, APPLY_MANA_BURN_PCT, 10);
  4957. item->SetForceAttribute(2, APPLY_POISON_REDUCE, 5);
  4958. item->SetForceAttribute(3, APPLY_ATTBONUS_DEVIL, 20);
  4959. item->SetForceAttribute(4, APPLY_ATTBONUS_UNDEAD, 20);
  4960. }
  4961. }
  4962. break;
  4963. }
  4964. }
  4965.  
  4966. ACMD (do_use_item)
  4967. {
  4968. char arg1 [256];
  4969.  
  4970. one_argument (argument, arg1, sizeof (arg1));
  4971.  
  4972. int cell;
  4973. str_to_number(cell, arg1);
  4974.  
  4975. LPITEM item = ch->GetInventoryItem(cell);
  4976. if (item)
  4977. {
  4978. ch->UseItem(TItemPos (INVENTORY, cell));
  4979. }
  4980. else
  4981. {
  4982. ch->ChatPacket(CHAT_TYPE_INFO, "아이템이 없어서 착용할 수 없어.");
  4983. }
  4984. }
  4985.  
  4986. ACMD (do_clear_affect)
  4987. {
  4988. ch->ClearAffect(true);
  4989. }
  4990.  
  4991. ACMD (do_dragon_soul)
  4992. {
  4993. char arg1[512];
  4994. const char* rest = one_argument (argument, arg1, sizeof(arg1));
  4995. switch (arg1[0])
  4996. {
  4997. case 'a':
  4998. {
  4999. one_argument (rest, arg1, sizeof(arg1));
  5000. int deck_idx;
  5001. if (str_to_number(deck_idx, arg1) == false)
  5002. {
  5003. return;
  5004. }
  5005. ch->DragonSoul_ActivateDeck(deck_idx);
  5006. }
  5007. break;
  5008. case 'd':
  5009. {
  5010. ch->DragonSoul_DeactivateAll();
  5011. }
  5012. break;
  5013. }
  5014. }
  5015.  
  5016. ACMD (do_ds_list)
  5017. {
  5018. for (int i = 0; i < DRAGON_SOUL_INVENTORY_MAX_NUM; i++)
  5019. {
  5020. TItemPos cell(DRAGON_SOUL_INVENTORY, i);
  5021.  
  5022. LPITEM item = ch->GetItem(cell);
  5023. if (item != NULL)
  5024. ch->ChatPacket(CHAT_TYPE_INFO, "cell : %d, name : %s, id : %d", item->GetCell(), item->GetName(), item->GetID());
  5025. }
  5026. }
  5027.  
  5028. ACMD(do_free_regen)
  5029. {
  5030. ch->ChatPacket(CHAT_TYPE_INFO, "freeing regens on mapindex %ld", ch->GetMapIndex());
  5031. regen_free_map(ch->GetMapIndex());
  5032. ch->ChatPacket(CHAT_TYPE_INFO, "the regens now FREEEE! :)");
  5033. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement