trus7

cmd_general.cpp

Nov 19th, 2020 (edited)
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 129.65 KB | None | 0 0
  1. #include "stdafx.h"
  2. #ifdef __FreeBSD__
  3. #include <md5.h>
  4. #else
  5. #include "../../libthecore/include/xmd5.h"
  6. #endif
  7.  
  8. #include "utils.h"
  9. #include "config.h"
  10. #include "desc_client.h"
  11. #include "desc_manager.h"
  12. #include "char.h"
  13. #include "char_manager.h"
  14. #include "motion.h"
  15. #include "packet.h"
  16. #include "affect.h"
  17. #include "pvp.h"
  18. #include "start_position.h"
  19. #include "party.h"
  20. #include "guild_manager.h"
  21. #include "p2p.h"
  22. #include "dungeon.h"
  23. #include "messenger_manager.h"
  24. #include "war_map.h"
  25. #include "questmanager.h"
  26. #include "item_manager.h"
  27. #include "monarch.h"
  28. #include "mob_manager.h"
  29. #include "dev_log.h"
  30. #include "item.h"
  31. #include "arena.h"
  32. #include "buffer_manager.h"
  33. #include "unique_item.h"
  34. #include "threeway_war.h"
  35. #include "log.h"
  36. #include "../../common/VnumHelper.h"
  37. #ifdef __AUCTION__
  38. #include "auction_manager.h"
  39. #endif
  40. #ifdef __ENABLE_BATTLE_FIELD__
  41. #include "battle_zone.h"
  42. #endif
  43. #ifdef ENABLE_MOUNT_COSTUME_SYSTEM
  44. #include "MountSystem.h"
  45. #endif
  46. #ifdef NEW_PET_SYSTEM
  47. #include "New_PetSystem.h"
  48. #endif
  49. #include "SupportSystem.h"
  50. #ifdef __BIOLOG_SYSTEM__
  51. #include "biolog.h"
  52. #endif
  53. #ifdef NEW_PET_SUMMON
  54. #include "PetSystem.h"
  55. #include "New_PetSystem.h"
  56. #endif
  57.  
  58. ACMD(do_user_horse_ride)
  59. {
  60. if (ch->IsObserverMode())
  61. return;
  62.  
  63. if (ch->IsDead() || ch->IsStun())
  64. return;
  65.  
  66. if (ch->IsHorseRiding() == false)
  67. {
  68. // ¸»ÀÌ ¾Æ´Ñ ´Ù¸¥Å»°ÍÀ» Ÿ°íÀÖ´Ù.
  69. if (ch->GetMountVnum())
  70. {
  71. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ÀÌ¹Ì Å»°ÍÀ» ÀÌ¿ëÁßÀÔ´Ï´Ù."));
  72. return;
  73. }
  74.  
  75. if (ch->GetHorse() == NULL)
  76. {
  77. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¸»À» ¸ÕÀú ¼ÒÈ¯ÇØÁÖ¼¼¿ä."));
  78. return;
  79. }
  80.  
  81. ch->StartRiding();
  82. }
  83. else
  84. {
  85. ch->StopRiding();
  86. }
  87. }
  88.  
  89. ACMD(do_user_horse_back)
  90. {
  91. if (ch->GetHorse() != NULL)
  92. {
  93. ch->HorseSummon(false);
  94. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¸»À» µ¹·Áº¸³Â½À´Ï´Ù."));
  95. }
  96. else if (ch->IsHorseRiding() == true)
  97. {
  98. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¸»¿¡¼­ ¸ÕÀú ³»·Á¾ß ÇÕ´Ï´Ù."));
  99. }
  100. else
  101. {
  102. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¸»À» ¸ÕÀú ¼ÒÈ¯ÇØÁÖ¼¼¿ä."));
  103. }
  104. }
  105.  
  106. ACMD(do_user_horse_feed)
  107. {
  108. // °³ÀλóÁ¡À» ¿¬ »óÅ¿¡¼­´Â ¸» ¸ÔÀ̸¦ ÁÙ ¼ö ¾ø´Ù.
  109. if (ch->GetMyShop())
  110. return;
  111.  
  112. if (ch->GetHorse() == NULL)
  113. {
  114. if (ch->IsHorseRiding() == false)
  115. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¸»À» ¸ÕÀú ¼ÒÈ¯ÇØÁÖ¼¼¿ä."));
  116. else
  117. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¸»À» ź »óÅ¿¡¼­´Â ¸ÔÀ̸¦ ÁÙ ¼ö ¾ø½À´Ï´Ù."));
  118. return;
  119. }
  120.  
  121. DWORD dwFood = ch->GetHorseGrade() + 50054 - 1;
  122.  
  123. if (ch->CountSpecifyItem(dwFood) > 0)
  124. {
  125. ch->RemoveSpecifyItem(dwFood, 1);
  126. ch->FeedHorse();
  127. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¸»¿¡°Ô %s%s ÁÖ¾ú½À´Ï´Ù."),
  128. ITEM_MANAGER::instance().GetTable(dwFood)->szLocaleName,
  129. "");
  130. }
  131. else
  132. {
  133. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("%s ¾ÆÀÌÅÛÀÌ ÇÊ¿äÇÕ´Ï´Ù"), ITEM_MANAGER::instance().GetTable(dwFood)->szLocaleName);
  134. }
  135. }
  136.  
  137. #define MAX_REASON_LEN 128
  138.  
  139. EVENTINFO(TimedEventInfo)
  140. {
  141. DynamicCharacterPtr ch;
  142. int subcmd;
  143. int left_second;
  144. char szReason[MAX_REASON_LEN];
  145.  
  146. TimedEventInfo()
  147. : ch()
  148. , subcmd( 0 )
  149. , left_second( 0 )
  150. {
  151. ::memset( szReason, 0, MAX_REASON_LEN );
  152. }
  153. };
  154.  
  155. #ifdef ENABLE_CHANGE_CHANNEL
  156. EVENTINFO(ChangeChannelEventInfo)
  157. {
  158. DynamicCharacterPtr ch;
  159. int channel_number;
  160. int left_second;
  161.  
  162. ChangeChannelEventInfo()
  163. : ch()
  164. , channel_number( 0 )
  165. , left_second( 0 )
  166. {
  167. }
  168. };
  169. #endif
  170.  
  171. struct SendDisconnectFunc
  172. {
  173. void operator () (LPDESC d)
  174. {
  175. if (d->GetCharacter())
  176. {
  177. if (d->GetCharacter()->GetGMLevel() == GM_PLAYER)
  178. d->GetCharacter()->ChatPacket(CHAT_TYPE_COMMAND, "quit Shutdown(SendDisconnectFunc)");
  179. }
  180. }
  181. };
  182.  
  183. struct DisconnectFunc
  184. {
  185. void operator () (LPDESC d)
  186. {
  187. if (d->GetType() == DESC_TYPE_CONNECTOR)
  188. return;
  189.  
  190. if (d->IsPhase(PHASE_P2P))
  191. return;
  192.  
  193. if (d->GetCharacter())
  194. d->GetCharacter()->Disconnect("Shutdown(DisconnectFunc)");
  195.  
  196. d->SetPhase(PHASE_CLOSE);
  197. }
  198. };
  199.  
  200. EVENTINFO(shutdown_event_data)
  201. {
  202. int seconds;
  203.  
  204. shutdown_event_data()
  205. : seconds( 0 )
  206. {
  207. }
  208. };
  209.  
  210. EVENTFUNC(shutdown_event)
  211. {
  212. shutdown_event_data* info = dynamic_cast<shutdown_event_data*>( event->info );
  213.  
  214. if ( info == NULL )
  215. {
  216. sys_err( "shutdown_event> <Factor> Null pointer" );
  217. return 0;
  218. }
  219.  
  220. int * pSec = & (info->seconds);
  221.  
  222. if (*pSec < 0)
  223. {
  224. sys_log(0, "shutdown_event sec %d", *pSec);
  225.  
  226. if (--*pSec == -10)
  227. {
  228. const DESC_MANAGER::DESC_SET & c_set_desc = DESC_MANAGER::instance().GetClientSet();
  229. std::for_each(c_set_desc.begin(), c_set_desc.end(), DisconnectFunc());
  230. return passes_per_sec;
  231. }
  232. else if (*pSec < -10)
  233. return 0;
  234.  
  235. return passes_per_sec;
  236. }
  237. else if (*pSec == 0)
  238. {
  239. const DESC_MANAGER::DESC_SET & c_set_desc = DESC_MANAGER::instance().GetClientSet();
  240. std::for_each(c_set_desc.begin(), c_set_desc.end(), SendDisconnectFunc());
  241. g_bNoMoreClient = true;
  242. --*pSec;
  243. return passes_per_sec;
  244. }
  245. else
  246. {
  247. char buf[64];
  248. snprintf(buf, sizeof(buf), LC_TEXT("¼Ë´Ù¿îÀÌ %dÃÊ ³²¾Ò½À´Ï´Ù."), *pSec);
  249. SendNotice(buf);
  250.  
  251. --*pSec;
  252. return passes_per_sec;
  253. }
  254. }
  255.  
  256. void Shutdown(int iSec)
  257. {
  258. if (g_bNoMoreClient)
  259. {
  260. thecore_shutdown();
  261. return;
  262. }
  263.  
  264. CWarMapManager::instance().OnShutdown();
  265.  
  266. char buf[64];
  267. snprintf(buf, sizeof(buf), LC_TEXT("%dÃÊ ÈÄ °ÔÀÓÀÌ ¼Ë´Ù¿î µË´Ï´Ù."), iSec);
  268.  
  269. SendNotice(buf);
  270.  
  271. shutdown_event_data* info = AllocEventInfo<shutdown_event_data>();
  272. info->seconds = iSec;
  273.  
  274. event_create(shutdown_event, info, 1);
  275. }
  276.  
  277. ACMD(do_shutdown)
  278. {
  279. if (NULL == ch)
  280. {
  281. sys_err("Accept shutdown command from %s.", ch->GetName());
  282. }
  283. TPacketGGShutdown p;
  284. p.bHeader = HEADER_GG_SHUTDOWN;
  285. P2P_MANAGER::instance().Send(&p, sizeof(TPacketGGShutdown));
  286.  
  287. Shutdown(10);
  288. }
  289.  
  290. EVENTFUNC(timed_event)
  291. {
  292. TimedEventInfo * info = dynamic_cast<TimedEventInfo *>( event->info );
  293.  
  294. if ( info == NULL )
  295. {
  296. sys_err( "timed_event> <Factor> Null pointer" );
  297. return 0;
  298. }
  299.  
  300. LPCHARACTER ch = info->ch;
  301. if (ch == NULL) { // <Factor>
  302. return 0;
  303. }
  304. LPDESC d = ch->GetDesc();
  305.  
  306. if (info->left_second <= 0)
  307. {
  308. ch->m_pkTimedEvent = NULL;
  309.  
  310. switch (info->subcmd)
  311. {
  312. case SCMD_LOGOUT:
  313. case SCMD_QUIT:
  314. case SCMD_PHASE_SELECT:
  315. {
  316. TPacketNeedLoginLogInfo acc_info;
  317. acc_info.dwPlayerID = ch->GetDesc()->GetAccountTable().id;
  318.  
  319. db_clientdesc->DBPacket( HEADER_GD_VALID_LOGOUT, 0, &acc_info, sizeof(acc_info) );
  320.  
  321. LogManager::instance().DetailLoginLog( false, ch );
  322. }
  323. break;
  324. }
  325.  
  326. switch (info->subcmd)
  327. {
  328. case SCMD_LOGOUT:
  329. if (d)
  330. d->SetPhase(PHASE_CLOSE);
  331. break;
  332.  
  333. case SCMD_QUIT:
  334. ch->ChatPacket(CHAT_TYPE_COMMAND, "quit");
  335. break;
  336.  
  337. case SCMD_PHASE_SELECT:
  338. {
  339. ch->Disconnect("timed_event - SCMD_PHASE_SELECT");
  340.  
  341. if (d)
  342. {
  343. d->SetPhase(PHASE_SELECT);
  344. }
  345. }
  346. break;
  347. }
  348.  
  349. return 0;
  350. }
  351. else
  352. {
  353. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("%dÃÊ ³²¾Ò½À´Ï´Ù."), info->left_second);
  354. --info->left_second;
  355. }
  356.  
  357. return PASSES_PER_SEC(1);
  358. }
  359.  
  360. #ifdef ENABLE_CHANGE_CHANNEL
  361. EVENTFUNC(change_channel_event)
  362. {
  363. ChangeChannelEventInfo * info = dynamic_cast<ChangeChannelEventInfo *>( event->info );
  364.  
  365. if ( info == NULL )
  366. {
  367. sys_err( "change_channel_event> <Factor> Null pointer" );
  368. return 0;
  369. }
  370.  
  371. LPCHARACTER ch = info->ch;
  372. if (ch == NULL) { // <Factor>
  373. return 0;
  374. }
  375.  
  376. if (info->left_second <= 0)
  377. {
  378. ch->m_pkChangeChannelEvent = NULL;
  379.  
  380. ch->ChangeChannel(info->channel_number);
  381.  
  382. return 0;
  383. }
  384. else
  385. {
  386. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Canalul se schimba in %d secunde."), info->left_second);
  387. --info->left_second;
  388. }
  389.  
  390. return PASSES_PER_SEC(1);
  391. }
  392. #endif
  393.  
  394. ACMD(do_cmd)
  395. {
  396. /* RECALL_DELAY
  397. if (ch->m_pkRecallEvent != NULL)
  398. {
  399. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Ãë¼Ò µÇ¾ú½À´Ï´Ù."));
  400. event_cancel(&ch->m_pkRecallEvent);
  401. return;
  402. }
  403. // END_OF_RECALL_DELAY */
  404.  
  405. if (ch->m_pkTimedEvent)
  406. {
  407. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Ãë¼Ò µÇ¾ú½À´Ï´Ù."));
  408. event_cancel(&ch->m_pkTimedEvent);
  409. return;
  410. }
  411.  
  412. switch (subcmd)
  413. {
  414. case SCMD_LOGOUT:
  415. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("·Î±×ÀÎ È­¸éÀ¸·Î µ¹¾Æ °©´Ï´Ù. Àá½Ã¸¸ ±â´Ù¸®¼¼¿ä."));
  416. break;
  417.  
  418. case SCMD_QUIT:
  419. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("°ÔÀÓÀ» Á¾·á ÇÕ´Ï´Ù. Àá½Ã¸¸ ±â´Ù¸®¼¼¿ä."));
  420. break;
  421.  
  422. case SCMD_PHASE_SELECT:
  423. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ij¸¯Å͸¦ Àüȯ ÇÕ´Ï´Ù. Àá½Ã¸¸ ±â´Ù¸®¼¼¿ä."));
  424. break;
  425. }
  426.  
  427. int nExitLimitTime = 10;
  428.  
  429. if (ch->IsHack(false, true, nExitLimitTime) &&
  430. false == CThreeWayWar::instance().IsSungZiMapIndex(ch->GetMapIndex()) &&
  431. (!ch->GetWarMap() || ch->GetWarMap()->GetType() == GUILD_WAR_TYPE_FLAG))
  432. {
  433. return;
  434. }
  435.  
  436. switch (subcmd)
  437. {
  438. case SCMD_LOGOUT:
  439. case SCMD_QUIT:
  440. case SCMD_PHASE_SELECT:
  441. {
  442. TimedEventInfo* info = AllocEventInfo<TimedEventInfo>();
  443.  
  444. {
  445. if (ch->IsPosition(POS_FIGHTING))
  446. info->left_second = 10;
  447. else
  448. info->left_second = 3;
  449. }
  450.  
  451. info->ch = ch;
  452. info->subcmd = subcmd;
  453. strlcpy(info->szReason, argument, sizeof(info->szReason));
  454.  
  455. ch->m_pkTimedEvent = event_create(timed_event, info, 1);
  456. }
  457. break;
  458. }
  459. }
  460.  
  461. #ifdef ENABLE_CHANGE_CHANNEL
  462. ACMD(do_change_channel)
  463. {
  464. char arg1[256];
  465. one_argument(argument, arg1, sizeof(arg1));
  466.  
  467. DWORD channel_number = 0;
  468. str_to_number(channel_number, arg1);
  469.  
  470. //if (ch->m_pkChangeChannelEvent)
  471. //{
  472. // ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Change channel canceled."));
  473. // event_cancel(&ch->m_pkChangeChannelEvent);
  474. // return;
  475. //}
  476.  
  477. if(!ch)
  478. {
  479. return;
  480. }
  481.  
  482. if(channel_number == 99 || g_bChannel == 99){
  483. ch->ChatPacket(CHAT_TYPE_INFO, ("Nu poti schimba ch in aceasta mapa."));
  484. return;
  485. }
  486.  
  487. if (ch->GetMapIndex() == 64 || ch->GetMapIndex() == 210)
  488. {
  489. ch->ChatPacket(CHAT_TYPE_INFO, "<Change Channel> Nu poti schimba canalul in aceasta mapa!");
  490. return;
  491. }
  492.  
  493. if(channel_number == g_bChannel)
  494. {
  495. ch->ChatPacket(CHAT_TYPE_INFO, ("Esti deja pe acest canal."));
  496. return;
  497. }
  498.  
  499. if (ch->IsDead() || ch->GetExchange())
  500. {
  501. ch->ChatPacket(CHAT_TYPE_INFO, ("Nu poti schimba canalul acum, asteapta 10 secunde."));
  502. return;
  503. }
  504.  
  505. if(channel_number <= 0 || channel_number > 6)
  506. {
  507. ch->ChatPacket(CHAT_TYPE_INFO, ("Acest canal nu este pornit."));
  508. return;
  509. }
  510.  
  511. if (channel_number != 0)
  512. {
  513. if (ch->m_pkChangeChannelEvent)
  514. {
  515. ch->ChatPacket(CHAT_TYPE_INFO, ("Schimba canal anulat."));
  516. event_cancel(&ch->m_pkChangeChannelEvent);
  517. return;
  518. }
  519.  
  520. ChangeChannelEventInfo* info = AllocEventInfo<ChangeChannelEventInfo>();
  521.  
  522. {
  523. if (ch->IsPosition(POS_FIGHTING))
  524. info->left_second = 10;
  525. else
  526. info->left_second = 3;
  527. }
  528.  
  529. info->ch = ch;
  530. info->channel_number = channel_number;
  531.  
  532. ch->m_pkChangeChannelEvent = event_create(change_channel_event, info, 1);
  533. }
  534. }
  535. #endif
  536.  
  537. ACMD(do_mount)
  538. {
  539. /*
  540. char arg1[256];
  541. struct action_mount_param param;
  542.  
  543. // ÀÌ¹Ì Å¸°í ÀÖÀ¸¸é
  544. if (ch->GetMountingChr())
  545. {
  546. char arg2[256];
  547. two_arguments(argument, arg1, sizeof(arg1), arg2, sizeof(arg2));
  548.  
  549. if (!*arg1 || !*arg2)
  550. return;
  551.  
  552. param.x = atoi(arg1);
  553. param.y = atoi(arg2);
  554. param.vid = ch->GetMountingChr()->GetVID();
  555. param.is_unmount = true;
  556.  
  557. float distance = DISTANCE_SQRT(param.x - (DWORD) ch->GetX(), param.y - (DWORD) ch->GetY());
  558.  
  559. if (distance > 600.0f)
  560. {
  561. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Á» ´õ °¡±îÀÌ °¡¼­ ³»¸®¼¼¿ä."));
  562. return;
  563. }
  564.  
  565. action_enqueue(ch, ACTION_TYPE_MOUNT, &param, 0.0f, true);
  566. return;
  567. }
  568.  
  569. one_argument(argument, arg1, sizeof(arg1));
  570.  
  571. if (!*arg1)
  572. return;
  573.  
  574. LPCHARACTER tch = CHARACTER_MANAGER::instance().Find(atoi(arg1));
  575.  
  576. if (!tch->IsNPC() || !tch->IsMountable())
  577. {
  578. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("°Å±â¿¡´Â Å» ¼ö ¾ø¾î¿ä."));
  579. return;
  580. }
  581.  
  582. float distance = DISTANCE_SQRT(tch->GetX() - ch->GetX(), tch->GetY() - ch->GetY());
  583.  
  584. if (distance > 600.0f)
  585. {
  586. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Á» ´õ °¡±îÀÌ °¡¼­ Ÿ¼¼¿ä."));
  587. return;
  588. }
  589.  
  590. param.vid = tch->GetVID();
  591. param.is_unmount = false;
  592.  
  593. action_enqueue(ch, ACTION_TYPE_MOUNT, &param, 0.0f, true);
  594. */
  595. }
  596.  
  597. ACMD(do_fishing)
  598. {
  599. char arg1[256];
  600. one_argument(argument, arg1, sizeof(arg1));
  601.  
  602. if (!*arg1)
  603. return;
  604.  
  605. ch->SetRotation(atof(arg1));
  606. ch->fishing();
  607. }
  608.  
  609. #ifdef __BIOLOG_SYSTEM__
  610. ACMD(do_biolog)
  611. {
  612. char arg1[256];
  613. one_argument(argument, arg1, sizeof(arg1));
  614.  
  615. if (!*arg1)
  616. {
  617. BiologManager::instance().SendButton(ch);
  618. return;
  619. }
  620.  
  621. if (!strcmp(arg1, "92_reward_1")) {
  622. BiologManager::instance().SelectBonusType(ch, "92_reward_1"); return; }
  623. if (!strcmp(arg1, "92_reward_2")) {
  624. BiologManager::instance().SelectBonusType(ch, "92_reward_2"); return; }
  625. if (!strcmp(arg1, "92_reward_3")) {
  626. BiologManager::instance().SelectBonusType(ch, "92_reward_3"); return; }
  627. if (!strcmp(arg1, "94_reward_1")) {
  628. BiologManager::instance().SelectBonusType(ch, "94_reward_1"); return; }
  629. if (!strcmp(arg1, "94_reward_2")) {
  630. BiologManager::instance().SelectBonusType(ch, "94_reward_2"); return; }
  631. if (!strcmp(arg1, "94_reward_3")) {
  632. BiologManager::instance().SelectBonusType(ch, "94_reward_3"); return; }
  633. }
  634. #endif
  635.  
  636. ACMD(do_console)
  637. {
  638. ch->ChatPacket(CHAT_TYPE_COMMAND, "ConsoleEnable");
  639. }
  640.  
  641. ACMD(do_restart)
  642. {
  643. if (false == ch->IsDead())
  644. {
  645. ch->ChatPacket(CHAT_TYPE_COMMAND, "CloseRestartWindow");
  646. ch->StartRecoveryEvent();
  647. return;
  648. }
  649.  
  650. if (NULL == ch->m_pkDeadEvent)
  651. return;
  652.  
  653. int iTimeToDead = (event_time(ch->m_pkDeadEvent) / passes_per_sec);
  654. #ifdef __ENABLE_BATTLE_FIELD__
  655. bool isBattleMap = CBattleZone::instance().IsBattleZoneMapIndex(ch->GetMapIndex());
  656. int toWaitSeconds = isBattleMap ? MINMAX(g_nPortalLimitTime, 5 + (ch->GetBattleDeadCount() * 5), 30) : g_nPortalLimitTime;
  657. #endif
  658. #ifdef __ENABLE_BATTLE_FIELD__
  659. if (subcmd != SCMD_RESTART_TOWN && subcmd != SCMD_RESTART_BATTLE && (!ch->GetWarMap() || ch->GetWarMap()->GetType() == GUILD_WAR_TYPE_FLAG))
  660. #else
  661. if (subcmd != SCMD_RESTART_TOWN && (!ch->GetWarMap() || ch->GetWarMap()->GetType() == GUILD_WAR_TYPE_FLAG))
  662. #endif
  663. {
  664. if (!test_server)
  665. {
  666. if (ch->IsHack())
  667. {
  668. //¼ºÁö ¸ÊÀϰæ¿ì¿¡´Â üũ ÇÏÁö ¾Ê´Â´Ù.
  669. if (false == CThreeWayWar::instance().IsSungZiMapIndex(ch->GetMapIndex()))
  670. {
  671. #ifdef __ENABLE_BATTLE_FIELD__
  672. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¾ÆÁ÷ Àç½ÃÀÛ ÇÒ ¼ö ¾ø½À´Ï´Ù. (%dÃÊ ³²À½)"), iTimeToDead - (180 - toWaitSeconds));
  673. #else
  674. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¾ÆÁ÷ Àç½ÃÀÛ ÇÒ ¼ö ¾ø½À´Ï´Ù. (%dÃÊ ³²À½)"), iTimeToDead - (180 - g_nPortalLimitTime));
  675. #endif
  676. return;
  677. }
  678. }
  679. #ifdef __ENABLE_BATTLE_FIELD__
  680. if (iTimeToDead > (180 - toWaitSeconds))
  681. {
  682. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¾ÆÁ÷ Àç½ÃÀÛ ÇÒ ¼ö ¾ø½À´Ï´Ù. (%dÃÊ ³²À½)"), iTimeToDead - (180 - toWaitSeconds));
  683. return;
  684. }
  685. #else
  686. if (iTimeToDead > 170)
  687. {
  688. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¾ÆÁ÷ Àç½ÃÀÛ ÇÒ ¼ö ¾ø½À´Ï´Ù. (%dÃÊ ³²À½)"), iTimeToDead - 170);
  689. return;
  690. }
  691. #endif
  692. }
  693. }
  694.  
  695. //PREVENT_HACK
  696. //DESC : â°í, ±³È¯ â ÈÄ Æ÷Å»À» »ç¿ëÇÏ´Â ¹ö±×¿¡ ÀÌ¿ëµÉ¼ö À־
  697. // ÄðŸÀÓÀ» Ãß°¡
  698. #ifdef __ENABLE_BATTLE_FIELD__
  699. if (subcmd == SCMD_RESTART_BATTLE)
  700. {
  701. if(!isBattleMap)
  702. {
  703. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("You can use instant restart just in battle map."));
  704. return;
  705. }
  706.  
  707. if (ch->CountSpecifyItem(50289) < 1)
  708. {
  709. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("You need revive item for instant restart."));
  710. return;
  711. }
  712. }
  713. #endif
  714.  
  715. if (subcmd == SCMD_RESTART_TOWN)
  716. {
  717. if (ch->IsHack())
  718. {
  719. //±æµå¸Ê, ¼ºÁö¸Ê¿¡¼­´Â üũ ÇÏÁö ¾Ê´Â´Ù.
  720. if ((!ch->GetWarMap() || ch->GetWarMap()->GetType() == GUILD_WAR_TYPE_FLAG) ||
  721. false == CThreeWayWar::instance().IsSungZiMapIndex(ch->GetMapIndex()))
  722. {
  723. #ifdef __ENABLE_BATTLE_FIELD__
  724. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¾ÆÁ÷ Àç½ÃÀÛ ÇÒ ¼ö ¾ø½À´Ï´Ù. (%dÃÊ ³²À½)"), iTimeToDead - (180 - toWaitSeconds));
  725. #else
  726. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¾ÆÁ÷ Àç½ÃÀÛ ÇÒ ¼ö ¾ø½À´Ï´Ù. (%dÃÊ ³²À½)"), iTimeToDead - (180 - g_nPortalLimitTime));
  727. #endif
  728. return;
  729. }
  730. }
  731.  
  732. #ifdef __ENABLE_BATTLE_FIELD__
  733. if (iTimeToDead > (180 - toWaitSeconds))
  734. {
  735. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¾ÆÁ÷ Àç½ÃÀÛ ÇÒ ¼ö ¾ø½À´Ï´Ù. (%dÃÊ ³²À½)"), iTimeToDead - (180 - toWaitSeconds));
  736. return;
  737. }
  738. #else
  739. if (iTimeToDead > 173)
  740. {
  741. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¾ÆÁ÷ Àç½ÃÀÛ ÇÒ ¼ö ¾ø½À´Ï´Ù. (%dÃÊ ³²À½)"), iTimeToDead - 173);
  742. return;
  743. }
  744. #endif
  745. }
  746. //END_PREVENT_HACK
  747.  
  748. ch->ChatPacket(CHAT_TYPE_COMMAND, "CloseRestartWindow");
  749.  
  750. ch->GetDesc()->SetPhase(PHASE_GAME);
  751. ch->SetPosition(POS_STANDING);
  752. ch->StartRecoveryEvent();
  753.  
  754. //FORKED_LOAD
  755. //DESC: »ï°Å¸® ÀüÅõ½Ã ºÎȰÀ» ÇÒ°æ¿ì ¸ÊÀÇ ÀÔ±¸°¡ ¾Æ´Ñ »ï°Å¸® ÀüÅõÀÇ ½ÃÀÛÁöÁ¡À¸·Î À̵¿ÇÏ°Ô µÈ´Ù.
  756. if (1 == quest::CQuestManager::instance().GetEventFlag("threeway_war"))
  757. {
  758. if (subcmd == SCMD_RESTART_TOWN || subcmd == SCMD_RESTART_HERE)
  759. {
  760. if (true == CThreeWayWar::instance().IsThreeWayWarMapIndex(ch->GetMapIndex()) &&
  761. false == CThreeWayWar::instance().IsSungZiMapIndex(ch->GetMapIndex()))
  762. {
  763. ch->WarpSet(EMPIRE_START_X(ch->GetEmpire()), EMPIRE_START_Y(ch->GetEmpire()));
  764.  
  765. #ifdef ENABLE_MOUNT_COSTUME_SYSTEM
  766. ch->CheckMount();
  767. #endif
  768. #ifdef NEW_PET_SUMMON
  769. ch->CheckPet();
  770. ch->CheckBuff();
  771. #endif
  772. ch->ReviveInvisible(5);
  773. ch->PointChange(POINT_HP, ch->GetMaxHP() - ch->GetHP());
  774. ch->PointChange(POINT_SP, ch->GetMaxSP() - ch->GetSP());
  775.  
  776. return;
  777. }
  778.  
  779. //¼ºÁö
  780. if (true == CThreeWayWar::instance().IsSungZiMapIndex(ch->GetMapIndex()))
  781. {
  782. if (CThreeWayWar::instance().GetReviveTokenForPlayer(ch->GetPlayerID()) <= 0)
  783. {
  784. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¼ºÁö¿¡¼­ ºÎȰ ±âȸ¸¦ ¸ðµÎ ÀÒ¾ú½À´Ï´Ù! ¸¶À»·Î À̵¿ÇÕ´Ï´Ù!"));
  785. ch->WarpSet(EMPIRE_START_X(ch->GetEmpire()), EMPIRE_START_Y(ch->GetEmpire()));
  786. }
  787. else
  788. {
  789. ch->Show(ch->GetMapIndex(), GetSungziStartX(ch->GetEmpire()), GetSungziStartY(ch->GetEmpire()));
  790. }
  791.  
  792. ch->PointChange(POINT_HP, ch->GetMaxHP() - ch->GetHP());
  793. ch->PointChange(POINT_SP, ch->GetMaxSP() - ch->GetSP());
  794. #ifdef ENABLE_MOUNT_COSTUME_SYSTEM
  795. ch->CheckMount();
  796. #endif
  797. #ifdef NEW_PET_SUMMON
  798. ch->CheckPet();
  799. ch->CheckBuff();
  800. #endif
  801. ch->ReviveInvisible(5);
  802.  
  803. return;
  804. }
  805. }
  806. }
  807. //END_FORKED_LOAD
  808.  
  809. if (ch->GetDungeon())
  810. ch->GetDungeon()->UseRevive(ch);
  811.  
  812. if (ch->GetWarMap() && !ch->IsObserverMode())
  813. {
  814. CWarMap * pMap = ch->GetWarMap();
  815. DWORD dwGuildOpponent = pMap ? pMap->GetGuildOpponent(ch) : 0;
  816.  
  817. if (dwGuildOpponent)
  818. {
  819. switch (subcmd)
  820. {
  821. case SCMD_RESTART_TOWN:
  822. {
  823. sys_log(0, "do_restart: restart town");
  824. PIXEL_POSITION pos;
  825.  
  826. if (CWarMapManager::instance().GetStartPosition(ch->GetMapIndex(), ch->GetGuild()->GetID() < dwGuildOpponent ? 0 : 1, pos))
  827. ch->Show(ch->GetMapIndex(), pos.x, pos.y);
  828. else
  829. ch->ExitToSavedLocation();
  830.  
  831. ch->PointChange(POINT_HP, ch->GetMaxHP() - ch->GetHP());
  832. ch->PointChange(POINT_SP, ch->GetMaxSP() - ch->GetSP());
  833. #ifdef ENABLE_MOUNT_COSTUME_SYSTEM
  834. ch->CheckMount();
  835. #endif
  836. #ifdef NEW_PET_SUMMON
  837. ch->CheckPet();
  838. ch->CheckBuff();
  839. #endif
  840. ch->ReviveInvisible(5);
  841. }
  842. break;
  843.  
  844. case SCMD_RESTART_HERE:
  845. {
  846. sys_log(0, "do_restart: restart here");
  847. ch->RestartAtSamePos();
  848. //ch->Show(ch->GetMapIndex(), ch->GetX(), ch->GetY());
  849. ch->PointChange(POINT_HP, ch->GetMaxHP() - ch->GetHP());
  850. ch->PointChange(POINT_SP, ch->GetMaxSP() - ch->GetSP());
  851. #ifdef ENABLE_MOUNT_COSTUME_SYSTEM
  852. ch->CheckMount();
  853. #endif
  854. #ifdef NEW_PET_SUMMON
  855. ch->CheckPet();
  856. ch->CheckBuff();
  857. #endif
  858. ch->ReviveInvisible(5);
  859. }
  860. break;
  861. }
  862.  
  863. return;
  864. }
  865. }
  866. switch (subcmd)
  867. {
  868. case SCMD_RESTART_TOWN:
  869. {
  870. sys_log(0, "do_restart: restart town");
  871. #ifdef __ENABLE_BATTLE_FIELD__
  872. if(isBattleMap)
  873. {
  874. CBattleZone::instance().RestartAtRandomPos(ch);
  875. ch->PointChange(POINT_HP, ch->GetMaxHP() - ch->GetHP());
  876. }
  877. else
  878. {
  879. PIXEL_POSITION pos;
  880.  
  881. if (SECTREE_MANAGER::instance().GetRecallPositionByEmpire(ch->GetMapIndex(), ch->GetEmpire(), pos))
  882. ch->WarpSet(pos.x, pos.y);
  883. else
  884. ch->WarpSet(EMPIRE_START_X(ch->GetEmpire()), EMPIRE_START_Y(ch->GetEmpire()));
  885.  
  886. ch->PointChange(POINT_HP, 50 - ch->GetHP());
  887. }
  888. #else
  889. PIXEL_POSITION pos;
  890.  
  891. if (SECTREE_MANAGER::instance().GetRecallPositionByEmpire(ch->GetMapIndex(), ch->GetEmpire(), pos))
  892. ch->WarpSet(pos.x, pos.y);
  893. else
  894. ch->WarpSet(EMPIRE_START_X(ch->GetEmpire()), EMPIRE_START_Y(ch->GetEmpire()));
  895.  
  896. ch->PointChange(POINT_HP, 50 - ch->GetHP());
  897. #endif
  898. ch->DeathPenalty(1);
  899. }
  900. break;
  901.  
  902. case SCMD_RESTART_HERE:
  903. {
  904. sys_log(0, "do_restart: restart here");
  905. ch->RestartAtSamePos();
  906. #ifdef __ENABLE_BATTLE_FIELD__
  907. if(isBattleMap)
  908. {
  909. ch->PointChange(POINT_HP, (ch->GetMaxHP() / 2) - ch->GetHP());
  910. ch->DeathPenalty(1);
  911. }
  912. else
  913. {
  914. ch->PointChange(POINT_HP, 50 - ch->GetHP());
  915. ch->DeathPenalty(0);
  916. }
  917.  
  918. #else
  919. ch->PointChange(POINT_HP, 50 - ch->GetHP());
  920. ch->DeathPenalty(0);
  921. #endif
  922. ch->DeathPenalty(0);
  923. #ifdef ENABLE_MOUNT_COSTUME_SYSTEM
  924. ch->CheckMount();
  925. #endif
  926. #ifdef NEW_PET_SUMMON
  927. ch->CheckPet();
  928. ch->CheckBuff();
  929. #endif
  930. ch->ReviveInvisible(5);
  931. }
  932.  
  933. break;
  934. #ifdef __ENABLE_BATTLE_FIELD__
  935. case SCMD_RESTART_BATTLE:
  936. {
  937. sys_log(0, "do_restart: restart battle");
  938. ch->RemoveSpecifyItem(50289, 1);
  939. ch->RestartAtSamePos();
  940. ch->PointChange(POINT_HP, ch->GetMaxHP() - ch->GetHP());
  941. ch->DeathPenalty(1);
  942. ch->ReviveInvisible(5);
  943. }
  944. break;
  945. #endif
  946. }
  947. }
  948.  
  949. #define MAX_STAT g_iStatusPointSetMaxValue
  950.  
  951. ACMD(do_stat_reset)
  952. {
  953. ch->PointChange(POINT_STAT_RESET_COUNT, 12 - ch->GetPoint(POINT_STAT_RESET_COUNT));
  954. }
  955.  
  956. ACMD(do_stat_minus)
  957. {
  958. char arg1[256];
  959. one_argument(argument, arg1, sizeof(arg1));
  960.  
  961. if (!*arg1)
  962. return;
  963.  
  964. if (ch->IsPolymorphed())
  965. {
  966. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("µÐ°© Áß¿¡´Â ´É·ÂÀ» ¿Ã¸± ¼ö ¾ø½À´Ï´Ù."));
  967. return;
  968. }
  969.  
  970. if (ch->GetPoint(POINT_STAT_RESET_COUNT) <= 0)
  971. return;
  972.  
  973. if (!strcmp(arg1, "st"))
  974. {
  975. if (ch->GetRealPoint(POINT_ST) <= JobInitialPoints[ch->GetJob()].st)
  976. return;
  977.  
  978. ch->SetRealPoint(POINT_ST, ch->GetRealPoint(POINT_ST) - 1);
  979. ch->SetPoint(POINT_ST, ch->GetPoint(POINT_ST) - 1);
  980. ch->ComputePoints();
  981. ch->PointChange(POINT_ST, 0);
  982. }
  983. else if (!strcmp(arg1, "dx"))
  984. {
  985. if (ch->GetRealPoint(POINT_DX) <= JobInitialPoints[ch->GetJob()].dx)
  986. return;
  987.  
  988. ch->SetRealPoint(POINT_DX, ch->GetRealPoint(POINT_DX) - 1);
  989. ch->SetPoint(POINT_DX, ch->GetPoint(POINT_DX) - 1);
  990. ch->ComputePoints();
  991. ch->PointChange(POINT_DX, 0);
  992. }
  993. else if (!strcmp(arg1, "ht"))
  994. {
  995. if (ch->GetRealPoint(POINT_HT) <= JobInitialPoints[ch->GetJob()].ht)
  996. return;
  997.  
  998. ch->SetRealPoint(POINT_HT, ch->GetRealPoint(POINT_HT) - 1);
  999. ch->SetPoint(POINT_HT, ch->GetPoint(POINT_HT) - 1);
  1000. ch->ComputePoints();
  1001. ch->PointChange(POINT_HT, 0);
  1002. ch->PointChange(POINT_MAX_HP, 0);
  1003. }
  1004. else if (!strcmp(arg1, "iq"))
  1005. {
  1006. if (ch->GetRealPoint(POINT_IQ) <= JobInitialPoints[ch->GetJob()].iq)
  1007. return;
  1008.  
  1009. ch->SetRealPoint(POINT_IQ, ch->GetRealPoint(POINT_IQ) - 1);
  1010. ch->SetPoint(POINT_IQ, ch->GetPoint(POINT_IQ) - 1);
  1011. ch->ComputePoints();
  1012. ch->PointChange(POINT_IQ, 0);
  1013. ch->PointChange(POINT_MAX_SP, 0);
  1014. }
  1015. else
  1016. return;
  1017.  
  1018. ch->PointChange(POINT_STAT, +1);
  1019. ch->PointChange(POINT_STAT_RESET_COUNT, -1);
  1020. ch->ComputePoints();
  1021. }
  1022.  
  1023. ACMD(do_stat)
  1024. {
  1025. char arg1[256];
  1026. one_argument(argument, arg1, sizeof(arg1));
  1027.  
  1028. if (!*arg1)
  1029. return;
  1030.  
  1031. if (ch->IsPolymorphed())
  1032. {
  1033. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("µÐ°© Áß¿¡´Â ´É·ÂÀ» ¿Ã¸± ¼ö ¾ø½À´Ï´Ù."));
  1034. return;
  1035. }
  1036.  
  1037. if (ch->GetPoint(POINT_STAT) <= 0)
  1038. return;
  1039.  
  1040. BYTE idx = 0;
  1041.  
  1042. if (!strcmp(arg1, "st"))
  1043. idx = POINT_ST;
  1044. else if (!strcmp(arg1, "dx"))
  1045. idx = POINT_DX;
  1046. else if (!strcmp(arg1, "ht"))
  1047. idx = POINT_HT;
  1048. else if (!strcmp(arg1, "iq"))
  1049. idx = POINT_IQ;
  1050. else
  1051. return;
  1052.  
  1053. // ch->ChatPacket(CHAT_TYPE_INFO, "%s GRP(%d) idx(%u), MAX_STAT(%d), expr(%d)", __FUNCTION__, ch->GetRealPoint(idx), idx, MAX_STAT, ch->GetRealPoint(idx) >= MAX_STAT);
  1054. if (ch->GetRealPoint(idx) >= MAX_STAT)
  1055. return;
  1056.  
  1057. ch->SetRealPoint(idx, ch->GetRealPoint(idx) + 1);
  1058. ch->SetPoint(idx, ch->GetPoint(idx) + 1);
  1059. ch->ComputePoints();
  1060. ch->PointChange(idx, 0);
  1061.  
  1062. if (idx == POINT_IQ)
  1063. {
  1064. ch->PointChange(POINT_MAX_HP, 0);
  1065. }
  1066. else if (idx == POINT_HT)
  1067. {
  1068. ch->PointChange(POINT_MAX_SP, 0);
  1069. }
  1070.  
  1071. ch->PointChange(POINT_STAT, -1);
  1072. ch->ComputePoints();
  1073. }
  1074.  
  1075. ACMD(do_pvp)
  1076. {
  1077. if (ch->GetArena() != NULL || CArenaManager::instance().IsArenaMap(ch->GetMapIndex()) == true)
  1078. {
  1079. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("´ë·ÃÀå¿¡¼­ »ç¿ëÇÏ½Ç ¼ö ¾ø½À´Ï´Ù."));
  1080. return;
  1081. }
  1082.  
  1083. char arg1[256];
  1084. one_argument(argument, arg1, sizeof(arg1));
  1085.  
  1086. DWORD vid = 0;
  1087. str_to_number(vid, arg1);
  1088. LPCHARACTER pkVictim = CHARACTER_MANAGER::instance().Find(vid);
  1089.  
  1090. if (!pkVictim)
  1091. return;
  1092.  
  1093. if (pkVictim->IsNPC())
  1094. return;
  1095.  
  1096. if (pkVictim->GetArena() != NULL)
  1097. {
  1098. pkVictim->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("»ó´ë¹æÀÌ ´ë·ÃÁßÀÔ´Ï´Ù."));
  1099. return;
  1100. }
  1101.  
  1102. CPVPManager::instance().Insert(ch, pkVictim);
  1103. }
  1104.  
  1105. ACMD(do_guildskillup)
  1106. {
  1107. char arg1[256];
  1108. one_argument(argument, arg1, sizeof(arg1));
  1109.  
  1110. if (!*arg1)
  1111. return;
  1112.  
  1113. if (!ch->GetGuild())
  1114. {
  1115. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<±æµå> ±æµå¿¡ ¼ÓÇØÀÖÁö ¾Ê½À´Ï´Ù."));
  1116. return;
  1117. }
  1118.  
  1119. CGuild* g = ch->GetGuild();
  1120. TGuildMember* gm = g->GetMember(ch->GetPlayerID());
  1121. if (gm->grade == GUILD_LEADER_GRADE)
  1122. {
  1123. DWORD vnum = 0;
  1124. str_to_number(vnum, arg1);
  1125. g->SkillLevelUp(vnum);
  1126. }
  1127. else
  1128. {
  1129. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<±æµå> ±æµå ½ºÅ³ ·¹º§À» º¯°æÇÒ ±ÇÇÑÀÌ ¾ø½À´Ï´Ù."));
  1130. }
  1131. }
  1132.  
  1133. ACMD(do_skillup)
  1134. {
  1135. char arg1[256];
  1136. one_argument(argument, arg1, sizeof(arg1));
  1137.  
  1138. if (!*arg1)
  1139. return;
  1140.  
  1141. DWORD vnum = 0;
  1142. str_to_number(vnum, arg1);
  1143.  
  1144. if (true == ch->CanUseSkill(vnum))
  1145. {
  1146. ch->SkillLevelUp(vnum);
  1147. }
  1148. else
  1149. {
  1150. switch(vnum)
  1151. {
  1152. case SKILL_HORSE_WILDATTACK:
  1153. case SKILL_HORSE_CHARGE:
  1154. case SKILL_HORSE_ESCAPE:
  1155. case SKILL_HORSE_WILDATTACK_RANGE:
  1156. case SKILL_ADD_HP:
  1157. case SKILL_RESIST_PENETRATE:
  1158. #ifdef __7AND8TH_SKILLS__
  1159. case SKILL_ANTI_PALBANG:
  1160. case SKILL_ANTI_AMSEOP:
  1161. case SKILL_ANTI_SWAERYUNG:
  1162. case SKILL_ANTI_YONGBI:
  1163. case SKILL_ANTI_GIGONGCHAM:
  1164. case SKILL_ANTI_HWAJO:
  1165. case SKILL_ANTI_MARYUNG:
  1166. case SKILL_ANTI_BYEURAK:
  1167. #ifdef __WOLFMAN_CHARACTER__
  1168. case SKILL_ANTI_SALPOONG:
  1169. #endif
  1170. case SKILL_HELP_PALBANG:
  1171. case SKILL_HELP_AMSEOP:
  1172. case SKILL_HELP_SWAERYUNG:
  1173. case SKILL_HELP_YONGBI:
  1174. case SKILL_HELP_GIGONGCHAM:
  1175. case SKILL_HELP_HWAJO:
  1176. case SKILL_HELP_MARYUNG:
  1177. case SKILL_HELP_BYEURAK:
  1178. #ifdef __WOLFMAN_CHARACTER__
  1179. case SKILL_HELP_SALPOONG:
  1180. #endif
  1181. #endif
  1182. ch->SkillLevelUp(vnum);
  1183. break;
  1184. }
  1185. }
  1186. }
  1187.  
  1188. //
  1189. // @version 05/06/20 Bang2ni - Ä¿¸Çµå ó¸® Delegate to CHARACTER class
  1190. //
  1191. ACMD(do_safebox_close)
  1192. {
  1193. ch->CloseSafebox();
  1194. }
  1195.  
  1196. //
  1197. // @version 05/06/20 Bang2ni - Ä¿¸Çµå ó¸® Delegate to CHARACTER class
  1198. //
  1199. ACMD(do_safebox_password)
  1200. {
  1201. char arg1[256];
  1202. one_argument(argument, arg1, sizeof(arg1));
  1203. ch->ReqSafeboxLoad(arg1);
  1204. }
  1205.  
  1206. ACMD(do_safebox_change_password)
  1207. {
  1208. char arg1[256];
  1209. char arg2[256];
  1210.  
  1211. two_arguments(argument, arg1, sizeof(arg1), arg2, sizeof(arg2));
  1212.  
  1213. if (!*arg1 || strlen(arg1)>6)
  1214. {
  1215. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<â°í> À߸øµÈ ¾ÏÈ£¸¦ ÀÔ·ÂÇϼ̽À´Ï´Ù."));
  1216. return;
  1217. }
  1218.  
  1219. if (!*arg2 || strlen(arg2)>6)
  1220. {
  1221. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<â°í> À߸øµÈ ¾ÏÈ£¸¦ ÀÔ·ÂÇϼ̽À´Ï´Ù."));
  1222. return;
  1223. }
  1224.  
  1225. TSafeboxChangePasswordPacket p;
  1226.  
  1227. p.dwID = ch->GetDesc()->GetAccountTable().id;
  1228. strlcpy(p.szOldPassword, arg1, sizeof(p.szOldPassword));
  1229. strlcpy(p.szNewPassword, arg2, sizeof(p.szNewPassword));
  1230.  
  1231. db_clientdesc->DBPacket(HEADER_GD_SAFEBOX_CHANGE_PASSWORD, ch->GetDesc()->GetHandle(), &p, sizeof(p));
  1232. }
  1233.  
  1234. ACMD(do_mall_password)
  1235. {
  1236. char arg1[256];
  1237. one_argument(argument, arg1, sizeof(arg1));
  1238.  
  1239. if (!*arg1 || strlen(arg1) > 6)
  1240. {
  1241. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<â°í> À߸øµÈ ¾ÏÈ£¸¦ ÀÔ·ÂÇϼ̽À´Ï´Ù."));
  1242. return;
  1243. }
  1244.  
  1245. int iPulse = thecore_pulse();
  1246.  
  1247. if (ch->GetMall())
  1248. {
  1249. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<â°í> â°í°¡ ÀÌ¹Ì ¿­·ÁÀÖ½À´Ï´Ù."));
  1250. return;
  1251. }
  1252.  
  1253. if (iPulse - ch->GetMallLoadTime() < passes_per_sec * 10) // 10ÃÊ¿¡ Çѹø¸¸ ¿äû °¡´É
  1254. {
  1255. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<â°í> â°í¸¦ ´ÝÀºÁö 10ÃÊ ¾È¿¡´Â ¿­ ¼ö ¾ø½À´Ï´Ù."));
  1256. return;
  1257. }
  1258.  
  1259. ch->SetMallLoadTime(iPulse);
  1260.  
  1261. TSafeboxLoadPacket p;
  1262. p.dwID = ch->GetDesc()->GetAccountTable().id;
  1263. strlcpy(p.szLogin, ch->GetDesc()->GetAccountTable().login, sizeof(p.szLogin));
  1264. strlcpy(p.szPassword, arg1, sizeof(p.szPassword));
  1265.  
  1266. db_clientdesc->DBPacket(HEADER_GD_MALL_LOAD, ch->GetDesc()->GetHandle(), &p, sizeof(p));
  1267. }
  1268.  
  1269. ACMD(do_mall_close)
  1270. {
  1271. if (ch->GetMall())
  1272. {
  1273. ch->SetMallLoadTime(thecore_pulse());
  1274. ch->CloseMall();
  1275. ch->Save();
  1276. }
  1277. }
  1278.  
  1279. ACMD(do_ungroup)
  1280. {
  1281. if (!ch->GetParty())
  1282. return;
  1283.  
  1284. if (!CPartyManager::instance().IsEnablePCParty())
  1285. {
  1286. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<ÆÄƼ> ¼­¹ö ¹®Á¦·Î ÆÄƼ °ü·Ã 󸮸¦ ÇÒ ¼ö ¾ø½À´Ï´Ù."));
  1287. return;
  1288. }
  1289.  
  1290. if (ch->GetDungeon())
  1291. {
  1292. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<ÆÄƼ> ´øÀü ¾È¿¡¼­´Â ÆÄƼ¿¡¼­ ³ª°¥ ¼ö ¾ø½À´Ï´Ù."));
  1293. return;
  1294. }
  1295.  
  1296. LPPARTY pParty = ch->GetParty();
  1297.  
  1298. if (pParty->GetMemberCount() == 2)
  1299. {
  1300. // party disband
  1301. CPartyManager::instance().DeleteParty(pParty);
  1302. }
  1303. else
  1304. {
  1305. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<ÆÄƼ> ÆÄƼ¿¡¼­ ³ª°¡¼Ì½À´Ï´Ù."));
  1306. //pParty->SendPartyRemoveOneToAll(ch);
  1307. pParty->Quit(ch->GetPlayerID());
  1308. //pParty->SendPartyRemoveAllToOne(ch);
  1309. }
  1310. }
  1311.  
  1312. #ifdef MULTI_LANGUAGE_SYSTEM
  1313. ACMD(do_lang_en)
  1314. {
  1315. char query[1024];
  1316. sprintf(query, "UPDATE account.account SET lang = 'en' WHERE id = '%d'", ch->GetAID());
  1317. DBManager::instance().DirectQuery(query);
  1318. ch->ChatPacket(CHAT_TYPE_INFO, "your new lenguague is english");
  1319. ch->GetDesc()->DelayedDisconnect(5);
  1320. }
  1321.  
  1322. ACMD(do_lang_es)
  1323. {
  1324. char query[1024];
  1325. sprintf(query, "UPDATE account.account SET lang = 'es' WHERE id = '%d'", ch->GetAID());
  1326. DBManager::instance().DirectQuery(query);
  1327. ch->ChatPacket(CHAT_TYPE_INFO, "Tu nuevo lenguaje es espanish.");
  1328. ch->GetDesc()->DelayedDisconnect(5);
  1329.  
  1330. }ACMD(do_lang_pt)
  1331. {
  1332. char query[1024];
  1333. sprintf(query, "UPDATE account.account SET lang = 'pt' WHERE id = '%d'", ch->GetAID());
  1334. DBManager::instance().DirectQuery(query);
  1335. ch->ChatPacket(CHAT_TYPE_INFO, "sua nova lingua e Portugal.");
  1336. ch->GetDesc()->DelayedDisconnect(5);
  1337. }
  1338.  
  1339. ACMD(do_lang_ro)
  1340. {
  1341. char query[1024];
  1342. sprintf(query, "UPDATE account.account SET lang = 'ro' WHERE id = '%d'", ch->GetAID());
  1343. DBManager::instance().DirectQuery(query);
  1344. ch->ChatPacket(CHAT_TYPE_INFO, "noua limba in limba romana.");
  1345. ch->GetDesc()->DelayedDisconnect(5);
  1346. }
  1347. #endif
  1348.  
  1349. #ifdef GIFT_SYSTEM
  1350. #include "db.h"
  1351. #include <string>
  1352. #include <boost/algorithm/string.hpp>
  1353.  
  1354. ACMD(do_gift_show)
  1355. {
  1356. ch->ChatPacket(CHAT_TYPE_COMMAND, "gift_show");
  1357. }
  1358. bool GetGift(LPCHARACTER ch, DWORD id,bool all=false)
  1359. {
  1360. char szSockets[1024] = { '\0' };
  1361. char *tempSockets = szSockets;
  1362. for (int i = 0; i < ITEM_SOCKET_MAX_NUM; i++)
  1363. {
  1364. tempSockets += sprintf(tempSockets, "socket%d", i);
  1365.  
  1366. if (i<ITEM_SOCKET_MAX_NUM - 1)
  1367. tempSockets += sprintf(tempSockets, ",");
  1368. }
  1369. char szAttrs[1024] = { '\0' };
  1370. char *tempAttrs = szAttrs;
  1371. for (int i = 0; i < ITEM_ATTRIBUTE_MAX_NUM; i++)
  1372. {
  1373. if (i < 7)
  1374. tempAttrs += sprintf(tempAttrs, "attrtype%d,attrvalue%d", i, i);
  1375. else
  1376. tempAttrs += sprintf(tempAttrs, "applytype%d,applyvalue%d", i - 7, i - 7);
  1377. if (i<ITEM_ATTRIBUTE_MAX_NUM - 1)
  1378. tempAttrs += sprintf(tempAttrs, ",");
  1379. }
  1380. char query[8192];
  1381. if (!all)
  1382. snprintf(query, sizeof(query), "SELECT id,vnum,count,%s,%s from player_gift where id='%d' and owner_id=%d and status='WAIT'", szSockets, szAttrs, id, ch->GetPlayerID());
  1383. else
  1384. snprintf(query, sizeof(query), "SELECT id,vnum,count,%s,%s from player_gift where owner_id=%d and status='WAIT'", szSockets, szAttrs, ch->GetPlayerID());
  1385. SQLMsg * pkMsg(DBManager::instance().DirectQuery(query));
  1386. SQLResult * pRes = pkMsg->Get();
  1387. if (pRes->uiNumRows > 0)
  1388. {
  1389. ch->SetQuestFlag("gift.time", get_global_time()+(1*pRes->uiNumRows)+2);
  1390. MYSQL_ROW row;
  1391. bool force = false;
  1392. while ((row = mysql_fetch_row(pRes->pSQLResult)) != NULL)
  1393. {
  1394. DWORD vnum, socket[ITEM_SOCKET_MAX_NUM], attr[ITEM_ATTRIBUTE_MAX_NUM][2];
  1395. int col = 0;
  1396. long long count = 0;
  1397. str_to_number(id, row[col++]);
  1398. str_to_number(vnum, row[col++]);
  1399. str_to_number(count, row[col++]);
  1400. if (vnum == 1)
  1401. {
  1402. #ifndef FULL_YANG
  1403. long long nTotalMoney = ch->GetGold()+count;
  1404.  
  1405. if (GOLD_MAX <= nTotalMoney)
  1406. {
  1407. sys_err("[OVERFLOW_GOLD] Overflow (GOLD_MAX) id %u name %s", ch->GetPlayerID(), ch->GetName());
  1408. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("20?? ©©E?¡í ??¡ÆuC??¨Ï ¡íoA¢§?¡í ?¡©?o¡Æ¢§ ??¢©?¢¥?¢¥?"));
  1409. return true;
  1410. }
  1411. #endif
  1412. #ifdef FULL_YANG_OWN
  1413. ch->ChangeGold(count);
  1414. #else
  1415. ch->PointChange(POINT_GOLD, count, false);
  1416. #endif
  1417.  
  1418. }
  1419. else {
  1420. if (force)
  1421. continue;
  1422. for (int s = 0; s < ITEM_SOCKET_MAX_NUM; s++)
  1423. str_to_number(socket[s], row[col++]);
  1424.  
  1425. for (int a = 0; a < ITEM_ATTRIBUTE_MAX_NUM; a++)
  1426. {
  1427. str_to_number(attr[a][0], row[col++]);
  1428. str_to_number(attr[a][1], row[col++]);
  1429. }
  1430. LPITEM item = ITEM_MANAGER::instance().CreateItem(vnum, count, 0, true);
  1431. if (item)
  1432. {
  1433. for (int s = 0; s < ITEM_SOCKET_MAX_NUM; s++)
  1434. item->SetSocket(s, socket[s], false);
  1435. item->ClearAttribute();
  1436. for (int a = 0; a < ITEM_ATTRIBUTE_MAX_NUM; a++)
  1437. item->SetForceAttribute(a, attr[a][0], attr[a][1]);
  1438.  
  1439.  
  1440. if (item->IsDragonSoul())
  1441. {
  1442. int iEmptyPos = ch->GetEmptyDragonSoulInventory(item);
  1443.  
  1444. if (iEmptyPos != -1)
  1445. {
  1446. item->AddToCharacter(ch, TItemPos(DRAGON_SOUL_INVENTORY, iEmptyPos));
  1447. }
  1448. else
  1449. {
  1450. M2_DESTROY_ITEM(item);
  1451. if (!ch->DragonSoul_IsQualified())
  1452. {
  1453. ch->ChatPacket(CHAT_TYPE_INFO, "<Gift> %s #3", LC_TEXT( "UNKNOW_ERROR"));
  1454. force = true;
  1455. continue;
  1456. }
  1457. else {
  1458. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT( "INVENTORY_FULL_ERROR"));
  1459. force = true;
  1460. continue;
  1461. }
  1462. }
  1463. }
  1464. else if (item->IsUpgradeItem())
  1465. {
  1466. int iEmptyPos = ch->GetEmptyUpgradeInventory(item);
  1467.  
  1468. if (iEmptyPos != -1)
  1469. {
  1470. item->AddToCharacter(ch, TItemPos(UPGRADE_INVENTORY, iEmptyPos));
  1471. ch->ChatPacket(CHAT_TYPE_INFO,("%s a fost adaugat in depozitul special"), item->GetName());
  1472. }
  1473. else
  1474. {
  1475. M2_DESTROY_ITEM(item);
  1476. ch->ChatPacket(CHAT_TYPE_INFO, "Nu ai suficient spatiu in depozitul speecial.");
  1477. }
  1478. }
  1479. else if (item->IsBook())
  1480. {
  1481. int iEmptyPos = ch->GetEmptyBookInventory(item);
  1482.  
  1483. if (iEmptyPos != -1)
  1484. {
  1485. item->AddToCharacter(ch, TItemPos(BOOK_INVENTORY, iEmptyPos));
  1486. ch->ChatPacket(CHAT_TYPE_INFO,("%s a fost adaugat in depozitul special"), item->GetName());
  1487. }
  1488. else
  1489. {
  1490. M2_DESTROY_ITEM(item);
  1491. ch->ChatPacket(CHAT_TYPE_INFO, "Nu ai suficient spatiu in depozitul speecial.");
  1492. }
  1493. }
  1494. else if (item->IsStone())
  1495. {
  1496. int iEmptyPos = ch->GetEmptyStoneInventory(item);
  1497.  
  1498. if (iEmptyPos != -1)
  1499. {
  1500. item->AddToCharacter(ch, TItemPos(STONE_INVENTORY, iEmptyPos));
  1501. ch->ChatPacket(CHAT_TYPE_INFO,("%s a fost adaugat in depozitul special"), item->GetName());
  1502. }
  1503. else
  1504. {
  1505. M2_DESTROY_ITEM(item);
  1506. ch->ChatPacket(CHAT_TYPE_INFO, "Nu ai suficient spatiu in depozitul speecial.");
  1507. }
  1508. }
  1509. else
  1510. {
  1511. int iEmptyPos = ch->GetEmptyInventory(item->GetSize());
  1512.  
  1513. if (iEmptyPos != -1)
  1514. {
  1515. item->AddToCharacter(ch, TItemPos(INVENTORY, iEmptyPos));
  1516. }
  1517. else
  1518. {
  1519. M2_DESTROY_ITEM(item);
  1520. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT( "INVENTORY_FULL_ERROR"));
  1521. force = true;
  1522. continue;
  1523. }
  1524. }
  1525. }
  1526. else
  1527. {
  1528. ch->ChatPacket(CHAT_TYPE_INFO, "<Gift> %s #4", LC_TEXT( "UNKNOW_ERROR"));
  1529. force = true;
  1530. continue;
  1531. }
  1532.  
  1533. }
  1534. DBManager::instance().DirectQuery("UPDATE player_gift SET status='OK',date_get=NOW() where id=%d;", id);
  1535. }
  1536. if (force)
  1537. return true;
  1538. if (all)
  1539. ch->ChatPacket(CHAT_TYPE_INFO,LC_TEXT("GIFT_ADD_ALL_SUCCESS"));
  1540. else
  1541. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT( "GIFT_ADD_SUCCESS"));
  1542. ch->SetQuestFlag("gift.time", get_global_time()+2);
  1543. return true;
  1544. }
  1545. return false;
  1546. }
  1547. ACMD(do_gift_get)
  1548. {
  1549. if(ch->GetQuestFlag("gift.time") > get_global_time())
  1550. return;
  1551. char arg1[256];
  1552. one_argument(argument, arg1, sizeof(arg1));
  1553. bool full = !isdigit(*arg1);
  1554. DWORD id;
  1555. str_to_number(id, arg1);
  1556. if (GetGift(ch, id,full))
  1557. {
  1558. ch->RefreshGift();
  1559. ch->LoadGiftPage(ch->GetLastGiftPage());
  1560. }
  1561.  
  1562. }
  1563. ACMD(do_gift_refresh)
  1564. {
  1565. char arg1[256];
  1566. one_argument(argument, arg1, sizeof(arg1));
  1567. if (!*arg1)
  1568. {
  1569. if (ch->GetGiftPages() > 0)
  1570. ch->ChatPacket(CHAT_TYPE_COMMAND, "gift_info %d", ch->GetGiftPages());
  1571. }
  1572. else{
  1573. int page;
  1574. str_to_number(page, arg1);
  1575. ch->LoadGiftPage(page);
  1576.  
  1577. }
  1578.  
  1579.  
  1580. }
  1581. #endif
  1582.  
  1583. #ifdef OFFLINE_SHOP
  1584. void DeleteShop(DWORD id)
  1585. {
  1586. CharacterVectorInteractor i;
  1587. if (CHARACTER_MANAGER::instance().GetCharactersByRaceNum(30000, i))
  1588. {
  1589. CharacterVectorInteractor::iterator it = i.begin();
  1590.  
  1591. while (it != i.end()) {
  1592. LPCHARACTER pc = *it++;
  1593. if (pc)
  1594. if (pc->GetRaceNum() == 30000 && pc->GetPrivShop() == id) {
  1595. pc->DeleteMyShop();
  1596. return;
  1597. }
  1598.  
  1599.  
  1600. }
  1601. }
  1602. TPacketShopClose packet;
  1603. packet.shop_id = id;
  1604. packet.pid = 0;
  1605. db_clientdesc->DBPacket(HEADER_GD_SHOP_CLOSE, 0, &packet, sizeof(packet));
  1606. }
  1607.  
  1608. ACMD(do_close_shop)
  1609. {
  1610. #ifdef ACCOUNT_SHIELD
  1611. if (ch->IsBlockAccount())
  1612. return;
  1613. #endif
  1614. if (ch->IsObserverMode() || ch->GetExchange())
  1615. return;
  1616. DWORD id;
  1617. char arg1[256];
  1618. one_argument(argument, arg1, sizeof(arg1));
  1619. if (!*arg1)
  1620. {
  1621. ch->CloseMyShop();
  1622. }else{
  1623. str_to_number(id, arg1);
  1624. char pid[4096];
  1625. sprintf(pid, "and player_id=%d", ch->GetPlayerID());
  1626. if (id > 0)
  1627. {
  1628. SQLMsg * pkMsg(DBManager::instance().DirectQuery("SELECT player_id,channel from player_shop WHERE id = %d %s", id, (ch->GetGMLevel() >= SHOP_GM_PRIVILEGES ? "" : pid)));
  1629. SQLResult * pRes = pkMsg->Get();
  1630. if (pRes->uiNumRows > 0)
  1631. DeleteShop(id);
  1632. }
  1633.  
  1634.  
  1635.  
  1636. }
  1637. }
  1638. #include "banword.h"
  1639. ACMD(do_set_name_shop)
  1640. {
  1641. #ifdef ACCOUNT_SHIELD
  1642. if (ch->IsBlockAccount())
  1643. return;
  1644. #endif
  1645. if (ch->IsObserverMode() || ch->GetExchange())
  1646. return;
  1647. DWORD id;
  1648. char arg1[256];
  1649. char arg2[256];
  1650. two_arguments(argument, arg1, sizeof(arg1), arg2, sizeof(arg2));
  1651. if (!*arg1 || !*arg2)
  1652. return;
  1653. str_to_number(id, arg1);
  1654. char pid[4096];
  1655. sprintf(pid, "and player_id=%d", ch->GetPlayerID());
  1656. std::string m_stShopSign(arg2);
  1657. boost::algorithm::replace_all(m_stShopSign, "\\", " ");
  1658. boost::algorithm::replace_all(m_stShopSign, "%", "%%");
  1659. if (m_stShopSign.length()>SHOP_SIGN_MAX_LEN)
  1660. m_stShopSign.resize(SHOP_SIGN_MAX_LEN);
  1661. if (m_stShopSign.length()<1) {
  1662. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("???O?i©©? ???i¡Æ¢§ ?¡ÀCO¥ì? ¡íoA¢§ ??¢¬¡×?¢¬¡¤I ¡íoA¢§?¡í ?¡© ?o ??¢©?¢¥?¢¥?."));
  1663. return;
  1664. }
  1665. #ifdef STRING_PROTECTION
  1666. if (CBanwordManager::instance().CheckString(m_stShopSign.c_str(), m_stShopSign.length()) != "")
  1667. {
  1668. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("???O?i©©? ???i¡Æ¢§ ?¡ÀCO¥ì? ¡íoA¢§ ??¢¬¡×?¢¬¡¤I ¡íoA¢§?¡í ?¡© ?o ??¢©?¢¥?¢¥?."));
  1669. return;
  1670. }
  1671. #else
  1672.  
  1673. if (CBanwordManager::instance().CheckString(m_stShopSign.c_str(), m_stShopSign.length()))
  1674. {
  1675. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("???O?i©©? ???i¡Æ¢§ ?¡ÀCO¥ì? ¡íoA¢§ ??¢¬¡×?¢¬¡¤I ¡íoA¢§?¡í ?¡© ?o ??¢©?¢¥?¢¥?."));
  1676. return;
  1677. }
  1678. #endif
  1679. if (id>0)
  1680. {
  1681. SQLMsg * pkMsg(DBManager::instance().DirectQuery("SELECT id,player_id,channel from player_shop WHERE id = %d %s", id, (ch->GetGMLevel() >= SHOP_GM_PRIVILEGES ? "" : pid)));
  1682. SQLResult * pRes = pkMsg->Get();
  1683. if (pRes->uiNumRows > 0)
  1684. {
  1685. char szName[256];
  1686. DBManager::instance().EscapeString(szName, 256, m_stShopSign.c_str(), m_stShopSign.length());
  1687. DBManager::Instance().DirectQuery("UPDATE player_shop SET name='%s' WHERE id=%d", szName, id);
  1688. ch->LoadPrivShops();
  1689. CharacterVectorInteractor i;
  1690. if (CHARACTER_MANAGER::instance().GetCharactersByRaceNum(30000, i))
  1691. {
  1692. CharacterVectorInteractor::iterator it = i.begin();
  1693.  
  1694. while (it != i.end()) {
  1695. LPCHARACTER pc = *it++;
  1696. if (pc)
  1697. if (pc->GetMyShop() && pc->GetPrivShop() == id) {
  1698. pc->SetShopSign(m_stShopSign.c_str());
  1699. return;
  1700. }
  1701.  
  1702.  
  1703. }
  1704. }
  1705. TPacketShopName packet;
  1706. packet.shop_id = id;
  1707. strlcpy(packet.szSign, m_stShopSign.c_str(), sizeof(packet.szSign) - 1);
  1708. db_clientdesc->DBPacket(HEADER_GD_SHOP_NAME, 0, &packet, sizeof(packet));
  1709.  
  1710.  
  1711. }
  1712. }
  1713. }
  1714.  
  1715. ACMD(do_shop_refresh)
  1716. {
  1717. ch->SendShops();
  1718. }
  1719.  
  1720. ACMD(do_shop_yang)
  1721. {
  1722. if (ch->IsObserverMode() || ch->GetExchange())
  1723. return;
  1724. DWORD id;
  1725. char arg1[256];
  1726. one_argument(argument, arg1, sizeof(arg1));
  1727. if (!*arg1)
  1728. return;
  1729. str_to_number(id, arg1);
  1730. if (*arg1)
  1731. {
  1732. SQLMsg * pkMsg(DBManager::instance().DirectQuery("SELECT gold from player_shop WHERE id = %d and player_id=%d", id,ch->GetPlayerID()));
  1733. SQLResult * pRes = pkMsg->Get();
  1734. if (pRes->uiNumRows>0)
  1735. {
  1736. MYSQL_ROW row;
  1737. while ((row = mysql_fetch_row(pRes->pSQLResult)) != NULL)
  1738. {
  1739. long long gold;
  1740. str_to_number(gold, row[0]);
  1741. if (gold >0)
  1742. {
  1743. #ifndef FULL_YANG
  1744. long long nTotalMoney = ch->GetGold() + gold;
  1745.  
  1746. if (GOLD_MAX <= nTotalMoney)
  1747. {
  1748. sys_err("[OVERFLOW_GOLD] Overflow (GOLD_MAX) id %u name %s", ch->GetPlayerID(), ch->GetName());
  1749. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("20?? ©©E?¡í ??¡ÆuC??¨Ï ¡íoA¢§?¡í ?¡©?o¡Æ¢§ ??¢©?¢¥?¢¥?"));
  1750. return;
  1751. }
  1752. #endif
  1753. #ifdef FULL_YANG_OWN
  1754. ch->ChangeGold(gold);
  1755. #else
  1756. ch->PointChange(POINT_GOLD,gold, false);
  1757. #endif
  1758.  
  1759. TPrivShop s = ch->GetPrivShopTable(id);
  1760. s.gold = s.gold - gold;
  1761. s.rest_count = s.item_count - 1;
  1762. ch->UpdatePrivShopTable(s.shop_id, s);
  1763. ch->SendShops();
  1764. DBManager::instance().DirectQuery("UPDATE player_shop SET gold=gold - %lld WHERE id = %d", gold, id);
  1765. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("SHOP_YANG_ADD"));
  1766. }
  1767. }
  1768. }
  1769. }
  1770. }
  1771. #include <boost/algorithm/string.hpp>
  1772. ACMD(do_shop_update_item)
  1773. {
  1774. char arg1[256];
  1775. one_argument(argument, arg1, sizeof(arg1));
  1776. if (!*arg1)
  1777. return;
  1778. std::vector<std::string> args;
  1779. boost::split(args, arg1, boost::is_any_of("|"));
  1780. if (args.size()<3) {
  1781. return;
  1782. }
  1783. DWORD shop_id;
  1784. str_to_number(shop_id, args[1].c_str());
  1785.  
  1786. if (ch->IsObserverMode() || ch->GetExchange() || ch->IsOpenSafebox() || ch->GetShopOwner() || ch->IsCubeOpen() || ch->GetMyShop())
  1787. {
  1788. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Nu poti face asta acum."));
  1789. return;
  1790. }
  1791.  
  1792. bool myShop=false;
  1793. {
  1794. CharacterVectorInteractor i;
  1795. if (CHARACTER_MANAGER::instance().GetCharactersByRaceNum(30000, i))
  1796. {
  1797. CharacterVectorInteractor::iterator it = i.begin();
  1798. while (it != i.end()) {
  1799. LPCHARACTER pc = *it++;
  1800. if (pc)
  1801. if (pc->GetRaceNum() == 30000 && pc->GetPrivShop() == shop_id) {
  1802. myShop=true;
  1803. break;
  1804. }
  1805.  
  1806.  
  1807. }
  1808. }
  1809. }
  1810. if(!myShop)
  1811. {
  1812. SQLMsg * pkMsg(DBManager::instance().DirectQuery("SELECT id from player_shop WHERE id = %d and player_id=%d", shop_id, ch->GetPlayerID()));
  1813. SQLResult * pRes = pkMsg->Get();
  1814. myShop=pRes->uiNumRows>0;
  1815. }
  1816. if (myShop)
  1817. {
  1818.  
  1819. {
  1820. TPacketShopUpdateItem packet;
  1821. packet.shop_id = shop_id;
  1822. packet.shop_locked = true;
  1823. db_clientdesc->DBPacket(HEADER_GD_SHOP_UPDATE_ITEM, 0, &packet, sizeof(packet));
  1824. }
  1825. /*
  1826. /update_shop_item price|%d|%d|%d)
  1827. /update_shop_item remove|%d|%d
  1828. /update_shop_item add|%d|%d|%d|%d|%s
  1829.  
  1830. */
  1831. if (args.size() == 4)
  1832. {
  1833. DWORD item_id;
  1834. str_to_number(item_id, args[2].c_str());
  1835. long long price;
  1836. str_to_number(price, args[3].c_str());
  1837. if (price <= 0 || item_id <= 0)
  1838. return;
  1839. else
  1840. {
  1841. long long nTotalMoney=price;
  1842. SQLMsg * pkMsg(DBManager::instance().DirectQuery("SELECT price from player_shop_items where shop_id='%d'", shop_id));
  1843. SQLResult * pRes = pkMsg->Get();
  1844. if (pRes->uiNumRows>0)
  1845. {
  1846. MYSQL_ROW row;
  1847. while ((row = mysql_fetch_row(pRes->pSQLResult)) != NULL)
  1848. {
  1849. long long temp;
  1850. str_to_number(temp,row[0]);
  1851. nTotalMoney+=temp;
  1852. }
  1853. }
  1854. if (GOLD_MAX <= nTotalMoney)
  1855. {
  1856. // sys_err("[OVERFLOW_GOLD] Overflow (GOLD_MAX) id %u name %s", ch->GetPlayerID(), ch->GetName());
  1857. ch->ChatPacket(CHAT_TYPE_INFO, "Ai depasit limita de yang !");
  1858. return;
  1859. }
  1860. else
  1861. {
  1862. SQLMsg * pkMsg(DBManager::instance().DirectQuery("SELECT id from player_shop_items WHERE id = %d and shop_id=%d", item_id, shop_id));
  1863. SQLResult * pRes = pkMsg->Get();
  1864. if (pRes->uiNumRows > 0)
  1865. DBManager::instance().DirectQuery("UPDATE player_shop_items SET price=%lld WHERE id = %d and shop_id=%d", price, item_id, shop_id);
  1866. }
  1867. }
  1868. }
  1869. else if (args.size() == 3)
  1870. {
  1871. DWORD item_id;
  1872. str_to_number(item_id, args[2].c_str());
  1873. if (item_id <= 0)
  1874. return;
  1875. {
  1876.  
  1877. std::string shop_name(LC_TEXT( "SHOP_NAME"));
  1878. boost::replace_all(shop_name, "#PLAYER_NAME#", ch->GetName());
  1879. boost::replace_all(shop_name, "#ID#", "");
  1880.  
  1881.  
  1882. char szSockets[1024] = { '\0' };
  1883. char *tempSockets = szSockets;
  1884. for (int i = 0; i < ITEM_SOCKET_MAX_NUM; i++)
  1885. {
  1886. tempSockets += sprintf(tempSockets, "socket%d", i);
  1887.  
  1888. if (i<ITEM_SOCKET_MAX_NUM - 1)
  1889. tempSockets += sprintf(tempSockets, ",");
  1890. }
  1891. char szAttrs[1024] = { '\0' };
  1892. char *tempAttrs = szAttrs;
  1893. for (int i = 0; i < ITEM_ATTRIBUTE_MAX_NUM; i++)
  1894. {
  1895. if (i < 7)
  1896. tempAttrs += sprintf(tempAttrs, "attrtype%d,attrvalue%d", i, i);
  1897. else
  1898. tempAttrs += sprintf(tempAttrs, "applytype%d,applyvalue%d", i - 7, i - 7);
  1899. if (i<ITEM_ATTRIBUTE_MAX_NUM - 1)
  1900. tempAttrs += sprintf(tempAttrs, ",");
  1901. }
  1902.  
  1903. SQLMsg * pkMsg(DBManager::instance().DirectQuery("SELECT vnum,count,%s,%s from player_shop_items where shop_id='%d' and id=%d", szSockets,szAttrs,shop_id, item_id));
  1904. SQLResult * pRes = pkMsg->Get();
  1905. if (pRes->uiNumRows>0)
  1906. {
  1907. MYSQL_ROW row;
  1908. while ((row = mysql_fetch_row(pRes->pSQLResult)) != NULL)
  1909. {
  1910.  
  1911. int col = 0;
  1912. char query[8192];
  1913. sprintf(query, "INSERT INTO player_gift SET owner_id=%d,reason='%s',`from`=replace(\"%s\",' ','_'),status='WAIT',date_add=NOW()", ch->GetPlayerID(), LC_TEXT( "SHOP_ITEM_REASON"), shop_name.c_str());
  1914. sprintf(query, "%s, vnum='%s'", query, row[col++]);
  1915. sprintf(query, "%s, count='%s'", query, row[col++]);
  1916. for (int s = 0; s < ITEM_SOCKET_MAX_NUM; s++)
  1917. sprintf(query, "%s, socket%d='%s'", query, s, row[col++]);
  1918.  
  1919. for (int ia = 0; ia < ITEM_ATTRIBUTE_MAX_NUM; ia++)
  1920. {
  1921. if (ia < 7)
  1922. {
  1923. sprintf(query, "%s, attrtype%d='%s'", query, ia, row[col++]);
  1924. sprintf(query, "%s, attrvalue%d='%s'", query, ia, row[col++]);
  1925. }
  1926. else
  1927. {
  1928. sprintf(query, "%s, applytype%d='%s'", query, ia-7,row[col++]);
  1929. sprintf(query, "%s, applyvalue%d='%s'", query, ia-7,row[col++]);
  1930. }
  1931. }
  1932. SQLMsg * pkMsg(DBManager::instance().DirectQuery(query));
  1933. SQLResult * pRes = pkMsg->Get();
  1934. DWORD gift_id = pRes->uiInsertID;
  1935. if (gift_id > 0)
  1936. GetGift(ch, gift_id);
  1937.  
  1938. DBManager::instance().DirectQuery("delete from player_shop_items where id='%d'", item_id);
  1939. DBManager::instance().DirectQuery("UPDATE player_shop SET item_count=item_count-1 WHERE id = %d", shop_id);
  1940. }
  1941. }
  1942.  
  1943. }
  1944. }
  1945.  
  1946. else if (args.size() == 6)
  1947. {
  1948. BYTE display_pos;
  1949. str_to_number(display_pos, args[2].c_str());
  1950.  
  1951. if (display_pos < 0)
  1952. return;
  1953. WORD pos;
  1954. str_to_number(pos, args[3].c_str());
  1955. if (pos < 0)
  1956. return;
  1957.  
  1958. BYTE window_type;
  1959. str_to_number(window_type, args[4].c_str());
  1960. if (window_type < 0)
  1961. return;
  1962.  
  1963. long long price;
  1964.  
  1965. str_to_number(price, args[5].c_str());
  1966. if (price <= 0)
  1967. return;
  1968. //#ifndef FULL_YANG
  1969. {
  1970. long long nTotalMoney=price;
  1971. SQLMsg * pkMsg(DBManager::instance().DirectQuery("SELECT price from player_shop_items where shop_id='%d'", shop_id));
  1972. SQLResult * pRes = pkMsg->Get();
  1973. if (pRes->uiNumRows>0)
  1974. {
  1975. MYSQL_ROW row;
  1976. while ((row = mysql_fetch_row(pRes->pSQLResult)) != NULL)
  1977. {
  1978. long long temp;
  1979. str_to_number(temp,row[0]);
  1980. nTotalMoney+=temp;
  1981. }
  1982. }
  1983. if (GOLD_MAX <= nTotalMoney)
  1984. {
  1985. //sys_err("[OVERFLOW_GOLD] Overflow (GOLD_MAX) id %u name %s", ch->GetPlayerID(), ch->GetName());
  1986. ch->ChatPacket(CHAT_TYPE_INFO, "Ai depasit limita de yang !");
  1987. return;
  1988. }
  1989. }
  1990. //#endif
  1991. LPITEM item = ch->GetItem(TItemPos(window_type, pos));
  1992. if (item)
  1993. {
  1994. const TItemTable * item_table = item->GetProto();
  1995.  
  1996. if (item_table && (IS_SET(item_table->dwAntiFlags, ITEM_ANTIFLAG_GIVE | ITEM_ANTIFLAG_MYSHOP)))
  1997. {
  1998. ch->ChatPacket(CHAT_TYPE_INFO, "Nu poti (1)");
  1999. return;
  2000. }
  2001.  
  2002. if (item->IsEquipped())
  2003. {
  2004. ch->ChatPacket(CHAT_TYPE_INFO, "Ai armura sau un item echipat ! Nu poti face asta !");
  2005. return;
  2006. }
  2007.  
  2008. if (item->isLocked())
  2009. {
  2010. ch->ChatPacket(CHAT_TYPE_INFO, "Itemul este blocat");
  2011. return;
  2012. }
  2013.  
  2014. if (item->GetTransmutation() != 0)
  2015. {
  2016. ch->ChatPacket(CHAT_TYPE_INFO, "Nu poti pune la vanzare un obiect transmutat.");
  2017. return;
  2018. }
  2019.  
  2020.  
  2021. if (item->GetOwner() != ch)
  2022. {
  2023. return;
  2024. }
  2025. #ifdef SOULBIND_SYSTEM
  2026. if (item->IsSoulBind())
  2027. {
  2028. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT( "You can't sell in private shop item with soul bind."));
  2029. return;
  2030. }
  2031. #endif
  2032. char query[1024];
  2033. sprintf(query, "INSERT INTO player_shop_items SET");
  2034. sprintf(query, "%s player_id='%d'", query, ch->GetPlayerID());
  2035. sprintf(query, "%s, shop_id='%d'", query, shop_id);
  2036. sprintf(query, "%s, vnum='%d'", query, item->GetVnum());
  2037. sprintf(query, "%s, count='%d'", query, item->GetCount());
  2038. sprintf(query, "%s, price='%lld'", query, price);
  2039. // sprintf(query, "%s, look='%d'", query, item->GetItemLook());
  2040.  
  2041. sprintf(query, "%s, display_pos='%u'", query, display_pos);
  2042. for (int s = 0; s < ITEM_SOCKET_MAX_NUM; s++)
  2043. {
  2044. sprintf(query, "%s, socket%d='%ld'", query, s, item->GetSocket(s));
  2045.  
  2046. }
  2047.  
  2048. for (int ia = 0; ia < ITEM_ATTRIBUTE_MAX_NUM; ia++)
  2049. {
  2050. const TPlayerItemAttribute& attr = item->GetAttribute(ia);
  2051. if (ia < 7)
  2052. {
  2053. sprintf(query, "%s, attrtype%d='%u'", query, ia, attr.bType);
  2054. sprintf(query, "%s, attrvalue%d='%d'", query, ia, attr.sValue);
  2055. }
  2056. else
  2057. {
  2058. sprintf(query, "%s, applytype%d='%u'", query, ia-7, attr.bType);
  2059. sprintf(query, "%s, applyvalue%d='%d'", query, ia-7, attr.sValue);
  2060. }
  2061. }
  2062.  
  2063. DBManager::instance().DirectQuery(query);
  2064. ITEM_MANAGER::Instance().RemoveItem(item, "Priv shop");
  2065. DBManager::instance().DirectQuery("UPDATE player_shop SET item_count=item_count +1 WHERE id = %d", shop_id);
  2066. }
  2067. else
  2068. return;
  2069.  
  2070.  
  2071.  
  2072. }
  2073. else
  2074. return;
  2075. ch->LoadPrivShops();
  2076. char buf[32];
  2077. sprintf(buf, "refresh_shop_items %d", shop_id);
  2078. interpret_command(ch, buf, strlen(buf));
  2079. CharacterVectorInteractor i;
  2080. if (CHARACTER_MANAGER::instance().GetCharactersByRaceNum(30000, i))
  2081. {
  2082. CharacterVectorInteractor::iterator it = i.begin();
  2083. while (it != i.end()) {
  2084. LPCHARACTER pc = *it++;
  2085. if (pc)
  2086. if (pc->GetRaceNum() == 30000 && pc->GetPrivShop() == shop_id) {
  2087. pc->UpdateShopItems();
  2088. return;
  2089. }
  2090.  
  2091.  
  2092. }
  2093. }
  2094.  
  2095. TPacketShopUpdateItem packet;
  2096. packet.shop_id = shop_id;
  2097. packet.shop_locked = false;
  2098. db_clientdesc->DBPacket(HEADER_GD_SHOP_UPDATE_ITEM, 0, &packet, sizeof(packet));
  2099. }
  2100. }
  2101.  
  2102. ACMD(do_shop_refresh_items)
  2103. {
  2104. if (ch->IsObserverMode() || ch->GetExchange() || ch->IsOpenSafebox() || ch->GetShopOwner() || ch->IsCubeOpen() || ch->GetMyShop())
  2105. {
  2106.  
  2107. ch->ChatPacket(CHAT_TYPE_COMMAND, "shop_item_clear");
  2108. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("You can't edit shop while you have opened normal shop."));
  2109. return;
  2110. }
  2111.  
  2112. DWORD id;
  2113. char arg1[256];
  2114. one_argument(argument, arg1, sizeof(arg1));
  2115. if (!*arg1)
  2116. return;
  2117. str_to_number(id, arg1);
  2118. char szSockets[1024] = { '\0' };
  2119. char *tempSockets = szSockets;
  2120. for (int i = 0; i < ITEM_SOCKET_MAX_NUM; i++)
  2121. {
  2122. tempSockets += sprintf(tempSockets, "socket%d", i);
  2123.  
  2124. if (i<ITEM_SOCKET_MAX_NUM - 1)
  2125. tempSockets += sprintf(tempSockets, ",");
  2126. }
  2127. char szAttrs[1024] = { '\0' };
  2128. char *tempAttrs = szAttrs;
  2129. for (int i = 0; i < ITEM_ATTRIBUTE_MAX_NUM; i++)
  2130. {
  2131. if (i < 7)
  2132. tempAttrs += sprintf(tempAttrs, "attrtype%d,attrvalue%d", i, i);
  2133. else
  2134. tempAttrs += sprintf(tempAttrs, "applytype%d,applyvalue%d", i - 7, i - 7);
  2135. if (i<ITEM_ATTRIBUTE_MAX_NUM - 1)
  2136. tempAttrs += sprintf(tempAttrs, ",");
  2137. }
  2138. SQLMsg * pkMsg(DBManager::instance().DirectQuery("SELECT id,vnum,count,display_pos,price,%s,%s from player_shop_items where shop_id='%d'", szSockets,szAttrs,id));
  2139.  
  2140. SQLResult * pRes = pkMsg->Get();
  2141. BYTE bItemCount = pRes->uiNumRows;
  2142. std::vector<TShopItemTable *> map_shop;
  2143. ch->ChatPacket(CHAT_TYPE_COMMAND, "shop_item_clear");
  2144. if (bItemCount>0)
  2145. {
  2146. bItemCount = 0;
  2147. MYSQL_ROW row;
  2148. int c = 0;
  2149. while ((row = mysql_fetch_row(pRes->pSQLResult)) != NULL)
  2150. {
  2151. int col = 5;
  2152. char attrs[1024] = { '\0' };
  2153. char sockets[1024] = { '\0' };
  2154. for (int i = 0; i<ITEM_SOCKET_MAX_NUM; i++)
  2155. sprintf(sockets, "%s%s%s", sockets, row[col++], (i<ITEM_SOCKET_MAX_NUM-1 ? "|" : ""));
  2156. //col--;
  2157.  
  2158. for (int i = 0; i<ITEM_ATTRIBUTE_MAX_NUM; i++)
  2159. sprintf(attrs, "%s%s,%s%s", attrs, row[col++], row[col++], (i<ITEM_ATTRIBUTE_MAX_NUM-1 ? "|" : ""));
  2160. ch->ChatPacket(CHAT_TYPE_COMMAND, "shop_item %s#%s#%s#%s#%s#%s#%s", row[0], row[1], row[2], row[3], row[4], sockets, attrs);
  2161. }
  2162. }
  2163.  
  2164. }
  2165. ACMD(do_shop_update)
  2166. {
  2167. if (ch->IsObserverMode() || ch->GetExchange())
  2168. return;
  2169.  
  2170. DWORD id;
  2171. char arg1[256];
  2172. one_argument(argument, arg1, sizeof(arg1));
  2173. if (!*arg1)
  2174. return;
  2175. str_to_number(id, arg1);
  2176. if (*arg1)
  2177. {
  2178. SQLMsg * pkMsg(DBManager::instance().DirectQuery("SELECT player_id from player_shop WHERE id = %d", id));
  2179. SQLResult * pRes = pkMsg->Get();
  2180. if (pRes->uiNumRows>0)
  2181. {
  2182. ch->ChatPacket(CHAT_TYPE_INFO, "Shop %s has been updated", arg1);
  2183. CharacterVectorInteractor i;
  2184. if (CHARACTER_MANAGER::instance().GetCharactersByRaceNum(30000, i))
  2185. {
  2186. CharacterVectorInteractor::iterator it = i.begin();
  2187.  
  2188. while (it != i.end()) {
  2189. LPCHARACTER pc = *it++;
  2190. if (pc)
  2191. if (pc->GetRaceNum() == 30000 && pc->GetPrivShop() == id) {
  2192. pc->UpdateShopItems();
  2193. return;
  2194. }
  2195.  
  2196.  
  2197. }
  2198. }
  2199. TPacketShopUpdateItem packet;
  2200. packet.shop_id = id;
  2201. db_clientdesc->DBPacket(HEADER_GD_SHOP_UPDATE_ITEM, 0, &packet, sizeof(packet));
  2202. }
  2203. else
  2204. ch->ChatPacket(CHAT_TYPE_INFO, "Shop %s does exists", arg1);
  2205. }
  2206. }
  2207. ACMD(do_shop_delete)
  2208. {
  2209. if (ch->IsObserverMode() || ch->GetExchange())
  2210. return;
  2211. char arg1[256];
  2212. char arg2[256];
  2213. two_arguments(argument, arg1, sizeof(arg1), arg2, sizeof(arg2));
  2214. if (!*arg1 || !*arg2)
  2215. {
  2216. ch->ChatPacket(CHAT_TYPE_INFO, "Usage:");
  2217. ch->ChatPacket(CHAT_TYPE_INFO, "/delete_shop <type> <arg> ");
  2218. ch->ChatPacket(CHAT_TYPE_INFO, "Types:");
  2219. ch->ChatPacket(CHAT_TYPE_INFO, " shopid - Delete shop using ID");
  2220. ch->ChatPacket(CHAT_TYPE_INFO, " player - Delete all player shops by player name");
  2221. ch->ChatPacket(CHAT_TYPE_INFO, "Example:");
  2222. ch->ChatPacket(CHAT_TYPE_INFO, " /delete_shop player Best4ever");
  2223. ch->ChatPacket(CHAT_TYPE_INFO, " /delete_shop shopid 1");
  2224. return;
  2225. }
  2226. if (!strcmp(arg1, "player"))
  2227. {
  2228. SQLMsg * pkMsg(DBManager::instance().DirectQuery("SELECT id from player_shop WHERE player_id=(select id from player where name='%s')", arg2));
  2229. SQLResult * pRes = pkMsg->Get();
  2230. if (pRes->uiNumRows>0)
  2231. {
  2232. MYSQL_ROW row;
  2233. while ((row = mysql_fetch_row(pRes->pSQLResult)) != NULL)
  2234. {
  2235. DWORD id;
  2236. str_to_number(id, row[0]);
  2237. DeleteShop(id);
  2238. }
  2239. }
  2240. else
  2241. ch->ChatPacket(CHAT_TYPE_INFO, "Player %s does have any shop", arg2);
  2242. }
  2243. if (!strcmp(arg1, "shopid"))
  2244. {
  2245. SQLMsg * pkMsg(DBManager::instance().DirectQuery("SELECT id from player_shop WHERE id='%s'", arg2));
  2246. SQLResult * pRes = pkMsg->Get();
  2247. if (pRes->uiNumRows>0)
  2248. {
  2249. MYSQL_ROW row;
  2250. while ((row = mysql_fetch_row(pRes->pSQLResult)) != NULL)
  2251. {
  2252. DWORD id;
  2253. str_to_number(id, arg2);
  2254. DeleteShop(id);
  2255. }
  2256. }
  2257. else
  2258. ch->ChatPacket(CHAT_TYPE_INFO, "Shop %s does exists", arg2);
  2259. }
  2260. }
  2261.  
  2262. ACMD(do_open_shop)
  2263. {
  2264. ch->ChatPacket(CHAT_TYPE_COMMAND, "OpenPrivateShop");
  2265. }
  2266. #else
  2267.  
  2268. ACMD(do_close_shop)
  2269. {
  2270. if (ch->IsObserverMode())
  2271. return;
  2272. if (ch->GetMyShop())
  2273. {
  2274. ch->CloseMyShop();
  2275. return;
  2276. }
  2277. }
  2278.  
  2279. #endif
  2280.  
  2281. #ifdef NEW_PET_SYSTEM
  2282. ACMD(do_CubePetAdd) {
  2283.  
  2284. int pos = 0;
  2285. int invpos = 0;
  2286.  
  2287. const char *line;
  2288. char arg1[256], arg2[256], arg3[256];
  2289.  
  2290. line = two_arguments(argument, arg1, sizeof(arg1), arg2, sizeof(arg2));
  2291. one_argument(line, arg3, sizeof(arg3));
  2292.  
  2293. if (0 == arg1[0])
  2294. return;
  2295. const std::string& strArg1 = std::string(arg1);
  2296. switch (LOWER(arg1[0]))
  2297. {
  2298. case 'a': // add cue_index inven_index
  2299. {
  2300. if (0 == arg2[0] || !isdigit(*arg2) ||
  2301. 0 == arg3[0] || !isdigit(*arg3))
  2302. return;
  2303.  
  2304. str_to_number(pos, arg2);
  2305. str_to_number(invpos, arg3);
  2306.  
  2307. }
  2308. break;
  2309.  
  2310. default:
  2311. return;
  2312. }
  2313.  
  2314. if (ch->GetNewPetSystem()->IsActivePet())
  2315. ch->GetNewPetSystem()->SetItemCube(pos, invpos);
  2316. else
  2317. return;
  2318.  
  2319. }
  2320.  
  2321. ACMD(do_PetSkill) {
  2322. char arg1[256];
  2323. one_argument(argument, arg1, sizeof(arg1));
  2324. if (!*arg1)
  2325. return;
  2326.  
  2327. DWORD skillslot = 0;
  2328. str_to_number(skillslot, arg1);
  2329. if (skillslot > 2 || skillslot < 0)
  2330. return;
  2331.  
  2332. if (ch->GetNewPetSystem()->IsActivePet())
  2333. ch->GetNewPetSystem()->DoPetSkill(skillslot);
  2334. else
  2335. ch->ChatPacket(CHAT_TYPE_INFO, "Nu aveti un insotitor chemat");
  2336. }
  2337.  
  2338. ACMD(do_FeedCubePet) {
  2339. char arg1[256];
  2340. one_argument(argument, arg1, sizeof(arg1));
  2341. if (!*arg1)
  2342. return;
  2343.  
  2344. DWORD feedtype = 0;
  2345. str_to_number(feedtype, arg1);
  2346. if (ch->GetNewPetSystem()->IsActivePet())
  2347. ch->GetNewPetSystem()->ItemCubeFeed(feedtype);
  2348. else
  2349. ch->ChatPacket(CHAT_TYPE_INFO, "Nu aveti un insotitor chemat");
  2350. }
  2351.  
  2352. ACMD(do_PetEvo) {
  2353.  
  2354. if (ch->GetExchange() || ch->GetMyShop() || ch->GetShopOwner() || ch->IsOpenSafebox() || ch->IsCubeOpen()) {
  2355. ch->ChatPacket(CHAT_TYPE_INFO, "[Sistem] Nu poti evolua insotitorul cu o fereastra deschisa!");
  2356. return;
  2357. }
  2358. if (ch->GetNewPetSystem()->IsActivePet()) {
  2359.  
  2360. int it[3][3] = {
  2361. {55003, 55001, 27992},
  2362. {55004, 55001, 27993},
  2363. {55005, 55001, 27994}
  2364. };
  2365. int ic[3][3] = {{10, 25, 5},
  2366. {20, 50, 10},
  2367. {30, 100, 20}
  2368. };
  2369. int tmpevo = ch->GetNewPetSystem()->GetEvolution();
  2370.  
  2371. if (ch->GetNewPetSystem()->GetLevel() >= 40 && tmpevo == 0 ||
  2372. ch->GetNewPetSystem()->GetLevel() >= 80 && tmpevo == 1 ||
  2373. ch->GetNewPetSystem()->GetLevel() >= 81 && tmpevo == 2) {
  2374. for (int b = 0; b < 1; b++) {
  2375. if (ch->CountSpecifyItem(it[tmpevo][b]) < ic[tmpevo][b]) {
  2376. ch->ChatPacket(CHAT_TYPE_INFO, "[Sistem] Iteme Necesare:");
  2377. for (int c = 0; c < 1; c++) {
  2378. DWORD vnum = it[tmpevo][c];
  2379. ch->ChatPacket(CHAT_TYPE_INFO, "%s X%d", ITEM_MANAGER::instance().GetTable(vnum)->szLocaleName , ic[tmpevo][c]);
  2380. }
  2381. return;
  2382. }
  2383. }
  2384. for (int c = 0; c < 1; c++) {
  2385. ch->RemoveSpecifyItem(it[tmpevo][c], ic[tmpevo][c]);
  2386. }
  2387. ch->GetNewPetSystem()->IncreasePetEvolution();
  2388.  
  2389. }
  2390. else {
  2391. ch->ChatPacket(CHAT_TYPE_INFO, "Nu poti evolua insotitorul!");
  2392. return;
  2393. }
  2394.  
  2395. }else
  2396. ch->ChatPacket(CHAT_TYPE_INFO, "Nu ai un insotitor chemat!");
  2397.  
  2398. }
  2399.  
  2400. ACMD(do_PetExtraBns) {
  2401. int tmpevo = ch->GetNewPetSystem()->GetEvolution();
  2402. int tmplvl = ch->GetNewPetSystem()->GetLevel();
  2403. if (tmplvl < 50 && tmpevo == 0) {
  2404. ch->ChatPacket(CHAT_TYPE_INFO, "Ai nevoie de nivelul 50 la insotitor");
  2405. ch->ChatPacket(CHAT_TYPE_INFO, "Pentru a primii primul bonus extra");
  2406. ch->ChatPacket(CHAT_TYPE_INFO, "Bonusurile extra vor venii la urmatoarele nivele:");
  2407. ch->ChatPacket(CHAT_TYPE_INFO, "Bonus 1) +10% Tarie impotriva monstrilor (Nivel 50, Evolutia: 1)");
  2408. ch->ChatPacket(CHAT_TYPE_INFO, "Bonus 2) +10% Paguba Abilitatii (Nivel 81, Evolutia 2)");
  2409. ch->ChatPacket(CHAT_TYPE_INFO, "Bonus 3) +10% Tarie impotriva semi-oamenilor (Nivel 81, Evolutia 3)");
  2410. ch->ChatPacket(CHAT_TYPE_INFO, "Bonus 4) +10% Rezistenta la Abilitati (Nivel 120, Evolutia 3)");
  2411. }
  2412.  
  2413. if (tmplvl >= 50 || tmplvl <= 80 && tmpevo == 1) {
  2414. ch->ChatPacket(CHAT_TYPE_INFO, "Bonusuri Extra:");
  2415. ch->ChatPacket(CHAT_TYPE_INFO, "1) +10 Tarie impotriva Monstrilor");
  2416. }
  2417.  
  2418. if (tmplvl >= 81 || tmplvl <= 100 && tmpevo == 2) {
  2419. ch->ChatPacket(CHAT_TYPE_INFO, "2) +10 Paguba Abiliatii");
  2420. }
  2421.  
  2422. if (tmplvl >= 101 || tmplvl <= 119 && tmpevo == 3) {
  2423. ch->ChatPacket(CHAT_TYPE_INFO, "3) +10 Tarie impotriva Semi-Oamenilor");
  2424. }
  2425.  
  2426. if (tmplvl >= 120 && tmpevo == 3) {
  2427. ch->ChatPacket(CHAT_TYPE_INFO, "4) +10 Rezistenta la Abilitati");
  2428. }
  2429. }
  2430.  
  2431. #endif
  2432.  
  2433. ACMD(do_set_walk_mode)
  2434. {
  2435. ch->SetNowWalking(true);
  2436. ch->SetWalking(true);
  2437. }
  2438.  
  2439. ACMD(do_set_run_mode)
  2440. {
  2441. ch->SetNowWalking(false);
  2442. ch->SetWalking(false);
  2443. }
  2444.  
  2445. ACMD(do_channel_switch)
  2446. {
  2447. char arg1[256];
  2448. one_argument(argument, arg1, sizeof(arg1));
  2449. ch->ChatPacket(CHAT_TYPE_INFO, "Ai schimbat canalul pe canal %s ", arg1);
  2450.  
  2451. if (!*arg1)
  2452. return;
  2453.  
  2454. int new_ch;
  2455. str_to_number(new_ch, arg1);
  2456. if( new_ch <1 || new_ch >4) // REPLACE 2 WITH YOUR MAX_CHANNEL
  2457. return;
  2458. if (!ch->IsPC())
  2459. return;
  2460. ch->ChannelSwitch(new_ch);
  2461. }
  2462.  
  2463. ACMD(do_war)
  2464. {
  2465. //³» ±æµå Á¤º¸¸¦ ¾ò¾î¿À°í
  2466. CGuild * g = ch->GetGuild();
  2467.  
  2468. if (!g)
  2469. return;
  2470.  
  2471. //ÀüÀïÁßÀÎÁö üũÇѹø!
  2472. if (g->UnderAnyWar())
  2473. {
  2474. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<±æµå> ÀÌ¹Ì ´Ù¸¥ ÀüÀï¿¡ ÂüÀü Áß ÀÔ´Ï´Ù."));
  2475. return;
  2476. }
  2477.  
  2478. //ÆÄ¶ó¸ÞÅ͸¦ µÎ¹è·Î ³ª´©°í
  2479. char arg1[256], arg2[256];
  2480. DWORD type = GUILD_WAR_TYPE_FIELD; //fixme102 base int modded uint
  2481. two_arguments(argument, arg1, sizeof(arg1), arg2, sizeof(arg2));
  2482.  
  2483. if (!*arg1)
  2484. return;
  2485.  
  2486. if (*arg2)
  2487. {
  2488. str_to_number(type, arg2);
  2489.  
  2490. if (type >= GUILD_WAR_TYPE_MAX_NUM)
  2491. type = GUILD_WAR_TYPE_FIELD;
  2492. }
  2493.  
  2494. //±æµåÀÇ ¸¶½ºÅÍ ¾ÆÀ̵𸦠¾ò¾î¿ÂµÚ
  2495. DWORD gm_pid = g->GetMasterPID();
  2496.  
  2497. //¸¶½ºÅÍÀÎÁö üũ(±æÀüÀº ±æµåÀ常ÀÌ °¡´É)
  2498. if (gm_pid != ch->GetPlayerID())
  2499. {
  2500. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<±æµå> ±æµåÀü¿¡ ´ëÇÑ ±ÇÇÑÀÌ ¾ø½À´Ï´Ù."));
  2501. return;
  2502. }
  2503.  
  2504. //»ó´ë ±æµå¸¦ ¾ò¾î¿À°í
  2505. CGuild * opp_g = CGuildManager::instance().FindGuildByName(arg1);
  2506.  
  2507. if (!opp_g)
  2508. {
  2509. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<±æµå> ±×·± ±æµå°¡ ¾ø½À´Ï´Ù."));
  2510. return;
  2511. }
  2512.  
  2513. //»ó´ë±æµå¿ÍÀÇ »óÅ üũ
  2514. switch (g->GetGuildWarState(opp_g->GetID()))
  2515. {
  2516. case GUILD_WAR_NONE:
  2517. {
  2518. if (opp_g->UnderAnyWar())
  2519. {
  2520. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<±æµå> »ó´ë¹æ ±æµå°¡ ÀÌ¹Ì ÀüÀï Áß ÀÔ´Ï´Ù."));
  2521. return;
  2522. }
  2523.  
  2524. int iWarPrice = KOR_aGuildWarInfo[type].iWarPrice;
  2525.  
  2526. if (g->GetGuildMoney() < iWarPrice)
  2527. {
  2528. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<±æµå> Àüºñ°¡ ºÎÁ·ÇÏ¿© ±æµåÀüÀ» ÇÒ ¼ö ¾ø½À´Ï´Ù."));
  2529. return;
  2530. }
  2531.  
  2532. if (opp_g->GetGuildMoney() < iWarPrice)
  2533. {
  2534. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<±æµå> »ó´ë¹æ ±æµåÀÇ Àüºñ°¡ ºÎÁ·ÇÏ¿© ±æµåÀüÀ» ÇÒ ¼ö ¾ø½À´Ï´Ù."));
  2535. return;
  2536. }
  2537. }
  2538. break;
  2539.  
  2540. case GUILD_WAR_SEND_DECLARE:
  2541. {
  2542. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ÀÌ¹Ì ¼±ÀüÆ÷°í ÁßÀÎ ±æµåÀÔ´Ï´Ù."));
  2543. return;
  2544. }
  2545. break;
  2546.  
  2547. case GUILD_WAR_RECV_DECLARE:
  2548. {
  2549. if (opp_g->UnderAnyWar())
  2550. {
  2551. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<±æµå> »ó´ë¹æ ±æµå°¡ ÀÌ¹Ì ÀüÀï Áß ÀÔ´Ï´Ù."));
  2552. g->RequestRefuseWar(opp_g->GetID());
  2553. return;
  2554. }
  2555. }
  2556. break;
  2557.  
  2558. case GUILD_WAR_RESERVE:
  2559. {
  2560. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<±æµå> ÀÌ¹Ì ÀüÀïÀÌ ¿¹¾àµÈ ±æµå ÀÔ´Ï´Ù."));
  2561. return;
  2562. }
  2563. break;
  2564.  
  2565. case GUILD_WAR_END:
  2566. return;
  2567.  
  2568. default:
  2569. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<±æµå> ÀÌ¹Ì ÀüÀï ÁßÀÎ ±æµåÀÔ´Ï´Ù."));
  2570. g->RequestRefuseWar(opp_g->GetID());
  2571. return;
  2572. }
  2573.  
  2574. if (!g->CanStartWar(type))
  2575. {
  2576. // ±æµåÀüÀ» ÇÒ ¼ö ÀÖ´Â Á¶°ÇÀ» ¸¸Á·ÇÏÁö¾Ê´Â´Ù.
  2577. if (g->GetLadderPoint() == 0)
  2578. {
  2579. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<±æµå> ·¹´õ Á¡¼ö°¡ ¸ðÀÚ¶ó¼­ ±æµåÀüÀ» ÇÒ ¼ö ¾ø½À´Ï´Ù."));
  2580. sys_log(0, "GuildWar.StartError.NEED_LADDER_POINT");
  2581. }
  2582. else if (g->GetMemberCount() < GUILD_WAR_MIN_MEMBER_COUNT)
  2583. {
  2584. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<±æµå> ±æµåÀüÀ» Çϱâ À§Çؼ± ÃÖ¼ÒÇÑ %d¸íÀÌ ÀÖ¾î¾ß ÇÕ´Ï´Ù."), GUILD_WAR_MIN_MEMBER_COUNT);
  2585. sys_log(0, "GuildWar.StartError.NEED_MINIMUM_MEMBER[%d]", GUILD_WAR_MIN_MEMBER_COUNT);
  2586. }
  2587. else
  2588. {
  2589. sys_log(0, "GuildWar.StartError.UNKNOWN_ERROR");
  2590. }
  2591. return;
  2592. }
  2593.  
  2594. // ÇʵåÀü üũ¸¸ ÇÏ°í ¼¼¼¼ÇÑ Ã¼Å©´Â »ó´ë¹æÀÌ ½Â³«ÇÒ¶§ ÇÑ´Ù.
  2595. if (!opp_g->CanStartWar(GUILD_WAR_TYPE_FIELD))
  2596. {
  2597. if (opp_g->GetLadderPoint() == 0)
  2598. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<±æµå> »ó´ë¹æ ±æµåÀÇ ·¹´õ Á¡¼ö°¡ ¸ðÀÚ¶ó¼­ ±æµåÀüÀ» ÇÒ ¼ö ¾ø½À´Ï´Ù."));
  2599. else if (opp_g->GetMemberCount() < GUILD_WAR_MIN_MEMBER_COUNT)
  2600. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<±æµå> »ó´ë¹æ ±æµåÀÇ ±æµå¿ø ¼ö°¡ ºÎÁ·ÇÏ¿© ±æµåÀüÀ» ÇÒ ¼ö ¾ø½À´Ï´Ù."));
  2601. return;
  2602. }
  2603.  
  2604. do
  2605. {
  2606. if (g->GetMasterCharacter() != NULL)
  2607. break;
  2608.  
  2609. CCI *pCCI = P2P_MANAGER::instance().FindByPID(g->GetMasterPID());
  2610.  
  2611. if (pCCI != NULL)
  2612. break;
  2613.  
  2614. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<±æµå> »ó´ë¹æ ±æµåÀÇ ±æµåÀåÀÌ Á¢¼ÓÁßÀÌ ¾Æ´Õ´Ï´Ù."));
  2615. g->RequestRefuseWar(opp_g->GetID());
  2616. return;
  2617.  
  2618. } while (false);
  2619.  
  2620. do
  2621. {
  2622. if (opp_g->GetMasterCharacter() != NULL)
  2623. break;
  2624.  
  2625. CCI *pCCI = P2P_MANAGER::instance().FindByPID(opp_g->GetMasterPID());
  2626.  
  2627. if (pCCI != NULL)
  2628. break;
  2629.  
  2630. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<±æµå> »ó´ë¹æ ±æµåÀÇ ±æµåÀåÀÌ Á¢¼ÓÁßÀÌ ¾Æ´Õ´Ï´Ù."));
  2631. g->RequestRefuseWar(opp_g->GetID());
  2632. return;
  2633.  
  2634. } while (false);
  2635.  
  2636. g->RequestDeclareWar(opp_g->GetID(), type);
  2637. }
  2638.  
  2639. ACMD(do_nowar)
  2640. {
  2641. CGuild* g = ch->GetGuild();
  2642. if (!g)
  2643. return;
  2644.  
  2645. char arg1[256];
  2646. one_argument(argument, arg1, sizeof(arg1));
  2647.  
  2648. if (!*arg1)
  2649. return;
  2650.  
  2651. DWORD gm_pid = g->GetMasterPID();
  2652.  
  2653. if (gm_pid != ch->GetPlayerID())
  2654. {
  2655. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<±æµå> ±æµåÀü¿¡ ´ëÇÑ ±ÇÇÑÀÌ ¾ø½À´Ï´Ù."));
  2656. return;
  2657. }
  2658.  
  2659. CGuild* opp_g = CGuildManager::instance().FindGuildByName(arg1);
  2660.  
  2661. if (!opp_g)
  2662. {
  2663. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<±æµå> ±×·± ±æµå°¡ ¾ø½À´Ï´Ù."));
  2664. return;
  2665. }
  2666.  
  2667. g->RequestRefuseWar(opp_g->GetID());
  2668. }
  2669.  
  2670. ACMD(do_detaillog)
  2671. {
  2672. ch->DetailLog();
  2673. }
  2674.  
  2675. ACMD(do_monsterlog)
  2676. {
  2677. ch->ToggleMonsterLog();
  2678. }
  2679.  
  2680. ACMD(do_pkmode)
  2681. {
  2682. char arg1[256];
  2683. one_argument(argument, arg1, sizeof(arg1));
  2684.  
  2685. if (!*arg1)
  2686. return;
  2687.  
  2688. BYTE mode = 0;
  2689. str_to_number(mode, arg1);
  2690.  
  2691. if (mode == PK_MODE_PROTECT)
  2692. return;
  2693.  
  2694. #ifdef __ENABLE_BATTLE_FIELD__
  2695. if (CBattleZone::instance().IsBattleZoneMapIndex(ch->GetMapIndex()))
  2696. return;
  2697. #endif
  2698.  
  2699. if (ch->GetLevel() < PK_PROTECT_LEVEL && mode != 0)
  2700. return;
  2701.  
  2702. ch->SetPKMode(mode);
  2703. }
  2704.  
  2705. ACMD(do_messenger_auth)
  2706. {
  2707. if (ch->GetArena())
  2708. {
  2709. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("´ë·ÃÀå¿¡¼­ »ç¿ëÇÏ½Ç ¼ö ¾ø½À´Ï´Ù."));
  2710. return;
  2711. }
  2712.  
  2713. char arg1[256], arg2[256];
  2714. two_arguments(argument, arg1, sizeof(arg1), arg2, sizeof(arg2));
  2715.  
  2716. if (!*arg1 || !*arg2)
  2717. return;
  2718.  
  2719. char answer = LOWER(*arg1);
  2720. // @fixme130 AuthToAdd void -> bool
  2721. bool bIsDenied = answer != 'y';
  2722. bool bIsAdded = MessengerManager::instance().AuthToAdd(ch->GetName(), arg2, bIsDenied); // DENY
  2723. if (bIsAdded && bIsDenied)
  2724. {
  2725. LPCHARACTER tch = CHARACTER_MANAGER::instance().FindPC(arg2);
  2726.  
  2727. if (tch)
  2728. tch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("%s ´ÔÀ¸·Î ºÎÅÍ Ä£±¸ µî·ÏÀ» °ÅºÎ ´çÇß½À´Ï´Ù."), ch->GetName());
  2729. }
  2730.  
  2731. }
  2732.  
  2733. ACMD(do_setblockmode)
  2734. {
  2735. char arg1[256];
  2736. one_argument(argument, arg1, sizeof(arg1));
  2737.  
  2738. if (*arg1)
  2739. {
  2740. BYTE flag = 0;
  2741. str_to_number(flag, arg1);
  2742. ch->SetBlockMode(flag);
  2743. }
  2744. }
  2745.  
  2746. ACMD(do_unmount)
  2747. {
  2748. #ifdef ENABLE_MOUNT_COSTUME_SYSTEM
  2749. if(ch->GetWear(WEAR_COSTUME_MOUNT))
  2750. {
  2751. CMountSystem* mountSystem = ch->GetMountSystem();
  2752. LPITEM mount = ch->GetWear(WEAR_COSTUME_MOUNT);
  2753. DWORD mobVnum = 0;
  2754.  
  2755. if (!mountSystem && !mount)
  2756. return;
  2757.  
  2758. if(mount->GetValue(1) != 0)
  2759. mobVnum = mount->GetValue(1);
  2760.  
  2761. if (ch->GetMountVnum())
  2762. {
  2763. if(mountSystem->CountSummoned() == 0)
  2764. {
  2765. mountSystem->Unmount(mobVnum);
  2766. }
  2767. }
  2768. return;
  2769. }
  2770. #endif
  2771. if (true == ch->UnEquipSpecialRideUniqueItem())
  2772. {
  2773. ch->RemoveAffect(AFFECT_MOUNT);
  2774. ch->RemoveAffect(AFFECT_MOUNT_BONUS);
  2775.  
  2776. if (ch->IsHorseRiding())
  2777. {
  2778. ch->StopRiding();
  2779. }
  2780. }
  2781. else
  2782. {
  2783. ch->ChatPacket( CHAT_TYPE_INFO, LC_TEXT("Àκ¥Å丮°¡ ²Ë Â÷¼­ ³»¸± ¼ö ¾ø½À´Ï´Ù."));
  2784. }
  2785.  
  2786. }
  2787.  
  2788. ACMD(do_observer_exit)
  2789. {
  2790. if (ch->IsObserverMode())
  2791. {
  2792. if (ch->GetWarMap())
  2793. ch->SetWarMap(NULL);
  2794.  
  2795. if (ch->GetArena() != NULL || ch->GetArenaObserverMode() == true)
  2796. {
  2797. ch->SetArenaObserverMode(false);
  2798.  
  2799. if (ch->GetArena() != NULL)
  2800. ch->GetArena()->RemoveObserver(ch->GetPlayerID());
  2801.  
  2802. ch->SetArena(NULL);
  2803. ch->WarpSet(ARENA_RETURN_POINT_X(ch->GetEmpire()), ARENA_RETURN_POINT_Y(ch->GetEmpire()));
  2804. }
  2805. else {
  2806. ch->ExitToSavedLocation();
  2807. }
  2808. ch->SetObserverMode(false);
  2809. }
  2810. }
  2811.  
  2812. ACMD(do_view_equip)
  2813. {
  2814. if (ch->GetGMLevel() <= GM_PLAYER)
  2815. return;
  2816.  
  2817. char arg1[256];
  2818. one_argument(argument, arg1, sizeof(arg1));
  2819.  
  2820. if (*arg1)
  2821. {
  2822. DWORD vid = 0;
  2823. str_to_number(vid, arg1);
  2824. LPCHARACTER tch = CHARACTER_MANAGER::instance().Find(vid);
  2825.  
  2826. if (!tch)
  2827. return;
  2828.  
  2829. if (!tch->IsPC())
  2830. return;
  2831. /*
  2832. int iSPCost = ch->GetMaxSP() / 3;
  2833.  
  2834. if (ch->GetSP() < iSPCost)
  2835. {
  2836. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Á¤½Å·ÂÀÌ ºÎÁ·ÇÏ¿© ´Ù¸¥ »ç¶÷ÀÇ Àåºñ¸¦ º¼ ¼ö ¾ø½À´Ï´Ù."));
  2837. return;
  2838. }
  2839. ch->PointChange(POINT_SP, -iSPCost);
  2840. */
  2841. tch->SendEquipment(ch);
  2842. }
  2843. }
  2844.  
  2845. ACMD(do_party_request)
  2846. {
  2847. if (ch->GetArena())
  2848. {
  2849. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("´ë·ÃÀå¿¡¼­ »ç¿ëÇÏ½Ç ¼ö ¾ø½À´Ï´Ù."));
  2850. return;
  2851. }
  2852.  
  2853. if (ch->GetParty())
  2854. {
  2855. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ÀÌ¹Ì ÆÄƼ¿¡ ¼ÓÇØ ÀÖÀ¸¹Ç·Î °¡ÀÔ½ÅûÀ» ÇÒ ¼ö ¾ø½À´Ï´Ù."));
  2856. return;
  2857. }
  2858.  
  2859. char arg1[256];
  2860. one_argument(argument, arg1, sizeof(arg1));
  2861.  
  2862. if (!*arg1)
  2863. return;
  2864.  
  2865. DWORD vid = 0;
  2866. str_to_number(vid, arg1);
  2867. LPCHARACTER tch = CHARACTER_MANAGER::instance().Find(vid);
  2868.  
  2869. if (tch)
  2870. if (!ch->RequestToParty(tch))
  2871. ch->ChatPacket(CHAT_TYPE_COMMAND, "PartyRequestDenied");
  2872. }
  2873.  
  2874. ACMD(do_party_request_accept)
  2875. {
  2876. char arg1[256];
  2877. one_argument(argument, arg1, sizeof(arg1));
  2878.  
  2879. if (!*arg1)
  2880. return;
  2881.  
  2882. DWORD vid = 0;
  2883. str_to_number(vid, arg1);
  2884. LPCHARACTER tch = CHARACTER_MANAGER::instance().Find(vid);
  2885.  
  2886. if (tch)
  2887. ch->AcceptToParty(tch);
  2888. }
  2889.  
  2890. ACMD(do_party_request_deny)
  2891. {
  2892. char arg1[256];
  2893. one_argument(argument, arg1, sizeof(arg1));
  2894.  
  2895. if (!*arg1)
  2896. return;
  2897.  
  2898. DWORD vid = 0;
  2899. str_to_number(vid, arg1);
  2900. LPCHARACTER tch = CHARACTER_MANAGER::instance().Find(vid);
  2901.  
  2902. if (tch)
  2903. ch->DenyToParty(tch);
  2904. }
  2905.  
  2906. ACMD(do_monarch_warpto)
  2907. {
  2908. if (!CMonarch::instance().IsMonarch(ch->GetPlayerID(), ch->GetEmpire()))
  2909. {
  2910. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("±ºÁÖ¸¸ÀÌ »ç¿ë °¡´ÉÇÑ ±â´ÉÀÔ´Ï´Ù"));
  2911. return;
  2912. }
  2913.  
  2914. //±ºÁÖ ÄðŸÀÓ °Ë»ç
  2915. if (!ch->IsMCOK(CHARACTER::MI_WARP))
  2916. {
  2917. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("%d Ãʰ£ ÄðŸÀÓÀÌ Àû¿ëÁßÀÔ´Ï´Ù."), ch->GetMCLTime(CHARACTER::MI_WARP));
  2918. return;
  2919. }
  2920.  
  2921. //±ºÁÖ ¸÷ ¼Òȯ ºñ¿ë
  2922. const int WarpPrice = 10000;
  2923.  
  2924. //±ºÁÖ ±¹°í °Ë»ç
  2925. if (!CMonarch::instance().IsMoneyOk(WarpPrice, ch->GetEmpire()))
  2926. {
  2927. int NationMoney = CMonarch::instance().GetMoney(ch->GetEmpire());
  2928. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("±¹°í¿¡ µ·ÀÌ ºÎÁ·ÇÕ´Ï´Ù. ÇöÀç : %u ÇÊ¿ä±Ý¾× : %u"), NationMoney, WarpPrice);
  2929. return;
  2930. }
  2931.  
  2932. int x = 0, y = 0;
  2933. char arg1[256];
  2934.  
  2935. one_argument(argument, arg1, sizeof(arg1));
  2936.  
  2937. if (!*arg1)
  2938. {
  2939. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("»ç¿ë¹ý: warpto <character name>"));
  2940. return;
  2941. }
  2942.  
  2943. LPCHARACTER tch = CHARACTER_MANAGER::instance().FindPC(arg1);
  2944.  
  2945. if (!tch)
  2946. {
  2947. CCI * pkCCI = P2P_MANAGER::instance().Find(arg1);
  2948.  
  2949. if (pkCCI)
  2950. {
  2951. if (pkCCI->bEmpire != ch->GetEmpire())
  2952. {
  2953. ch->ChatPacket (CHAT_TYPE_INFO, LC_TEXT("ŸÁ¦±¹ À¯Àú¿¡°Ô´Â À̵¿ÇÒ¼ö ¾ø½À´Ï´Ù"));
  2954. return;
  2955. }
  2956.  
  2957. if (pkCCI->bChannel != g_bChannel)
  2958. {
  2959. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ÇØ´ç À¯Àú´Â %d ä³Î¿¡ ÀÖ½À´Ï´Ù. (ÇöÀç ä³Î %d)"), pkCCI->bChannel, g_bChannel);
  2960. return;
  2961. }
  2962. if (!IsMonarchWarpZone(pkCCI->lMapIndex))
  2963. {
  2964. ch->ChatPacket (CHAT_TYPE_INFO, LC_TEXT("ÇØ´ç Áö¿ªÀ¸·Î À̵¿ÇÒ ¼ö ¾ø½À´Ï´Ù."));
  2965. return;
  2966. }
  2967.  
  2968. PIXEL_POSITION pos;
  2969.  
  2970. if (!SECTREE_MANAGER::instance().GetCenterPositionOfMap(pkCCI->lMapIndex, pos))
  2971. ch->ChatPacket(CHAT_TYPE_INFO, "Cannot find map (index %d)", pkCCI->lMapIndex);
  2972. else
  2973. {
  2974. //ch->ChatPacket(CHAT_TYPE_INFO, "You warp to (%d, %d)", pos.x, pos.y);
  2975. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("%s ¿¡°Ô·Î À̵¿ÇÕ´Ï´Ù"), arg1);
  2976. ch->WarpSet(pos.x, pos.y);
  2977.  
  2978. //±ºÁÖ µ· »è°¨
  2979. CMonarch::instance().SendtoDBDecMoney(WarpPrice, ch->GetEmpire(), ch);
  2980.  
  2981. //ÄðŸÀÓ ÃʱâÈ­
  2982. ch->SetMC(CHARACTER::MI_WARP);
  2983. }
  2984. }
  2985. else if (NULL == CHARACTER_MANAGER::instance().FindPC(arg1))
  2986. {
  2987. ch->ChatPacket(CHAT_TYPE_INFO, "There is no one by that name");
  2988. }
  2989.  
  2990. return;
  2991. }
  2992. else
  2993. {
  2994. if (tch->GetEmpire() != ch->GetEmpire())
  2995. {
  2996. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ŸÁ¦±¹ À¯Àú¿¡°Ô´Â À̵¿ÇÒ¼ö ¾ø½À´Ï´Ù"));
  2997. return;
  2998. }
  2999. if (!IsMonarchWarpZone(tch->GetMapIndex()))
  3000. {
  3001. ch->ChatPacket (CHAT_TYPE_INFO, LC_TEXT("ÇØ´ç Áö¿ªÀ¸·Î À̵¿ÇÒ ¼ö ¾ø½À´Ï´Ù."));
  3002. return;
  3003. }
  3004. x = tch->GetX();
  3005. y = tch->GetY();
  3006. }
  3007.  
  3008. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("%s ¿¡°Ô·Î À̵¿ÇÕ´Ï´Ù"), arg1);
  3009. ch->WarpSet(x, y);
  3010. ch->Stop();
  3011.  
  3012. //±ºÁÖ µ· »è°¨
  3013. CMonarch::instance().SendtoDBDecMoney(WarpPrice, ch->GetEmpire(), ch);
  3014.  
  3015. //ÄðŸÀÓ ÃʱâÈ­
  3016. ch->SetMC(CHARACTER::MI_WARP);
  3017. }
  3018.  
  3019. ACMD(do_monarch_transfer)
  3020. {
  3021. char arg1[256];
  3022. one_argument(argument, arg1, sizeof(arg1));
  3023.  
  3024. if (!*arg1)
  3025. {
  3026. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("»ç¿ë¹ý: transfer <name>"));
  3027. return;
  3028. }
  3029.  
  3030. if (!CMonarch::instance().IsMonarch(ch->GetPlayerID(), ch->GetEmpire()))
  3031. {
  3032. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("±ºÁÖ¸¸ÀÌ »ç¿ë °¡´ÉÇÑ ±â´ÉÀÔ´Ï´Ù"));
  3033. return;
  3034. }
  3035.  
  3036. //±ºÁÖ ÄðŸÀÓ °Ë»ç
  3037. if (!ch->IsMCOK(CHARACTER::MI_TRANSFER))
  3038. {
  3039. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("%d Ãʰ£ ÄðŸÀÓÀÌ Àû¿ëÁßÀÔ´Ï´Ù."), ch->GetMCLTime(CHARACTER::MI_TRANSFER));
  3040. return;
  3041. }
  3042.  
  3043. //±ºÁÖ ¿öÇÁ ºñ¿ë
  3044. const int WarpPrice = 10000;
  3045.  
  3046. //±ºÁÖ ±¹°í °Ë»ç
  3047. if (!CMonarch::instance().IsMoneyOk(WarpPrice, ch->GetEmpire()))
  3048. {
  3049. int NationMoney = CMonarch::instance().GetMoney(ch->GetEmpire());
  3050. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("±¹°í¿¡ µ·ÀÌ ºÎÁ·ÇÕ´Ï´Ù. ÇöÀç : %u ÇÊ¿ä±Ý¾× : %u"), NationMoney, WarpPrice);
  3051. return;
  3052. }
  3053.  
  3054.  
  3055. LPCHARACTER tch = CHARACTER_MANAGER::instance().FindPC(arg1);
  3056.  
  3057. if (!tch)
  3058. {
  3059. CCI * pkCCI = P2P_MANAGER::instance().Find(arg1);
  3060.  
  3061. if (pkCCI)
  3062. {
  3063. if (pkCCI->bEmpire != ch->GetEmpire())
  3064. {
  3065. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("´Ù¸¥ Á¦±¹ À¯Àú´Â ¼ÒȯÇÒ ¼ö ¾ø½À´Ï´Ù."));
  3066. return;
  3067. }
  3068. if (pkCCI->bChannel != g_bChannel)
  3069. {
  3070. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("%s ´ÔÀº %d ä³Î¿¡ Á¢¼Ó Áß ÀÔ´Ï´Ù. (ÇöÀç ä³Î: %d)"), arg1, pkCCI->bChannel, g_bChannel);
  3071. return;
  3072. }
  3073. if (!IsMonarchWarpZone(pkCCI->lMapIndex))
  3074. {
  3075. ch->ChatPacket (CHAT_TYPE_INFO, LC_TEXT("ÇØ´ç Áö¿ªÀ¸·Î À̵¿ÇÒ ¼ö ¾ø½À´Ï´Ù."));
  3076. return;
  3077. }
  3078. if (!IsMonarchWarpZone(ch->GetMapIndex()))
  3079. {
  3080. ch->ChatPacket (CHAT_TYPE_INFO, LC_TEXT("ÇØ´ç Áö¿ªÀ¸·Î ¼ÒȯÇÒ ¼ö ¾ø½À´Ï´Ù."));
  3081. return;
  3082. }
  3083.  
  3084. TPacketGGTransfer pgg;
  3085.  
  3086. pgg.bHeader = HEADER_GG_TRANSFER;
  3087. strlcpy(pgg.szName, arg1, sizeof(pgg.szName));
  3088. pgg.lX = ch->GetX();
  3089. pgg.lY = ch->GetY();
  3090.  
  3091. P2P_MANAGER::instance().Send(&pgg, sizeof(TPacketGGTransfer));
  3092. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("%s ´ÔÀ» ¼ÒȯÇÏ¿´½À´Ï´Ù."), arg1);
  3093.  
  3094. //±ºÁÖ µ· »è°¨
  3095. CMonarch::instance().SendtoDBDecMoney(WarpPrice, ch->GetEmpire(), ch);
  3096. //ÄðŸÀÓ ÃʱâÈ­
  3097. ch->SetMC(CHARACTER::MI_TRANSFER);
  3098. }
  3099. else
  3100. {
  3101. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ÀÔ·ÂÇϽŠÀ̸§À» °¡Áø »ç¿ëÀÚ°¡ ¾ø½À´Ï´Ù."));
  3102. }
  3103.  
  3104. return;
  3105. }
  3106.  
  3107.  
  3108. if (ch == tch)
  3109. {
  3110. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ÀÚ½ÅÀ» ¼ÒȯÇÒ ¼ö ¾ø½À´Ï´Ù."));
  3111. return;
  3112. }
  3113.  
  3114. if (tch->GetEmpire() != ch->GetEmpire())
  3115. {
  3116. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("´Ù¸¥ Á¦±¹ À¯Àú´Â ¼ÒȯÇÒ ¼ö ¾ø½À´Ï´Ù."));
  3117. return;
  3118. }
  3119. if (!IsMonarchWarpZone(tch->GetMapIndex()))
  3120. {
  3121. ch->ChatPacket (CHAT_TYPE_INFO, LC_TEXT("ÇØ´ç Áö¿ªÀ¸·Î À̵¿ÇÒ ¼ö ¾ø½À´Ï´Ù."));
  3122. return;
  3123. }
  3124. if (!IsMonarchWarpZone(ch->GetMapIndex()))
  3125. {
  3126. ch->ChatPacket (CHAT_TYPE_INFO, LC_TEXT("ÇØ´ç Áö¿ªÀ¸·Î ¼ÒȯÇÒ ¼ö ¾ø½À´Ï´Ù."));
  3127. return;
  3128. }
  3129.  
  3130. //tch->Show(ch->GetMapIndex(), ch->GetX(), ch->GetY(), ch->GetZ());
  3131. tch->WarpSet(ch->GetX(), ch->GetY(), ch->GetMapIndex());
  3132.  
  3133. //±ºÁÖ µ· »è°¨
  3134. CMonarch::instance().SendtoDBDecMoney(WarpPrice, ch->GetEmpire(), ch);
  3135. //ÄðŸÀÓ ÃʱâÈ­
  3136. ch->SetMC(CHARACTER::MI_TRANSFER);
  3137. }
  3138.  
  3139. ACMD(do_monarch_info)
  3140. {
  3141. if (CMonarch::instance().IsMonarch(ch->GetPlayerID(), ch->GetEmpire()))
  3142. {
  3143. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("³ªÀÇ ±ºÁÖ Á¤º¸"));
  3144. TMonarchInfo * p = CMonarch::instance().GetMonarch();
  3145. for (int n = 1; n < 4; ++n)
  3146. {
  3147. if (n == ch->GetEmpire())
  3148. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("[%s±ºÁÖ] : %s º¸À¯±Ý¾× %lld "), EMPIRE_NAME(n), p->name[n], p->money[n]);
  3149. else
  3150. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("[%s±ºÁÖ] : %s "), EMPIRE_NAME(n), p->name[n]);
  3151.  
  3152. }
  3153. }
  3154. else
  3155. {
  3156. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("±ºÁÖ Á¤º¸"));
  3157. TMonarchInfo * p = CMonarch::instance().GetMonarch();
  3158. for (int n = 1; n < 4; ++n)
  3159. {
  3160. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("[%s±ºÁÖ] : %s "), EMPIRE_NAME(n), p->name[n]);
  3161.  
  3162. }
  3163. }
  3164.  
  3165. }
  3166.  
  3167. ACMD(do_elect)
  3168. {
  3169. db_clientdesc->DBPacketHeader(HEADER_GD_COME_TO_VOTE, ch->GetDesc()->GetHandle(), 0);
  3170. }
  3171.  
  3172. // LUA_ADD_GOTO_INFO
  3173. struct GotoInfo
  3174. {
  3175. std::string st_name;
  3176.  
  3177. BYTE empire;
  3178. int mapIndex;
  3179. DWORD x, y;
  3180.  
  3181. GotoInfo()
  3182. {
  3183. st_name = "";
  3184. empire = 0;
  3185. mapIndex = 0;
  3186.  
  3187. x = 0;
  3188. y = 0;
  3189. }
  3190.  
  3191. GotoInfo(const GotoInfo& c_src)
  3192. {
  3193. __copy__(c_src);
  3194. }
  3195.  
  3196. void operator = (const GotoInfo& c_src)
  3197. {
  3198. __copy__(c_src);
  3199. }
  3200.  
  3201. void __copy__(const GotoInfo& c_src)
  3202. {
  3203. st_name = c_src.st_name;
  3204. empire = c_src.empire;
  3205. mapIndex = c_src.mapIndex;
  3206.  
  3207. x = c_src.x;
  3208. y = c_src.y;
  3209. }
  3210. };
  3211.  
  3212. ACMD(do_monarch_tax)
  3213. {
  3214. char arg1[256];
  3215. one_argument(argument, arg1, sizeof(arg1));
  3216.  
  3217. if (!*arg1)
  3218. {
  3219. ch->ChatPacket(CHAT_TYPE_INFO, "Usage: monarch_tax <1-50>");
  3220. return;
  3221. }
  3222.  
  3223. // ±ºÁÖ °Ë»ç
  3224. if (!ch->IsMonarch())
  3225. {
  3226. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("±ºÁÖ¸¸ÀÌ »ç¿ëÇÒ¼ö ÀÖ´Â ±â´ÉÀÔ´Ï´Ù"));
  3227. return;
  3228. }
  3229.  
  3230. // ¼¼±Ý¼³Á¤
  3231. int tax = 0;
  3232. str_to_number(tax, arg1);
  3233.  
  3234. if (tax < 1 || tax > 50)
  3235. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("1-50 »çÀÌÀÇ ¼öÄ¡¸¦ ¼±ÅÃÇØÁÖ¼¼¿ä"));
  3236.  
  3237. quest::CQuestManager::instance().SetEventFlag("trade_tax", tax);
  3238.  
  3239. // ±ºÁÖ¿¡°Ô ¸Þ¼¼Áö Çϳª
  3240. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¼¼±ÝÀÌ %d %·Î ¼³Á¤µÇ¾ú½À´Ï´Ù"));
  3241.  
  3242. // °øÁö
  3243. char szMsg[1024];
  3244.  
  3245. snprintf(szMsg, sizeof(szMsg), "±ºÁÖÀÇ ¸íÀ¸·Î ¼¼±ÝÀÌ %d %% ·Î º¯°æµÇ¾ú½À´Ï´Ù", tax);
  3246. BroadcastNotice(szMsg);
  3247.  
  3248. snprintf(szMsg, sizeof(szMsg), "¾ÕÀ¸·Î´Â °Å·¡ ±Ý¾×ÀÇ %d %% °¡ ±¹°í·Î µé¾î°¡°ÔµË´Ï´Ù.", tax);
  3249. BroadcastNotice(szMsg);
  3250.  
  3251. // ÄðŸÀÓ ÃʱâÈ­
  3252. ch->SetMC(CHARACTER::MI_TAX);
  3253. }
  3254.  
  3255. static const DWORD cs_dwMonarchMobVnums[] =
  3256. {
  3257. 191, // »ê°ß½Å
  3258. 192, // Àú½Å
  3259. 193, // ¿õ½Å
  3260. 194, // È£½Å
  3261. 391, // ¹ÌÁ¤
  3262. 392, // ÀºÁ¤
  3263. 393, // ¼¼¶û
  3264. 394, // ÁøÈñ
  3265. 491, // ¸Íȯ
  3266. 492, // º¸¿ì
  3267. 493, // ±¸ÆÐ
  3268. 494, // ÃßÈç
  3269. 591, // ºñ·ù´Ü´ëÀå
  3270. 691, // ¿õ±Í Á·Àå
  3271. 791, // ¹Ð±³±³ÁÖ
  3272. 1304, // ´©··¹ü±Í
  3273. 1901, // ±¸¹ÌÈ£
  3274. 2091, // ¿©¿Õ°Å¹Ì
  3275. 2191, // °Å´ë»ç¸·°ÅºÏ
  3276. 2206, // È­¿°¿Õi
  3277. 0,
  3278. };
  3279.  
  3280. ACMD(do_monarch_mob)
  3281. {
  3282. char arg1[256];
  3283. LPCHARACTER tch;
  3284.  
  3285. one_argument(argument, arg1, sizeof(arg1));
  3286.  
  3287. if (!ch->IsMonarch())
  3288. {
  3289. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("±ºÁÖ¸¸ÀÌ »ç¿ëÇÒ¼ö ÀÖ´Â ±â´ÉÀÔ´Ï´Ù"));
  3290. return;
  3291. }
  3292.  
  3293. if (!*arg1)
  3294. {
  3295. ch->ChatPacket(CHAT_TYPE_INFO, "Usage: mmob <mob name>");
  3296. return;
  3297. }
  3298.  
  3299. #ifdef ENABLE_MONARCH_MOB_CMD_MAP_CHECK // @warme006
  3300. BYTE pcEmpire = ch->GetEmpire();
  3301. BYTE mapEmpire = SECTREE_MANAGER::instance().GetEmpireFromMapIndex(ch->GetMapIndex());
  3302. if (mapEmpire != pcEmpire && mapEmpire != 0)
  3303. {
  3304. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ÀÚ±¹ ¿µÅä¿¡¼­¸¸ »ç¿ëÇÒ ¼ö ÀÖ´Â ±â´ÉÀÔ´Ï´Ù"));
  3305. return;
  3306. }
  3307. #endif
  3308.  
  3309. // ±ºÁÖ ¸÷ ¼Òȯ ºñ¿ë
  3310. const int SummonPrice = 5000000;
  3311.  
  3312. // ±ºÁÖ ÄðŸÀÓ °Ë»ç
  3313. if (!ch->IsMCOK(CHARACTER::MI_SUMMON))
  3314. {
  3315. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("%d Ãʰ£ ÄðŸÀÓÀÌ Àû¿ëÁßÀÔ´Ï´Ù."), ch->GetMCLTime(CHARACTER::MI_SUMMON));
  3316. return;
  3317. }
  3318.  
  3319. // ±ºÁÖ ±¹°í °Ë»ç
  3320. if (!CMonarch::instance().IsMoneyOk(SummonPrice, ch->GetEmpire()))
  3321. {
  3322. int NationMoney = CMonarch::instance().GetMoney(ch->GetEmpire());
  3323. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("±¹°í¿¡ µ·ÀÌ ºÎÁ·ÇÕ´Ï´Ù. ÇöÀç : %u ÇÊ¿ä±Ý¾× : %u"), NationMoney, SummonPrice);
  3324. return;
  3325. }
  3326.  
  3327. const CMob * pkMob;
  3328. DWORD vnum = 0;
  3329.  
  3330. if (isdigit(*arg1))
  3331. {
  3332. str_to_number(vnum, arg1);
  3333.  
  3334. if ((pkMob = CMobManager::instance().Get(vnum)) == NULL)
  3335. vnum = 0;
  3336. }
  3337. else
  3338. {
  3339. pkMob = CMobManager::Instance().Get(arg1, true);
  3340.  
  3341. if (pkMob)
  3342. vnum = pkMob->m_table.dwVnum;
  3343. }
  3344.  
  3345. DWORD count;
  3346.  
  3347. // ¼Òȯ °¡´É ¸÷ °Ë»ç
  3348. for (count = 0; cs_dwMonarchMobVnums[count] != 0; ++count)
  3349. if (cs_dwMonarchMobVnums[count] == vnum)
  3350. break;
  3351.  
  3352. if (0 == cs_dwMonarchMobVnums[count])
  3353. {
  3354. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¼ÒȯÇÒ¼ö ¾ø´Â ¸ó½ºÅÍ ÀÔ´Ï´Ù. ¼Òȯ°¡´ÉÇÑ ¸ó½ºÅʹ ȨÆäÀÌÁö¸¦ ÂüÁ¶Çϼ¼¿ä"));
  3355. return;
  3356. }
  3357.  
  3358. tch = CHARACTER_MANAGER::instance().SpawnMobRange(vnum,
  3359. ch->GetMapIndex(),
  3360. ch->GetX() - number(200, 750),
  3361. ch->GetY() - number(200, 750),
  3362. ch->GetX() + number(200, 750),
  3363. ch->GetY() + number(200, 750),
  3364. true,
  3365. pkMob->m_table.bType == CHAR_TYPE_STONE,
  3366. true);
  3367.  
  3368. if (tch)
  3369. {
  3370. // ±ºÁÖ µ· »è°¨
  3371. CMonarch::instance().SendtoDBDecMoney(SummonPrice, ch->GetEmpire(), ch);
  3372.  
  3373. // ÄðŸÀÓ ÃʱâÈ­
  3374. ch->SetMC(CHARACTER::MI_SUMMON);
  3375. }
  3376. }
  3377.  
  3378. static const char* FN_point_string(int apply_number)
  3379. {
  3380. switch (apply_number)
  3381. {
  3382. case POINT_MAX_HP: return LC_TEXT("ÃÖ´ë »ý¸í·Â +%d");
  3383. case POINT_MAX_SP: return LC_TEXT("ÃÖ´ë Á¤½Å·Â +%d");
  3384. case POINT_HT: return LC_TEXT("ü·Â +%d");
  3385. case POINT_IQ: return LC_TEXT("Áö´É +%d");
  3386. case POINT_ST: return LC_TEXT("±Ù·Â +%d");
  3387. case POINT_DX: return LC_TEXT("¹Îø +%d");
  3388. case POINT_ATT_SPEED: return LC_TEXT("°ø°Ý¼Óµµ +%d");
  3389. case POINT_MOV_SPEED: return LC_TEXT("À̵¿¼Óµµ %d");
  3390. case POINT_CASTING_SPEED: return LC_TEXT("ÄðŸÀÓ -%d");
  3391. case POINT_HP_REGEN: return LC_TEXT("»ý¸í·Â ȸº¹ +%d");
  3392. case POINT_SP_REGEN: return LC_TEXT("Á¤½Å·Â ȸº¹ +%d");
  3393. case POINT_POISON_PCT: return LC_TEXT("µ¶°ø°Ý %d");
  3394. #ifdef ENABLE_WOLFMAN_CHARACTER
  3395. case POINT_BLEEDING_PCT: return LC_TEXT("µ¶°ø°Ý %d");
  3396. #endif
  3397. case POINT_STUN_PCT: return LC_TEXT("½ºÅÏ +%d");
  3398. case POINT_SLOW_PCT: return LC_TEXT("½½·Î¿ì +%d");
  3399. case POINT_CRITICAL_PCT: return LC_TEXT("%d%% È®·ü·Î Ä¡¸íŸ °ø°Ý");
  3400. case POINT_RESIST_CRITICAL: return LC_TEXT("»ó´ëÀÇ Ä¡¸íŸ È®·ü %d%% °¨¼Ò");
  3401. case POINT_PENETRATE_PCT: return LC_TEXT("%d%% È®·ü·Î °üÅë °ø°Ý");
  3402. case POINT_RESIST_PENETRATE: return LC_TEXT("»ó´ëÀÇ °üÅë °ø°Ý È®·ü %d%% °¨¼Ò");
  3403. case POINT_ATTBONUS_HUMAN: return LC_TEXT("Àΰ£·ù ¸ó½ºÅÍ Å¸°ÝÄ¡ +%d%%");
  3404. case POINT_ATTBONUS_ANIMAL: return LC_TEXT("µ¿¹°·ù ¸ó½ºÅÍ Å¸°ÝÄ¡ +%d%%");
  3405. case POINT_ATTBONUS_ORC: return LC_TEXT("¿õ±ÍÁ· Ÿ°ÝÄ¡ +%d%%");
  3406. case POINT_ATTBONUS_MILGYO: return LC_TEXT("¹Ð±³·ù Ÿ°ÝÄ¡ +%d%%");
  3407. case POINT_ATTBONUS_UNDEAD: return LC_TEXT("½Ãü·ù Ÿ°ÝÄ¡ +%d%%");
  3408. case POINT_ATTBONUS_DEVIL: return LC_TEXT("¾Ç¸¶·ù Ÿ°ÝÄ¡ +%d%%");
  3409. case POINT_STEAL_HP: return LC_TEXT("Ÿ°ÝÄ¡ %d%% ¸¦ »ý¸í·ÂÀ¸·Î Èí¼ö");
  3410. case POINT_STEAL_SP: return LC_TEXT("Ÿ·ÂÄ¡ %d%% ¸¦ Á¤½Å·ÂÀ¸·Î Èí¼ö");
  3411. case POINT_MANA_BURN_PCT: return LC_TEXT("%d%% È®·ü·Î Ÿ°Ý½Ã »ó´ë Àü½Å·Â ¼Ò¸ð");
  3412. case POINT_DAMAGE_SP_RECOVER: return LC_TEXT("%d%% È®·ü·Î ÇÇÇØ½Ã Á¤½Å·Â ȸº¹");
  3413. case POINT_BLOCK: return LC_TEXT("¹°¸®Å¸°Ý½Ã ºí·° È®·ü %d%%");
  3414. case POINT_DODGE: return LC_TEXT("Ȱ °ø°Ý ȸÇÇ È®·ü %d%%");
  3415. case POINT_RESIST_SWORD: return LC_TEXT("ÇÑ¼Õ°Ë ¹æ¾î %d%%");
  3416. case POINT_RESIST_TWOHAND: return LC_TEXT("¾ç¼Õ°Ë ¹æ¾î %d%%");
  3417. case POINT_RESIST_DAGGER: return LC_TEXT("µÎ¼Õ°Ë ¹æ¾î %d%%");
  3418. case POINT_RESIST_BELL: return LC_TEXT("¹æ¿ï ¹æ¾î %d%%");
  3419. case POINT_RESIST_FAN: return LC_TEXT("ºÎä ¹æ¾î %d%%");
  3420. case POINT_RESIST_BOW: return LC_TEXT("Ȱ°ø°Ý ÀúÇ× %d%%");
  3421. #ifdef ENABLE_WOLFMAN_CHARACTER
  3422. case POINT_RESIST_CLAW: return LC_TEXT("µÎ¼Õ°Ë ¹æ¾î %d%%");
  3423. #endif
  3424. case POINT_RESIST_FIRE: return LC_TEXT("È­¿° ÀúÇ× %d%%");
  3425. case POINT_RESIST_ELEC: return LC_TEXT("Àü±â ÀúÇ× %d%%");
  3426. case POINT_RESIST_MAGIC: return LC_TEXT("¸¶¹ý ÀúÇ× %d%%");
  3427. #ifdef ENABLE_MAGIC_REDUCTION_SYSTEM
  3428. case POINT_RESIST_MAGIC_REDUCTION: return LC_TEXT("¸¶¹ý ÀúÇ× %d%%");
  3429. #endif
  3430. case POINT_RESIST_WIND: return LC_TEXT("¹Ù¶÷ ÀúÇ× %d%%");
  3431. case POINT_RESIST_ICE: return LC_TEXT("³Ã±â ÀúÇ× %d%%");
  3432. case POINT_RESIST_EARTH: return LC_TEXT("´ëÁö ÀúÇ× %d%%");
  3433. case POINT_RESIST_DARK: return LC_TEXT("¾îµÒ ÀúÇ× %d%%");
  3434. case POINT_REFLECT_MELEE: return LC_TEXT("Á÷Á¢ Ÿ°ÝÄ¡ ¹Ý»ç È®·ü : %d%%");
  3435. case POINT_REFLECT_CURSE: return LC_TEXT("ÀúÁÖ µÇµ¹¸®±â È®·ü %d%%");
  3436. case POINT_POISON_REDUCE: return LC_TEXT("µ¶ ÀúÇ× %d%%");
  3437. #ifdef ENABLE_WOLFMAN_CHARACTER
  3438. case POINT_BLEEDING_REDUCE: return LC_TEXT("µ¶ ÀúÇ× %d%%");
  3439. #endif
  3440. case POINT_KILL_SP_RECOVER: return LC_TEXT("%d%% È®·ü·Î ÀûÅðÄ¡½Ã Á¤½Å·Â ȸº¹");
  3441. case POINT_EXP_DOUBLE_BONUS: return LC_TEXT("%d%% È®·ü·Î ÀûÅðÄ¡½Ã °æÇèÄ¡ Ãß°¡ »ó½Â");
  3442. case POINT_GOLD_DOUBLE_BONUS: return LC_TEXT("%d%% È®·ü·Î ÀûÅðÄ¡½Ã µ· 2¹è µå·Ó");
  3443. case POINT_ITEM_DROP_BONUS: return LC_TEXT("%d%% È®·ü·Î ÀûÅðÄ¡½Ã ¾ÆÀÌÅÛ 2¹è µå·Ó");
  3444. case POINT_POTION_BONUS: return LC_TEXT("¹°¾à »ç¿ë½Ã %d%% ¼º´É Áõ°¡");
  3445. case POINT_KILL_HP_RECOVERY: return LC_TEXT("%d%% È®·ü·Î ÀûÅðÄ¡½Ã »ý¸í·Â ȸº¹");
  3446. // case POINT_IMMUNE_STUN: return LC_TEXT("±âÀýÇÏÁö ¾ÊÀ½ %d%%");
  3447. // case POINT_IMMUNE_SLOW: return LC_TEXT("´À·ÁÁöÁö ¾ÊÀ½ %d%%");
  3448. // case POINT_IMMUNE_FALL: return LC_TEXT("³Ñ¾îÁöÁö ¾ÊÀ½ %d%%");
  3449. // case POINT_SKILL: return LC_TEXT("");
  3450. // case POINT_BOW_DISTANCE: return LC_TEXT("");
  3451. case POINT_ATT_GRADE_BONUS: return LC_TEXT("°ø°Ý·Â +%d");
  3452. case POINT_DEF_GRADE_BONUS: return LC_TEXT("¹æ¾î·Â +%d");
  3453. case POINT_MAGIC_ATT_GRADE: return LC_TEXT("¸¶¹ý °ø°Ý·Â +%d");
  3454. case POINT_MAGIC_DEF_GRADE: return LC_TEXT("¸¶¹ý ¹æ¾î·Â +%d");
  3455. // case POINT_CURSE_PCT: return LC_TEXT("");
  3456. case POINT_MAX_STAMINA: return LC_TEXT("ÃÖ´ë Áö±¸·Â +%d");
  3457. case POINT_ATTBONUS_WARRIOR: return LC_TEXT("¹«»ç¿¡°Ô °­ÇÔ +%d%%");
  3458. case POINT_ATTBONUS_ASSASSIN: return LC_TEXT("ÀÚ°´¿¡°Ô °­ÇÔ +%d%%");
  3459. case POINT_ATTBONUS_SURA: return LC_TEXT("¼ö¶ó¿¡°Ô °­ÇÔ +%d%%");
  3460. case POINT_ATTBONUS_SHAMAN: return LC_TEXT("¹«´ç¿¡°Ô °­ÇÔ +%d%%");
  3461. #ifdef ENABLE_WOLFMAN_CHARACTER
  3462. case POINT_ATTBONUS_WOLFMAN: return LC_TEXT("¹«´ç¿¡°Ô °­ÇÔ +%d%%");
  3463. #endif
  3464. case POINT_ATTBONUS_MONSTER: return LC_TEXT("¸ó½ºÅÍ¿¡°Ô °­ÇÔ +%d%%");
  3465. case POINT_MALL_ATTBONUS: return LC_TEXT("°ø°Ý·Â +%d%%");
  3466. case POINT_MALL_DEFBONUS: return LC_TEXT("¹æ¾î·Â +%d%%");
  3467. case POINT_MALL_EXPBONUS: return LC_TEXT("°æÇèÄ¡ %d%%");
  3468. case POINT_MALL_ITEMBONUS: return LC_TEXT("¾ÆÀÌÅÛ µå·ÓÀ² %.1f¹è");
  3469. case POINT_MALL_GOLDBONUS: return LC_TEXT("µ· µå·ÓÀ² %.1f¹è");
  3470. case POINT_MAX_HP_PCT: return LC_TEXT("ÃÖ´ë »ý¸í·Â +%d%%");
  3471. case POINT_MAX_SP_PCT: return LC_TEXT("ÃÖ´ë Á¤½Å·Â +%d%%");
  3472. case POINT_SKILL_DAMAGE_BONUS: return LC_TEXT("½ºÅ³ µ¥¹ÌÁö %d%%");
  3473. case POINT_NORMAL_HIT_DAMAGE_BONUS: return LC_TEXT("ÆòŸ µ¥¹ÌÁö %d%%");
  3474. case POINT_SKILL_DEFEND_BONUS: return LC_TEXT("½ºÅ³ µ¥¹ÌÁö ÀúÇ× %d%%");
  3475. case POINT_NORMAL_HIT_DEFEND_BONUS: return LC_TEXT("ÆòŸ µ¥¹ÌÁö ÀúÇ× %d%%");
  3476. // case POINT_PC_BANG_EXP_BONUS: return LC_TEXT("");
  3477. // case POINT_PC_BANG_DROP_BONUS: return LC_TEXT("");
  3478. // case POINT_EXTRACT_HP_PCT: return LC_TEXT("");
  3479. case POINT_RESIST_WARRIOR: return LC_TEXT("¹«»ç°ø°Ý¿¡ %d%% ÀúÇ×");
  3480. case POINT_RESIST_ASSASSIN: return LC_TEXT("ÀÚ°´°ø°Ý¿¡ %d%% ÀúÇ×");
  3481. case POINT_RESIST_SURA: return LC_TEXT("¼ö¶ó°ø°Ý¿¡ %d%% ÀúÇ×");
  3482. case POINT_RESIST_SHAMAN: return LC_TEXT("¹«´ç°ø°Ý¿¡ %d%% ÀúÇ×");
  3483. #ifdef ENABLE_WOLFMAN_CHARACTER
  3484. case POINT_RESIST_WOLFMAN: return LC_TEXT("¹«´ç°ø°Ý¿¡ %d%% ÀúÇ×");
  3485. #endif
  3486. default: return NULL;
  3487. }
  3488. }
  3489.  
  3490. static bool FN_hair_affect_string(LPCHARACTER ch, char *buf, size_t bufsiz)
  3491. {
  3492. if (NULL == ch || NULL == buf)
  3493. return false;
  3494.  
  3495. CAffect* aff = NULL;
  3496. time_t expire = 0;
  3497. struct tm ltm;
  3498. int year, mon, day;
  3499. int offset = 0;
  3500.  
  3501. aff = ch->FindAffect(AFFECT_HAIR);
  3502.  
  3503. if (NULL == aff)
  3504. return false;
  3505.  
  3506. expire = ch->GetQuestFlag("hair.limit_time");
  3507.  
  3508. if (expire < get_global_time())
  3509. return false;
  3510.  
  3511. // set apply string
  3512. offset = snprintf(buf, bufsiz, FN_point_string(aff->bApplyOn), aff->lApplyValue);
  3513.  
  3514. if (offset < 0 || offset >= (int) bufsiz)
  3515. offset = bufsiz - 1;
  3516.  
  3517. localtime_r(&expire, &ltm);
  3518.  
  3519. year = ltm.tm_year + 1900;
  3520. mon = ltm.tm_mon + 1;
  3521. day = ltm.tm_mday;
  3522.  
  3523. snprintf(buf + offset, bufsiz - offset, LC_TEXT(" (¸¸·áÀÏ : %d³â %d¿ù %dÀÏ)"), year, mon, day);
  3524.  
  3525. return true;
  3526. }
  3527.  
  3528. ACMD(do_costume)
  3529. {
  3530. #ifdef __SASH_SYSTEM__
  3531. char buf[768];
  3532. #else
  3533. char buf[512];
  3534. #endif
  3535. const size_t bufferSize = sizeof(buf);
  3536.  
  3537. char arg1[256];
  3538. one_argument(argument, arg1, sizeof(arg1));
  3539.  
  3540. CItem* pBody = ch->GetWear(WEAR_COSTUME_BODY);
  3541. CItem* pHair = ch->GetWear(WEAR_COSTUME_HAIR);
  3542. #ifdef __SASH_SYSTEM__
  3543. CItem * pSash = ch->GetWear(WEAR_COSTUME_SASH);
  3544. #endif
  3545.  
  3546. ch->ChatPacket(CHAT_TYPE_INFO, "COSTUME status:");
  3547.  
  3548. if (pHair)
  3549. {
  3550. const char* itemName = pHair->GetName();
  3551. ch->ChatPacket(CHAT_TYPE_INFO, " HAIR : %s", itemName);
  3552.  
  3553. for (int i = 0; i < pHair->GetAttributeCount(); ++i)
  3554. {
  3555. const TPlayerItemAttribute& attr = pHair->GetAttribute(i);
  3556. if (0 < attr.bType)
  3557. {
  3558. snprintf(buf, bufferSize, FN_point_string(attr.bType), attr.sValue);
  3559. ch->ChatPacket(CHAT_TYPE_INFO, " %s", buf);
  3560. }
  3561. }
  3562.  
  3563. if (pHair->IsEquipped() && arg1[0] == 'h')
  3564. ch->UnequipItem(pHair);
  3565. }
  3566.  
  3567. #ifdef __SASH_SYSTEM__
  3568. if (pSash)
  3569. {
  3570. const char * itemName = pSash->GetName();
  3571. ch->ChatPacket(CHAT_TYPE_INFO, " SASH: %s", itemName);
  3572. for (int i = 0; i < pSash->GetAttributeCount(); ++i)
  3573. {
  3574. const TPlayerItemAttribute& attr = pSash->GetAttribute(i);
  3575. if (attr.bType > 0)
  3576. {
  3577. const char * pAttrName = FN_point_string(attr.bType);
  3578. if (pAttrName == NULL)
  3579. continue;
  3580.  
  3581. snprintf(buf, sizeof(buf), FN_point_string(attr.bType), attr.sValue);
  3582. ch->ChatPacket(CHAT_TYPE_INFO, " %s", buf);
  3583. }
  3584. }
  3585.  
  3586. if (pSash->IsEquipped() && arg1[0] == 's')
  3587. ch->UnequipItem(pSash);
  3588. }
  3589. #endif
  3590.  
  3591. if (pBody)
  3592. {
  3593. const char* itemName = pBody->GetName();
  3594. ch->ChatPacket(CHAT_TYPE_INFO, " BODY : %s", itemName);
  3595.  
  3596. if (pBody->IsEquipped() && arg1[0] == 'b')
  3597. ch->UnequipItem(pBody);
  3598. }
  3599. }
  3600.  
  3601. ACMD(do_hair)
  3602. {
  3603. char buf[256];
  3604.  
  3605. if (false == FN_hair_affect_string(ch, buf, sizeof(buf)))
  3606. return;
  3607.  
  3608. ch->ChatPacket(CHAT_TYPE_INFO, buf);
  3609. }
  3610.  
  3611. ACMD(do_inventory)
  3612. {
  3613. int index = 0;
  3614. int count = 1;
  3615.  
  3616. char arg1[256];
  3617. char arg2[256];
  3618.  
  3619. LPITEM item;
  3620.  
  3621. two_arguments(argument, arg1, sizeof(arg1), arg2, sizeof(arg2));
  3622.  
  3623. if (!*arg1)
  3624. {
  3625. ch->ChatPacket(CHAT_TYPE_INFO, "Usage: inventory <start_index> <count>");
  3626. return;
  3627. }
  3628.  
  3629. if (!*arg2)
  3630. {
  3631. index = 0;
  3632. str_to_number(count, arg1);
  3633. }
  3634. else
  3635. {
  3636. str_to_number(index, arg1); index = MIN(index, INVENTORY_MAX_NUM);
  3637. str_to_number(count, arg2); count = MIN(count, INVENTORY_MAX_NUM);
  3638. }
  3639.  
  3640. for (int i = 0; i < count; ++i)
  3641. {
  3642. if (index >= INVENTORY_MAX_NUM)
  3643. break;
  3644.  
  3645. item = ch->GetInventoryItem(index);
  3646.  
  3647. ch->ChatPacket(CHAT_TYPE_INFO, "inventory [%d] = %s",
  3648. index, item ? item->GetName() : "<NONE>");
  3649. ++index;
  3650. }
  3651. }
  3652.  
  3653. //gift notify quest command
  3654. ACMD(do_gift)
  3655. {
  3656. ch->ChatPacket(CHAT_TYPE_COMMAND, "gift");
  3657. }
  3658.  
  3659. ACMD(do_cube)
  3660. {
  3661. if (!ch->CanDoCube())
  3662. return;
  3663.  
  3664. dev_log(LOG_DEB0, "CUBE COMMAND <%s>: %s", ch->GetName(), argument);
  3665. int cube_index = 0, inven_index = 0;
  3666. #ifdef __SPECIAL_STORAGE__
  3667. int inven_type = 0;
  3668.  
  3669. char arg1[256], arg2[256], arg3[256], arg4[256];
  3670. two_arguments (two_arguments(argument, arg1, sizeof(arg1), arg2, sizeof(arg2)), arg3, sizeof(arg3), arg4, sizeof(arg4));
  3671. #else
  3672. const char *line;
  3673. char arg1[256], arg2[256], arg3[256];
  3674.  
  3675. line = two_arguments(argument, arg1, sizeof(arg1), arg2, sizeof(arg2));
  3676. one_argument(line, arg3, sizeof(arg3));
  3677. #endif
  3678.  
  3679. if (0 == arg1[0])
  3680. {
  3681. // print usage
  3682. ch->ChatPacket(CHAT_TYPE_INFO, "Usage: cube open");
  3683. ch->ChatPacket(CHAT_TYPE_INFO, " cube close");
  3684. ch->ChatPacket(CHAT_TYPE_INFO, " cube add <inveltory_index>");
  3685. ch->ChatPacket(CHAT_TYPE_INFO, " cube delete <cube_index>");
  3686. ch->ChatPacket(CHAT_TYPE_INFO, " cube list");
  3687. ch->ChatPacket(CHAT_TYPE_INFO, " cube cancel");
  3688. ch->ChatPacket(CHAT_TYPE_INFO, " cube make [all]");
  3689. return;
  3690. }
  3691.  
  3692. const std::string& strArg1 = std::string(arg1);
  3693.  
  3694. // r_info (request information)
  3695. // /cube r_info ==> (Client -> Server) ÇöÀç NPC°¡ ¸¸µé ¼ö ÀÖ´Â ·¹½ÃÇÇ ¿äû
  3696. // (Server -> Client) /cube r_list npcVNUM resultCOUNT 123,1/125,1/128,1/130,5
  3697. //
  3698. // /cube r_info 3 ==> (Client -> Server) ÇöÀç NPC°¡ ¸¸µé¼ö ÀÖ´Â ·¹½ÃÇÇ Áß 3¹øÂ° ¾ÆÀÌÅÛÀ» ¸¸µå´Â µ¥ ÇÊ¿äÇÑ Á¤º¸¸¦ ¿äû
  3699. // /cube r_info 3 5 ==> (Client -> Server) ÇöÀç NPC°¡ ¸¸µé¼ö ÀÖ´Â ·¹½ÃÇÇ Áß 3¹øÂ° ¾ÆÀÌÅÛºÎÅÍ ÀÌÈÄ 5°³ÀÇ ¾ÆÀÌÅÛÀ» ¸¸µå´Â µ¥ ÇÊ¿äÇÑ Àç·á Á¤º¸¸¦ ¿äû
  3700. // (Server -> Client) /cube m_info startIndex count 125,1|126,2|127,2|123,5&555,5&555,4/120000@125,1|126,2|127,2|123,5&555,5&555,4/120000
  3701. //
  3702. if (strArg1 == "r_info")
  3703. {
  3704. if (0 == arg2[0])
  3705. Cube_request_result_list(ch);
  3706. else
  3707. {
  3708. if (isdigit(*arg2))
  3709. {
  3710. int listIndex = 0, requestCount = 1;
  3711. str_to_number(listIndex, arg2);
  3712.  
  3713. if (0 != arg3[0] && isdigit(*arg3))
  3714. str_to_number(requestCount, arg3);
  3715.  
  3716. Cube_request_material_info(ch, listIndex, requestCount);
  3717. }
  3718. }
  3719.  
  3720. return;
  3721. }
  3722.  
  3723. switch (LOWER(arg1[0]))
  3724. {
  3725. case 'o': // open
  3726. Cube_open(ch);
  3727. break;
  3728.  
  3729. case 'c': // close
  3730. Cube_close(ch);
  3731. break;
  3732.  
  3733. case 'l': // list
  3734. Cube_show_list(ch);
  3735. break;
  3736.  
  3737. case 'a': // add cue_index inven_index
  3738. {
  3739. if (0 == arg2[0] || !isdigit(*arg2) || 0 == arg3[0] || !isdigit(*arg3))
  3740. return;
  3741.  
  3742. str_to_number(cube_index, arg2);
  3743. str_to_number(inven_index, arg3);
  3744. #ifdef __SPECIAL_STORAGE__
  3745. str_to_number(inven_type, arg4);
  3746. Cube_add_item (ch, cube_index, inven_index, inven_type);
  3747. #else
  3748. Cube_add_item (ch, cube_index, inven_index);
  3749. #endif
  3750. }
  3751. break;
  3752.  
  3753. case 'd': // delete
  3754. {
  3755. if (0 == arg2[0] || !isdigit(*arg2))
  3756. return;
  3757.  
  3758. str_to_number(cube_index, arg2);
  3759. Cube_delete_item (ch, cube_index);
  3760. }
  3761. break;
  3762.  
  3763. case 'm': // make
  3764. if (0 != arg2[0])
  3765. {
  3766. while (true == Cube_make(ch))
  3767. dev_log (LOG_DEB0, "cube make success");
  3768. }
  3769. else
  3770. Cube_make(ch);
  3771. break;
  3772.  
  3773. default:
  3774. return;
  3775. }
  3776. }
  3777.  
  3778. ACMD(do_in_game_mall)
  3779. {
  3780. if (LC_IsEurope() == true)
  3781. {
  3782. char country_code[3];
  3783.  
  3784. switch (LC_GetLocalType())
  3785. {
  3786. case LC_GERMANY: country_code[0] = 'd'; country_code[1] = 'e'; country_code[2] = '\0'; break;
  3787. case LC_FRANCE: country_code[0] = 'f'; country_code[1] = 'r'; country_code[2] = '\0'; break;
  3788. case LC_ITALY: country_code[0] = 'i'; country_code[1] = 't'; country_code[2] = '\0'; break;
  3789. case LC_SPAIN: country_code[0] = 'e'; country_code[1] = 's'; country_code[2] = '\0'; break;
  3790. case LC_UK: country_code[0] = 'e'; country_code[1] = 'n'; country_code[2] = '\0'; break;
  3791. case LC_TURKEY: country_code[0] = 't'; country_code[1] = 'r'; country_code[2] = '\0'; break;
  3792. case LC_POLAND: country_code[0] = 'p'; country_code[1] = 'l'; country_code[2] = '\0'; break;
  3793. case LC_PORTUGAL: country_code[0] = 'p'; country_code[1] = 't'; country_code[2] = '\0'; break;
  3794. case LC_GREEK: country_code[0] = 'g'; country_code[1] = 'r'; country_code[2] = '\0'; break;
  3795. case LC_RUSSIA: country_code[0] = 'r'; country_code[1] = 'u'; country_code[2] = '\0'; break;
  3796. case LC_DENMARK: country_code[0] = 'd'; country_code[1] = 'k'; country_code[2] = '\0'; break;
  3797. case LC_BULGARIA: country_code[0] = 'b'; country_code[1] = 'g'; country_code[2] = '\0'; break;
  3798. case LC_CROATIA: country_code[0] = 'h'; country_code[1] = 'r'; country_code[2] = '\0'; break;
  3799. case LC_MEXICO: country_code[0] = 'm'; country_code[1] = 'x'; country_code[2] = '\0'; break;
  3800. case LC_ARABIA: country_code[0] = 'a'; country_code[1] = 'e'; country_code[2] = '\0'; break;
  3801. case LC_CZECH: country_code[0] = 'c'; country_code[1] = 'z'; country_code[2] = '\0'; break;
  3802. case LC_ROMANIA: country_code[0] = 'r'; country_code[1] = 'o'; country_code[2] = '\0'; break;
  3803. case LC_HUNGARY: country_code[0] = 'h'; country_code[1] = 'u'; country_code[2] = '\0'; break;
  3804. case LC_NETHERLANDS: country_code[0] = 'n'; country_code[1] = 'l'; country_code[2] = '\0'; break;
  3805. case LC_USA: country_code[0] = 'u'; country_code[1] = 's'; country_code[2] = '\0'; break;
  3806. case LC_CANADA: country_code[0] = 'c'; country_code[1] = 'a'; country_code[2] = '\0'; break;
  3807. default:
  3808. if (test_server == true)
  3809. {
  3810. country_code[0] = 'd'; country_code[1] = 'e'; country_code[2] = '\0';
  3811. }
  3812. break;
  3813. }
  3814.  
  3815. char buf[512+1];
  3816. char sas[33];
  3817. MD5_CTX ctx;
  3818. const char sas_key[] = "GF9001";
  3819.  
  3820. snprintf(buf, sizeof(buf), "%u%u%s", ch->GetPlayerID(), ch->GetAID(), sas_key);
  3821.  
  3822. MD5Init(&ctx);
  3823. MD5Update(&ctx, (const unsigned char *) buf, strlen(buf));
  3824. #ifdef __FreeBSD__
  3825. MD5End(&ctx, sas);
  3826. #else
  3827. static const char hex[] = "0123456789abcdef";
  3828. unsigned char digest[16];
  3829. MD5Final(digest, &ctx);
  3830. int i;
  3831. for (i = 0; i < 16; ++i) {
  3832. sas[i+i] = hex[digest[i] >> 4];
  3833. sas[i+i+1] = hex[digest[i] & 0x0f];
  3834. }
  3835. sas[i+i] = '\0';
  3836. #endif
  3837.  
  3838. snprintf(buf, sizeof(buf), "mall http://%s/ishop?pid=%u&c=%s&sid=%d&sas=%s",
  3839. g_strWebMallURL.c_str(), ch->GetPlayerID(), country_code, g_server_id, sas);
  3840.  
  3841. ch->ChatPacket(CHAT_TYPE_COMMAND, buf);
  3842. }
  3843. }
  3844.  
  3845. ACMD(do_support_system)
  3846. {
  3847. char arg1[256];
  3848. one_argument(argument, arg1, sizeof(arg1));
  3849. if (!*arg1)
  3850. return;
  3851.  
  3852. DWORD items = 0;
  3853. str_to_number(items, arg1);
  3854. if (ch->GetSupportSystem()->IsActiveSupport())
  3855. {
  3856. CSupportSystem* supportSystem = ch->GetSupportSystem();
  3857. for (int i = 0; i < INVENTORY_MAX_NUM; i++)
  3858. {
  3859. LPITEM item = ch->GetInventoryItem(i);
  3860. LPITEM pSummonItem = ITEM_MANAGER::instance().FindByVID(ch->GetSupportSystem()->GetActiveSupport()->GetSummonItemVID());
  3861. if (item != NULL)
  3862. if (item->GetVnum() == items)
  3863. {
  3864. if (item->GetType() == ITEM_COSTUME)
  3865. {
  3866. if (item->IsExchanging())
  3867. {
  3868. ch->ChatPacket(CHAT_TYPE_INFO, "<Buffi> Nu poti face acest lucru cand negociezi!");
  3869. return;
  3870. }
  3871. if(item->GetSubType() == COSTUME_BODY)
  3872. {
  3873. item->ClearAttribute();
  3874. pSummonItem->SetSocket(1,item->GetVnum());
  3875. item->RemoveFromCharacter();
  3876. break;
  3877. }
  3878. else
  3879. {
  3880. ch->ChatPacket(CHAT_TYPE_INFO, "<Biffi> Nu poti adauga acest item!");
  3881. return;
  3882. }
  3883. }
  3884.  
  3885. }
  3886. }
  3887. ch->GetSupportSystem()->GetActiveSupport()->RefreshCostume();
  3888. }
  3889. else
  3890. ch->ChatPacket(CHAT_TYPE_INFO, "<Buffi> Trebuie sa chemi mai intai Buffi-ul pentru a face acest lucru.");
  3891. }
  3892. ACMD(do_support_system_d)
  3893. {
  3894. char arg1[256];
  3895. one_argument(argument, arg1, sizeof(arg1));
  3896. if (!*arg1)
  3897. return;
  3898.  
  3899. DWORD items = 0;
  3900. str_to_number(items, arg1);
  3901. if (ch->GetSupportSystem()->IsActiveSupport())
  3902. {
  3903. CSupportSystem* supportSystem = ch->GetSupportSystem();
  3904. for (int i = 0; i < INVENTORY_MAX_NUM; i++)
  3905. {
  3906. LPITEM item = ch->GetInventoryItem(i);
  3907. LPITEM pSummonItem = ITEM_MANAGER::instance().FindByVID(ch->GetSupportSystem()->GetActiveSupport()->GetSummonItemVID());
  3908. if (item != NULL)
  3909. if (item->GetVnum() == items)
  3910. {
  3911. if (item->GetType() == ITEM_COSTUME)
  3912. {
  3913. if (item->IsExchanging())
  3914. {
  3915. ch->ChatPacket(CHAT_TYPE_INFO, "<Support System> You can not do this when you are exchanging!");
  3916. return;
  3917. }
  3918. if (item->GetSubType() == COSTUME_HAIR)
  3919. {
  3920. item->ClearAttribute();
  3921. pSummonItem->SetSocket(2,item->GetValue(3));
  3922. item->RemoveFromCharacter();
  3923. break;
  3924. }
  3925. else
  3926. {
  3927. ch->ChatPacket(CHAT_TYPE_INFO, "<Support System> You can not put this item!");
  3928. return;
  3929. }
  3930. }
  3931.  
  3932. }
  3933. }
  3934. ch->GetSupportSystem()->GetActiveSupport()->RefreshCostume();
  3935. }
  3936. else
  3937. ch->ChatPacket(CHAT_TYPE_INFO, "<Support System> You have to call your support for use this function.");
  3938. }
  3939.  
  3940. // ÁÖ»çÀ§
  3941. ACMD(do_dice)
  3942. {
  3943. char arg1[256], arg2[256];
  3944. int start = 1, end = 100;
  3945.  
  3946. two_arguments(argument, arg1, sizeof(arg1), arg2, sizeof(arg2));
  3947.  
  3948. if (*arg1 && *arg2)
  3949. {
  3950. start = atoi(arg1);
  3951. end = atoi(arg2);
  3952. }
  3953. else if (*arg1 && !*arg2)
  3954. {
  3955. start = 1;
  3956. end = atoi(arg1);
  3957. }
  3958.  
  3959. end = MAX(start, end);
  3960. start = MIN(start, end);
  3961.  
  3962. int n = number(start, end);
  3963.  
  3964. #ifdef ENABLE_DICE_SYSTEM
  3965. if (ch->GetParty())
  3966. ch->GetParty()->ChatPacketToAllMember(CHAT_TYPE_DICE_INFO, LC_TEXT("%s´ÔÀÌ ÁÖ»çÀ§¸¦ ±¼·Á %d°¡ ³ª¿Ô½À´Ï´Ù. (%d-%d)"), ch->GetName(), n, start, end);
  3967. else
  3968. ch->ChatPacket(CHAT_TYPE_DICE_INFO, LC_TEXT("´ç½ÅÀÌ ÁÖ»çÀ§¸¦ ±¼·Á %d°¡ ³ª¿Ô½À´Ï´Ù. (%d-%d)"), n, start, end);
  3969. #else
  3970. if (ch->GetParty())
  3971. ch->GetParty()->ChatPacketToAllMember(CHAT_TYPE_INFO, LC_TEXT("%s´ÔÀÌ ÁÖ»çÀ§¸¦ ±¼·Á %d°¡ ³ª¿Ô½À´Ï´Ù. (%d-%d)"), ch->GetName(), n, start, end);
  3972. else
  3973. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("´ç½ÅÀÌ ÁÖ»çÀ§¸¦ ±¼·Á %d°¡ ³ª¿Ô½À´Ï´Ù. (%d-%d)"), n, start, end);
  3974. #endif
  3975. }
  3976.  
  3977. #ifdef ENABLE_NEWSTUFF
  3978. ACMD(do_click_safebox)
  3979. {
  3980. ch->SetSafeboxOpenPosition();
  3981. ch->ChatPacket(CHAT_TYPE_COMMAND, "ShowMeSafeboxPassword");
  3982. }
  3983. ACMD(do_force_logout)
  3984. {
  3985. LPDESC pDesc=DESC_MANAGER::instance().FindByCharacterName(ch->GetName());
  3986. if (!pDesc)
  3987. return;
  3988. pDesc->DelayedDisconnect(0);
  3989. }
  3990. #endif
  3991.  
  3992. ACMD(do_click_mall)
  3993. {
  3994. ch->ChatPacket(CHAT_TYPE_COMMAND, "ShowMeMallPassword");
  3995. }
  3996.  
  3997. ACMD(do_ride)
  3998. {
  3999. dev_log(LOG_DEB0, "[DO_RIDE] start");
  4000. if (ch->IsDead() || ch->IsStun())
  4001. return;
  4002.  
  4003. #ifdef ENABLE_OX_EVENT_RENEWAL
  4004. if (ch->GetMapIndex() == 113)
  4005. return;
  4006. #endif
  4007.  
  4008. if (ch->IsPolymorphed() == true)
  4009. {
  4010. ch->ChatPacket(CHAT_TYPE_INFO, "Nu poti folosi un mount atat timp cat esti transformat.");
  4011. return;
  4012. }
  4013.  
  4014. if (ch->GetWarMap() && !ch->IsObserverMode())
  4015. {
  4016. ch->ChatPacket(CHAT_TYPE_INFO, "Nu poti folosi un mount in aceasta zona.");
  4017. return;
  4018. }
  4019.  
  4020. #ifdef ENABLE_MOUNT_COSTUME_SYSTEM
  4021. if(ch->GetWear(WEAR_COSTUME_MOUNT))
  4022. {
  4023. CMountSystem* mountSystem = ch->GetMountSystem();
  4024. LPITEM mount = ch->GetWear(WEAR_COSTUME_MOUNT);
  4025. DWORD mobVnum = 0;
  4026.  
  4027. if (!mountSystem && !mount)
  4028. return;
  4029.  
  4030. if(mount->GetValue(1) != 0)
  4031. mobVnum = mount->GetValue(1);
  4032.  
  4033. if (ch->GetMountVnum())
  4034. {
  4035. if(mountSystem->CountSummoned() == 0)
  4036. {
  4037. mountSystem->Unmount(mobVnum);
  4038. }
  4039. }
  4040. else
  4041. {
  4042. if(mountSystem->CountSummoned() == 1)
  4043. {
  4044. mountSystem->Mount(mobVnum, mount);
  4045. }
  4046. }
  4047.  
  4048. return;
  4049. }
  4050. #endif
  4051.  
  4052. if (ch->IsHorseRiding())
  4053. {
  4054. ch->StopRiding();
  4055. return;
  4056. }
  4057.  
  4058. if (ch->GetHorse() != NULL)
  4059. {
  4060. ch->StartRiding();
  4061. return;
  4062. }
  4063.  
  4064. for (BYTE i=0; i<INVENTORY_MAX_NUM; ++i)
  4065. {
  4066. LPITEM item = ch->GetInventoryItem(i);
  4067. if (NULL == item)
  4068. continue;
  4069.  
  4070. if (item->GetType() == ITEM_COSTUME && item->GetSubType() == COSTUME_MOUNT) {
  4071. ch->UseItem(TItemPos (INVENTORY, i));
  4072. return;
  4073. }
  4074. }
  4075.  
  4076. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¸»À» ¸ÕÀú ¼ÒÈ¯ÇØÁÖ¼¼¿ä."));
  4077. }
  4078.  
  4079. #ifdef __AUCTION__
  4080. // temp_auction
  4081. ACMD(do_get_item_id_list)
  4082. {
  4083. for (int i = 0; i < INVENTORY_MAX_NUM; i++)
  4084. {
  4085. LPITEM item = ch->GetInventoryItem(i);
  4086. if (item != NULL)
  4087. ch->ChatPacket(CHAT_TYPE_INFO, "nume : %s id : %d", item->GetProto()->szName, item->GetID());
  4088. }
  4089. }
  4090.  
  4091. // temp_auction
  4092.  
  4093. ACMD(do_enroll_auction)
  4094. {
  4095. char arg1[256];
  4096. char arg2[256];
  4097. char arg3[256];
  4098. char arg4[256];
  4099. two_arguments (two_arguments(argument, arg1, sizeof(arg1), arg2, sizeof(arg2)), arg3, sizeof(arg3), arg4, sizeof(arg4));
  4100.  
  4101. DWORD item_id = strtoul(arg1, NULL, 10);
  4102. BYTE empire = strtoul(arg2, NULL, 10);
  4103. int bidPrice = strtol(arg3, NULL, 10);
  4104. int immidiatePurchasePrice = strtol(arg4, NULL, 10);
  4105.  
  4106. LPITEM item = ITEM_MANAGER::instance().Find(item_id);
  4107. if (item == NULL)
  4108. return;
  4109.  
  4110. AuctionManager::instance().enroll_auction(ch, item, empire, bidPrice, immidiatePurchasePrice);
  4111. }
  4112.  
  4113. ACMD(do_enroll_wish)
  4114. {
  4115. char arg1[256];
  4116. char arg2[256];
  4117. char arg3[256];
  4118. one_argument (two_arguments(argument, arg1, sizeof(arg1), arg2, sizeof(arg2)), arg3, sizeof(arg3));
  4119.  
  4120. DWORD item_num = strtoul(arg1, NULL, 10);
  4121. BYTE empire = strtoul(arg2, NULL, 10);
  4122. int wishPrice = strtol(arg3, NULL, 10);
  4123.  
  4124. AuctionManager::instance().enroll_wish(ch, item_num, empire, wishPrice);
  4125. }
  4126.  
  4127. ACMD(do_enroll_sale)
  4128. {
  4129. char arg1[256];
  4130. char arg2[256];
  4131. char arg3[256];
  4132. one_argument (two_arguments(argument, arg1, sizeof(arg1), arg2, sizeof(arg2)), arg3, sizeof(arg3));
  4133.  
  4134. DWORD item_id = strtoul(arg1, NULL, 10);
  4135. DWORD wisher_id = strtoul(arg2, NULL, 10);
  4136. int salePrice = strtol(arg3, NULL, 10);
  4137.  
  4138. LPITEM item = ITEM_MANAGER::instance().Find(item_id);
  4139. if (item == NULL)
  4140. return;
  4141.  
  4142. AuctionManager::instance().enroll_sale(ch, item, wisher_id, salePrice);
  4143. }
  4144.  
  4145. // temp_auction
  4146. // packetÀ¸·Î Åë½ÅÇÏ°Ô Çϰí, ÀÌ°Ç »èÁ¦ÇؾßÇÑ´Ù.
  4147. ACMD(do_get_auction_list)
  4148. {
  4149. char arg1[256];
  4150. char arg2[256];
  4151. char arg3[256];
  4152. two_arguments (one_argument (argument, arg1, sizeof(arg1)), arg2, sizeof(arg2), arg3, sizeof(arg3));
  4153.  
  4154. AuctionManager::instance().get_auction_list (ch, strtoul(arg1, NULL, 10), strtoul(arg2, NULL, 10), strtoul(arg3, NULL, 10));
  4155. }
  4156. //
  4157. //ACMD(do_get_wish_list)
  4158. //{
  4159. // char arg1[256];
  4160. // char arg2[256];
  4161. // char arg3[256];
  4162. // two_arguments (one_argument (argument, arg1, sizeof(arg1)), arg2, sizeof(arg2), arg3, sizeof(arg3));
  4163. //
  4164. // AuctionManager::instance().get_wish_list (ch, strtoul(arg1, NULL, 10), strtoul(arg2, NULL, 10), strtoul(arg3, NULL, 10));
  4165. //}
  4166. ACMD (do_get_my_auction_list)
  4167. {
  4168. char arg1[256];
  4169. char arg2[256];
  4170. two_arguments (argument, arg1, sizeof(arg1), arg2, sizeof(arg2));
  4171.  
  4172. AuctionManager::instance().get_my_auction_list (ch, strtoul(arg1, NULL, 10), strtoul(arg2, NULL, 10));
  4173. }
  4174.  
  4175. ACMD (do_get_my_purchase_list)
  4176. {
  4177. char arg1[256];
  4178. char arg2[256];
  4179. two_arguments (argument, arg1, sizeof(arg1), arg2, sizeof(arg2));
  4180.  
  4181. AuctionManager::instance().get_my_purchase_list (ch, strtoul(arg1, NULL, 10), strtoul(arg2, NULL, 10));
  4182. }
  4183.  
  4184. ACMD (do_auction_bid)
  4185. {
  4186. char arg1[256];
  4187. char arg2[256];
  4188. two_arguments (argument, arg1, sizeof(arg1), arg2, sizeof(arg2));
  4189.  
  4190. AuctionManager::instance().bid (ch, strtoul(arg1, NULL, 10), strtoul(arg2, NULL, 10));
  4191. }
  4192.  
  4193. ACMD (do_auction_impur)
  4194. {
  4195. char arg1[256];
  4196. one_argument (argument, arg1, sizeof(arg1));
  4197.  
  4198. AuctionManager::instance().immediate_purchase (ch, strtoul(arg1, NULL, 10));
  4199. }
  4200.  
  4201. ACMD (do_get_auctioned_item)
  4202. {
  4203. char arg1[256];
  4204. char arg2[256];
  4205. two_arguments (argument, arg1, sizeof(arg1), arg2, sizeof(arg2));
  4206.  
  4207. AuctionManager::instance().get_auctioned_item (ch, strtoul(arg1, NULL, 10), strtoul(arg2, NULL, 10));
  4208. }
  4209.  
  4210. ACMD (do_buy_sold_item)
  4211. {
  4212. char arg1[256];
  4213. char arg2[256];
  4214. one_argument (argument, arg1, sizeof(arg1));
  4215.  
  4216. AuctionManager::instance().get_auctioned_item (ch, strtoul(arg1, NULL, 10), strtoul(arg2, NULL, 10));
  4217. }
  4218.  
  4219. ACMD (do_cancel_auction)
  4220. {
  4221. char arg1[256];
  4222. one_argument (argument, arg1, sizeof(arg1));
  4223.  
  4224. AuctionManager::instance().cancel_auction (ch, strtoul(arg1, NULL, 10));
  4225. }
  4226.  
  4227. ACMD (do_cancel_wish)
  4228. {
  4229. char arg1[256];
  4230. one_argument (argument, arg1, sizeof(arg1));
  4231.  
  4232. AuctionManager::instance().cancel_wish (ch, strtoul(arg1, NULL, 10));
  4233. }
  4234.  
  4235. ACMD (do_cancel_sale)
  4236. {
  4237. char arg1[256];
  4238. one_argument (argument, arg1, sizeof(arg1));
  4239.  
  4240. AuctionManager::instance().cancel_sale (ch, strtoul(arg1, NULL, 10));
  4241. }
  4242.  
  4243. ACMD (do_rebid)
  4244. {
  4245. char arg1[256];
  4246. char arg2[256];
  4247. two_arguments (argument, arg1, sizeof(arg1), arg2, sizeof(arg2));
  4248.  
  4249. AuctionManager::instance().rebid (ch, strtoul(arg1, NULL, 10), strtoul(arg2, NULL, 10));
  4250. }
  4251.  
  4252. ACMD (do_bid_cancel)
  4253. {
  4254. char arg1[256];
  4255. char arg2[256];
  4256. two_arguments (argument, arg1, sizeof(arg1), arg2, sizeof(arg2));
  4257.  
  4258. AuctionManager::instance().bid_cancel (ch, strtoul(arg1, NULL, 10));
  4259. }
  4260. #endif
  4261.  
  4262. #ifdef SHOP_SEARCH
  4263. #include "target.h"
  4264. #include "shop.h"
  4265. class CFuncShopView
  4266. {
  4267. private:
  4268. int dwViewRange;
  4269.  
  4270. public:
  4271. LPENTITY m_me;
  4272. DWORD dwVnum,dwSkill;
  4273. long long llPrice;
  4274. CFuncShopView(LPENTITY ent, DWORD vnum, long long price,DWORD skill) :
  4275. dwViewRange(VIEW_RANGE + VIEW_BONUS_RANGE),
  4276. m_me(ent), dwVnum(vnum),dwSkill(skill), llPrice(price)
  4277. {
  4278. }
  4279.  
  4280. void operator () (LPENTITY ent)
  4281. {
  4282. /*if (!ent->IsType(ENTITY_OBJECT))
  4283. if (DISTANCE_APPROX(ent->GetX() - m_me->GetX(), ent->GetY() - m_me->GetY()) > dwViewRange)
  4284. return;*/
  4285. if (!m_me->GetDesc())
  4286. return;
  4287. if (ent->IsType(ENTITY_CHARACTER))
  4288. {
  4289. LPCHARACTER chMe = (LPCHARACTER)m_me;
  4290. LPCHARACTER chEnt = (LPCHARACTER)ent;
  4291. if (chEnt->GetRaceNum() == 30000 && chEnt->GetMyShop())
  4292. {
  4293. if (llPrice == 0 && dwVnum == 0)
  4294. {
  4295. TargetInfo * pInfo_check = CTargetManager::instance().GetTargetInfo(chMe->GetPlayerID(), TARGET_TYPE_SHOP, chEnt->GetVID());
  4296. if (pInfo_check)
  4297. CTargetManager::Instance().DeleteTarget(chMe->GetPlayerID(), chEnt->IsPrivShop() ? chEnt->GetPrivShop() : chEnt->GetPlayerID(), "SHOP_SEARCH_TARGET");
  4298. return;
  4299. }
  4300. LPSHOP shop = chEnt->GetMyShop();
  4301. if (!shop)
  4302. return;
  4303. if (!shop->SearchItem(dwVnum, llPrice,dwSkill))
  4304. return;
  4305.  
  4306. if (!CTargetManager::instance().GetTargetInfo(chMe->GetPlayerID(), TARGET_TYPE_SHOP, chEnt->GetVID()))
  4307. CTargetManager::Instance().CreateTarget(chMe->GetPlayerID(), chEnt->IsPrivShop() ? chEnt->GetPrivShop() : chEnt->GetPlayerID(), "SHOP_SEARCH_TARGET", TARGET_TYPE_SHOP, chEnt->GetVID(), 0, chEnt->GetMapIndex(), "shop");
  4308. chMe->SetQuestFlag("shop.search", chMe->GetQuestFlag("shop.search") + 1);
  4309. }
  4310. }
  4311. }
  4312. };
  4313. void ClearShopSearch(LPCHARACTER ch)
  4314. {
  4315. CFuncShopView f(ch, 0, 0,0);
  4316. ch->GetSectree()->ForEachAround(f);
  4317. }
  4318. ACMD(do_search_shop)
  4319. {
  4320.  
  4321. if (get_global_time() < ch->GetQuestFlag("shop.searchlast")) {
  4322. ch->ChatPacket(CHAT_TYPE_INFO, "You can not use too fast");
  4323. return;
  4324. }
  4325.  
  4326. char arg1[256], arg2[256], arg3[256], arg4[256];
  4327. DWORD vnum = 0;
  4328. long long price = 0;
  4329. DWORD book = 0;
  4330.  
  4331. two_arguments (two_arguments (argument, arg1, sizeof (arg1), arg2, sizeof (arg2)), arg3, sizeof (arg3), arg4, sizeof (arg4));
  4332.  
  4333. if (!*arg1 || !*arg2 || !*arg3 || !isdigit (*arg1) || !isdigit (*arg2)|| !isdigit (*arg3))
  4334. return;
  4335. str_to_number(vnum,arg1);
  4336. str_to_number(price,arg2);
  4337. str_to_number(book,arg3);
  4338. if(vnum == 0)
  4339. ClearShopSearch(ch);
  4340. else{
  4341. ClearShopSearch(ch);
  4342. TItemTable * pTable = ITEM_MANAGER::instance().GetTable(vnum);
  4343. if (!pTable)
  4344. return;
  4345. CFuncShopView f(ch, vnum, price,book);
  4346. ch->SetQuestFlag("shop.search", 0);
  4347. ch->GetSectree()->ForEachAround(f);
  4348. int c = ch->GetQuestFlag("shop.search");
  4349. if (c>0)
  4350. {
  4351. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Found %s in %d shops"), pTable->szLocaleName, c);
  4352. ch->SetQuestFlag("shop.search", 0);
  4353. }
  4354. ch->SetQuestFlag("shop.searchlast", get_global_time() + 5);
  4355. }
  4356. }
  4357.  
  4358. #endif
  4359.  
  4360. #ifdef ENABLE_OFFLINE_SHOP_HIDE
  4361. ACMD(do_show_hide_shops)
  4362. {
  4363. char arg1[256];
  4364. one_argument(argument, arg1, sizeof(arg1));
  4365.  
  4366. int option = 0;
  4367. str_to_number(option, arg1);
  4368.  
  4369. ch->SetShowOfflineShop(option);
  4370. }
  4371. #endif
  4372.  
  4373. ACMD(do_search_cofres){
  4374.  
  4375. int posicion = 0;
  4376. bool g_item_cofres = false;
  4377. const char *line;
  4378. char arg1[256], arg2[256];
  4379.  
  4380. line = two_arguments(argument, arg1, sizeof(arg1), arg2, sizeof(arg2));
  4381.  
  4382. if (0 == arg1[0])
  4383. return;
  4384.  
  4385. int slot = atoi(arg2);
  4386. LPITEM item = ch->GetItem(TItemPos(INVENTORY, slot));
  4387.  
  4388. if(NULL == item){
  4389. ch->ChatPacket(CHAT_TYPE_INFO,"[System]Error 000");
  4390. return;
  4391. }
  4392. DWORD dwBoxVnum = item->GetVnum();
  4393. std::vector <DWORD> dwVnums;
  4394. std::vector <DWORD> dwCounts;
  4395. std::vector <LPITEM> item_gets(NULL);
  4396. int count = 0;
  4397.  
  4398. std::vector <DWORD> dwVnums1;
  4399. std::vector <DWORD> dwCounts1;
  4400. std::vector <LPITEM> item_gets1(NULL);
  4401. int count1 = 0;
  4402.  
  4403. const std::string& strArg1 = std::string(arg1);
  4404.  
  4405. if (ch->InformationSpecialItemGroup(dwBoxVnum, dwVnums, dwCounts, item_gets, count))
  4406. {
  4407. g_item_cofres = true;
  4408. }
  4409.  
  4410. if (g_item_cofres == false || dwBoxVnum == 50300){
  4411. ch->ChatPacket(CHAT_TYPE_INFO,"[System]Acest cufar nu contine iteme!");
  4412. return;
  4413. }
  4414.  
  4415. if (strArg1 == "search"){
  4416.  
  4417. if (ch->InformationSpecialItemGroup(dwBoxVnum, dwVnums, dwCounts, item_gets, count))
  4418. {
  4419. for (int i = 0; i < count; i++)
  4420. {
  4421. ch->ChatPacket(CHAT_TYPE_COMMAND, "search_cofre_ids %d %d", dwVnums[i],dwCounts[i]);
  4422. }
  4423. ch->ChatPacket(CHAT_TYPE_COMMAND,"search_cofre_refresh");
  4424. }
  4425. }
  4426. else if(strArg1 == "open"){
  4427. if (item->GetType() == ITEM_TREASURE_BOX)
  4428. {
  4429. ch->ChatPacket(CHAT_TYPE_INFO, "[System]No puede abrir items que necesiten llaves");
  4430. return;
  4431. }
  4432. if (ch->GiveItemFromSpecialItemGroup(dwBoxVnum, dwVnums1, dwCounts1, item_gets1, count1))
  4433. {
  4434. ch->RemoveSpecifyItem(dwBoxVnum, 1);
  4435. for (int i = 0; i < count1; i++){
  4436. switch (dwVnums1[i])
  4437. {
  4438. case CSpecialItemGroup::GOLD:
  4439. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Ai primit %d yang."), dwCounts1[i]);
  4440. break;
  4441. case CSpecialItemGroup::EXP:
  4442. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Ai primit %d puncte de experienta."), dwCounts1[i]);
  4443. break;
  4444. }
  4445. }
  4446. ch->ChatPacket(CHAT_TYPE_COMMAND,"search_cofre_refresh_open");
  4447. }
  4448.  
  4449. }
  4450. }
  4451. #ifdef ENABLE_SORT_INVENTORY
  4452. ACMD (do_sort_items)
  4453. {
  4454. if (ch->IsDead() || ch->GetExchange() || ch->GetMyShop() || ch->GetShopOwner() || ch->IsOpenSafebox() || ch->IsCubeOpen())
  4455. {
  4456. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Nu poti staca itemele cu aceasta fereastra deschisa."));
  4457. return;
  4458. }
  4459.  
  4460. int lastSortInventoryPulse = ch->GetSortInventoryPulse();
  4461. int currentPulse = thecore_pulse();
  4462.  
  4463. if (lastSortInventoryPulse > currentPulse) {
  4464. int deltaInSeconds = ((lastSortInventoryPulse / PASSES_PER_SEC(1)) - (currentPulse / PASSES_PER_SEC(1)));
  4465. int minutes = deltaInSeconds / 60;
  4466. int seconds = (deltaInSeconds - (minutes * 60));
  4467.  
  4468. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Poti staca iar itemele in %02d secunde."), seconds);
  4469. return;
  4470. }
  4471.  
  4472. for (int i = 0; i < INVENTORY_MAX_NUM; ++i)
  4473. {
  4474. LPITEM item = ch->GetInventoryItem(i);
  4475.  
  4476. if(!item)
  4477. continue;
  4478.  
  4479. if(item->isLocked())
  4480. continue;
  4481.  
  4482. if(item->GetCount() == g_bItemCountLimit)
  4483. continue;
  4484.  
  4485. if (item->IsStackable() && !IS_SET(item->GetAntiFlag(), ITEM_ANTIFLAG_STACK))
  4486. {
  4487. for (int j = i; j < INVENTORY_MAX_NUM; ++j)
  4488. {
  4489. LPITEM item2 = ch->GetInventoryItem(j);
  4490.  
  4491. if(!item2)
  4492. continue;
  4493.  
  4494. if(item2->isLocked())
  4495. continue;
  4496.  
  4497. if (item2->GetVnum() == item->GetVnum())
  4498. {
  4499. bool bStopSockets = false;
  4500.  
  4501. for (int k = 0; k < ITEM_SOCKET_MAX_NUM; ++k)
  4502. {
  4503. if (item2->GetSocket(k) != item->GetSocket(k))
  4504. {
  4505. bStopSockets = true;
  4506. break;
  4507. }
  4508. }
  4509.  
  4510. if(bStopSockets)
  4511. continue;
  4512.  
  4513. BYTE bAddCount = MIN(g_bItemCountLimit - item->GetCount(), item2->GetCount());
  4514.  
  4515. item->SetCount(item->GetCount() + bAddCount);
  4516. item2->SetCount(item2->GetCount() - bAddCount);
  4517.  
  4518. continue;
  4519. }
  4520. }
  4521. }
  4522. }
  4523.  
  4524. ch->SetNextSortInventoryPulse(thecore_pulse() + PASSES_PER_SEC(60));
  4525. }
  4526.  
  4527. ACMD (do_sort_special_storage)
  4528. {
  4529. if (ch->IsDead() || ch->GetExchange() || ch->GetMyShop() || ch->GetShopOwner() || ch->IsOpenSafebox() || ch->IsCubeOpen())
  4530. {
  4531. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Nu poti staca itemele cu aceasta fereastra deschisa."));
  4532. return;
  4533. }
  4534.  
  4535. int lastSortSpecialStoragePulse = ch->GetSortSpecialStoragePulse();
  4536. int currentPulse = thecore_pulse();
  4537.  
  4538. if (lastSortSpecialStoragePulse > currentPulse) {
  4539. int deltaInSeconds = ((lastSortSpecialStoragePulse / PASSES_PER_SEC(1)) - (currentPulse / PASSES_PER_SEC(1)));
  4540. int minutes = deltaInSeconds / 60;
  4541. int seconds = (deltaInSeconds - (minutes * 60));
  4542.  
  4543. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Poti staca iar itemele in %02d secunde."), seconds);
  4544. return;
  4545. }
  4546.  
  4547.  
  4548. for (int m = 0; m < 3; m++)
  4549. {
  4550. for (int i = 0; i < SPECIAL_INVENTORY_MAX_NUM; ++i)
  4551. {
  4552. LPITEM item;
  4553.  
  4554. switch(m)
  4555. {
  4556. case 0:
  4557. item = ch->GetUpgradeInventoryItem(i);
  4558. break;
  4559. case 1:
  4560. item = ch->GetBookInventoryItem(i);
  4561. break;
  4562. case 2:
  4563. item = ch->GetStoneInventoryItem(i);
  4564. break;
  4565. default:
  4566. item = ch->GetUpgradeInventoryItem(i);
  4567. break;
  4568. }
  4569.  
  4570. if(!item)
  4571. continue;
  4572.  
  4573. if(item->isLocked())
  4574. continue;
  4575.  
  4576. if(item->GetCount() == g_bItemCountLimit)
  4577. continue;
  4578.  
  4579. if (item->IsStackable() && !IS_SET(item->GetAntiFlag(), ITEM_ANTIFLAG_STACK))
  4580. {
  4581. for (int j = i; j < SPECIAL_INVENTORY_MAX_NUM; ++j)
  4582. {
  4583.  
  4584. LPITEM item2;
  4585.  
  4586. switch(m)
  4587. {
  4588. case 0:
  4589. item2 = ch->GetUpgradeInventoryItem(j);
  4590. break;
  4591. case 1:
  4592. item2 = ch->GetBookInventoryItem(j);
  4593. break;
  4594. case 2:
  4595. item2 = ch->GetStoneInventoryItem(j);
  4596. break;
  4597. default:
  4598. item2 = ch->GetUpgradeInventoryItem(j);
  4599. break;
  4600. }
  4601.  
  4602. if(!item2)
  4603. continue;
  4604.  
  4605. if(item2->isLocked())
  4606. continue;
  4607.  
  4608. if (item2->GetVnum() == item->GetVnum())
  4609. {
  4610. bool bStopSockets = false;
  4611.  
  4612. for (int k = 0; k < ITEM_SOCKET_MAX_NUM; ++k)
  4613. {
  4614. if (item2->GetSocket(k) != item->GetSocket(k))
  4615. {
  4616. bStopSockets = true;
  4617. break;
  4618. }
  4619. }
  4620.  
  4621. if(bStopSockets)
  4622. continue;
  4623.  
  4624. BYTE bAddCount = MIN(g_bItemCountLimit - item->GetCount(), item2->GetCount());
  4625.  
  4626. item->SetCount(item->GetCount() + bAddCount);
  4627. item2->SetCount(item2->GetCount() - bAddCount);
  4628.  
  4629. continue;
  4630. }
  4631. }
  4632. }
  4633. }
  4634. }
  4635.  
  4636. ch->SetNextSortSpecialStoragePulse(thecore_pulse() + PASSES_PER_SEC(60));
  4637. }
  4638. #endif
  4639.  
  4640. ACMD(do_cards)
  4641. {
  4642. const char *line;
  4643.  
  4644. char arg1[256], arg2[256];
  4645.  
  4646. line = two_arguments(argument, arg1, sizeof(arg1), arg2, sizeof(arg2));
  4647. switch (LOWER(arg1[0]))
  4648. {
  4649. case 'o': // open
  4650. if (isdigit(*arg2))
  4651. {
  4652. DWORD safemode;
  4653. str_to_number(safemode, arg2);
  4654. ch->Cards_open(safemode);
  4655. }
  4656. break;
  4657. case 'p': // open
  4658. ch->Cards_pullout();
  4659. break;
  4660. case 'e': // open
  4661. ch->CardsEnd();
  4662. break;
  4663. case 'd': // open
  4664. if (isdigit(*arg2))
  4665. {
  4666. DWORD destroy_index;
  4667. str_to_number(destroy_index, arg2);
  4668. ch->CardsDestroy(destroy_index);
  4669. }
  4670. break;
  4671. case 'a': // open
  4672. if (isdigit(*arg2))
  4673. {
  4674. DWORD accpet_index;
  4675. str_to_number(accpet_index, arg2);
  4676. ch->CardsAccept(accpet_index);
  4677. }
  4678. break;
  4679. case 'r': // open
  4680. if (isdigit(*arg2))
  4681. {
  4682. DWORD restore_index;
  4683. str_to_number(restore_index, arg2);
  4684. ch->CardsRestore(restore_index);
  4685. }
  4686. break;
  4687. default:
  4688. return;
  4689. }
  4690. }
  4691. ACMD(do_daily_reward_reload){
  4692. if (!ch)
  4693. return;
  4694.  
  4695. ch->ChatPacket(CHAT_TYPE_COMMAND, "ManagerGiftSystem DeleteRewards|");
  4696. char* time;
  4697. char* rewards;
  4698. char* items;
  4699. char* counts;
  4700. SQLMsg * pkMsg(DBManager::instance().DirectQuery("SELECT UNIX_TIMESTAMP(time),reward from player.daily_reward_status where pid = %u",ch->GetPlayerID()));
  4701. SQLResult * pRes = pkMsg->Get();
  4702. if (pRes->uiNumRows > 0){
  4703. MYSQL_ROW row;
  4704. while ((row = mysql_fetch_row(pRes->pSQLResult)) != NULL){
  4705. time = row[0];
  4706. rewards = row[1];
  4707. }
  4708. }
  4709. else{
  4710. DBManager::Instance().DirectQuery("INSERT INTO player.daily_reward_status (pid,time,reward,total_rewards) VALUES(%u,NOW(),0,0)", ch->GetPlayerID());
  4711. SQLMsg * pkMsg2(DBManager::instance().DirectQuery("SELECT UNIX_TIMESTAMP(time), reward from player.daily_reward_status where pid = %u",ch->GetPlayerID()));
  4712. SQLResult * pRes2 = pkMsg2->Get();
  4713. if (pRes2->uiNumRows > 0){
  4714. MYSQL_ROW row;
  4715. while ((row = mysql_fetch_row(pRes2->pSQLResult)) != NULL){
  4716. time = row[0];
  4717. rewards = row[1];
  4718. }
  4719. }
  4720. }
  4721.  
  4722. SQLMsg * pkMsg3(DBManager::instance().DirectQuery("SELECT items, count from player.daily_reward_items where reward = '%s'",rewards));
  4723. SQLResult * pRes3 = pkMsg3->Get();
  4724. if (pRes3->uiNumRows > 0){
  4725. MYSQL_ROW row;
  4726. while ((row = mysql_fetch_row(pRes3->pSQLResult)) != NULL){
  4727. items = row[0];
  4728. counts = row[1];
  4729. ch->ChatPacket(CHAT_TYPE_COMMAND, "ManagerGiftSystem SetReward|%s|%s",items,counts);
  4730. }
  4731. }
  4732.  
  4733. ch->ChatPacket(CHAT_TYPE_COMMAND, "ManagerGiftSystem SetTime|%s",time);
  4734. ch->ChatPacket(CHAT_TYPE_COMMAND, "ManagerGiftSystem SetDailyReward|%s", rewards);
  4735. ch->ChatPacket(CHAT_TYPE_COMMAND, "ManagerGiftSystem SetRewardDone|");
  4736. }
  4737.  
  4738. ACMD(do_daily_reward_get_reward){
  4739. if (!ch)
  4740. return;
  4741.  
  4742. char* items;
  4743. char* counts;
  4744. DWORD item;
  4745. DWORD count;
  4746. bool reward = false;
  4747. char* rewards;
  4748. // and (NOW() - interval 30 minute > time)
  4749. SQLMsg * pkMsg(DBManager::instance().DirectQuery("SELECT reward from player.daily_reward_status where (NOW() > time) and pid = %u", ch->GetPlayerID()));
  4750. SQLResult * pRes = pkMsg->Get();
  4751. if (pRes->uiNumRows > 0){
  4752. MYSQL_ROW row;
  4753. while ((row = mysql_fetch_row(pRes->pSQLResult)) != NULL){
  4754. rewards = row[0];
  4755. }
  4756. reward = true;
  4757. }
  4758.  
  4759. if (reward){
  4760. SQLMsg * pkMsg2(DBManager::instance().DirectQuery("SELECT items, count from player.daily_reward_items where reward = '%s' ORDER BY RAND() limit 1",rewards));
  4761. SQLResult * pRes2 = pkMsg2->Get();
  4762. if (pRes2->uiNumRows > 0){
  4763. MYSQL_ROW row;
  4764. while ((row = mysql_fetch_row(pRes2->pSQLResult)) != NULL){
  4765. items = row[0];
  4766. counts = row[1];
  4767. }
  4768. }
  4769. str_to_number(item, items);
  4770. str_to_number(count, counts);
  4771. ch->AutoGiveItem(item, count);
  4772. // ch->ChatPacket(CHAT_TYPE_INFO, "recompensa: %s",items);
  4773. DBManager::Instance().DirectQuery("UPDATE daily_reward_status SET reward = CASE WHEN reward = 0 THEN '1' WHEN reward = 1 THEN '2' WHEN reward = 2 THEN '3' WHEN reward = 3 THEN '4' WHEN reward = 4 THEN '5' WHEN reward = 5 THEN '6' WHEN reward = 6 THEN '0' END, total_rewards = total_rewards +1, time = (NOW() + interval 1 day) WHERE pid = %u", ch->GetPlayerID());
  4774. }
  4775. else{
  4776. ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Nu au trecut 24h de la ultima recompensa"));
  4777. }
  4778. }
  4779.  
  4780. #ifdef __BATTLE_PASS__
  4781. ACMD(open_battlepass)
  4782. {
  4783. if (ch->v_counts.empty())
  4784. return;
  4785.  
  4786. if (ch->missions_bp.empty())
  4787. return;
  4788.  
  4789. if (ch->IsOpenSafebox() || ch->IsDead() || ch->GetExchange() || ch->GetMyShop())
  4790. {
  4791. ch->ChatPacket(CHAT_TYPE_INFO, "Nu poti face asta!");
  4792. return;
  4793. }
  4794.  
  4795. time_t cur_Time = time(NULL);
  4796. struct tm vKey = *localtime(&cur_Time);
  4797.  
  4798. int month = vKey.tm_mon;
  4799.  
  4800. if (month != ch->iMonthBattlePass)
  4801. {
  4802. ch->ChatPacket(CHAT_TYPE_INFO, "Time Expire!");
  4803. return;
  4804. }
  4805.  
  4806. for (int i=0; i<ch->missions_bp.size(); ++i)
  4807. {
  4808. ch->ChatPacket(CHAT_TYPE_COMMAND, "missions_bp %d %d %d %d", i, ch->missions_bp[i].type, ch->missions_bp[i].vnum, ch->missions_bp[i].count);
  4809. ch->ChatPacket(CHAT_TYPE_COMMAND, "info_missions_bp %d %d %d %s", i, ch->v_counts[i].count, ch->v_counts[i].status, ch->rewards_bp[i].name);
  4810. ch->ChatPacket(CHAT_TYPE_COMMAND, "rewards_missions_bp %d %d %d %d %d %d %d", i, ch->rewards_bp[i].vnum1, ch->rewards_bp[i].vnum2, ch->rewards_bp[i].vnum3, ch->rewards_bp[i].count1, ch->rewards_bp[i].count2 ,ch->rewards_bp[i].count3);
  4811. }
  4812.  
  4813. ch->ChatPacket(CHAT_TYPE_COMMAND, "size_missions_bp %d ", ch->missions_bp.size());
  4814. ch->ChatPacket(CHAT_TYPE_COMMAND, "final_reward %d %d %d %d %d %d", ch->final_rewards[0].f_vnum1, ch->final_rewards[0].f_vnum2, ch->final_rewards[0].f_vnum3, ch->final_rewards[0].f_count1, ch->final_rewards[0].f_count2 ,ch->final_rewards[0].f_count3);
  4815. ch->ChatPacket(CHAT_TYPE_COMMAND, "show_battlepass");
  4816. }
  4817.  
  4818. ACMD(final_reward_battlepass)
  4819. {
  4820. if (ch->v_counts.empty())
  4821. return;
  4822.  
  4823. if (ch->missions_bp.empty())
  4824. return;
  4825.  
  4826. if (ch->v_counts[0].status == 2)
  4827. return;
  4828.  
  4829. if (ch->IsOpenSafebox() || ch->IsDead() || ch->GetExchange() || ch->GetMyShop())
  4830. {
  4831. ch->ChatPacket(CHAT_TYPE_INFO, "Nu poti face asta!");
  4832. return;
  4833. }
  4834.  
  4835. time_t cur_Time = time(NULL);
  4836. struct tm vKey = *localtime(&cur_Time);
  4837.  
  4838. int month = vKey.tm_mon;
  4839.  
  4840. if (month != ch->iMonthBattlePass)
  4841. {
  4842. ch->ChatPacket(CHAT_TYPE_INFO, "Time Expire!");
  4843. return;
  4844. }
  4845.  
  4846. for (int i=0; i<ch->missions_bp.size(); ++i)
  4847. {
  4848. if (ch->missions_bp[i].count != ch->v_counts[i].count)
  4849. {
  4850. ch->ChatPacket(CHAT_TYPE_INFO, "Nu ai completat toate misiunile!");
  4851. return;
  4852. }
  4853. }
  4854.  
  4855. ch->FinalRewardBattlePass();
  4856. }
  4857. #endif
  4858.  
Advertisement
Add Comment
Please, Sign In to add comment