Guest User

cmd_general.cpp

a guest
Mar 26th, 2020
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 80.54 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. #ifdef NEW_PET_SYSTEM
  14. #include "New_PetSystem.h"
  15. #endif
  16. #include "char_manager.h"
  17. #include "motion.h"
  18. #include "packet.h"
  19. #include "affect.h"
  20. #include "pvp.h"
  21. #include "start_position.h"
  22. #include "party.h"
  23. #include "guild_manager.h"
  24. #include "p2p.h"
  25. #include "dungeon.h"
  26. #include "messenger_manager.h"
  27. #include "war_map.h"
  28. #include "questmanager.h"
  29. #include "item_manager.h"
  30. #include "monarch.h"
  31. #include "mob_manager.h"
  32. #include "dev_log.h"
  33. #include "item.h"
  34. #include "arena.h"
  35. #include "buffer_manager.h"
  36. #include "unique_item.h"
  37. #include "threeway_war.h"
  38. #include "log.h"
  39. #include "../../common/VnumHelper.h"
  40. #ifdef __AUCTION__
  41. #include "auction_manager.h"
  42. #endif
  43.  
  44. extern int g_server_id;
  45.  
  46. extern int g_nPortalLimitTime;
  47.  
  48. ACMD(do_user_horse_ride)
  49. {
  50.     if (ch->IsObserverMode())
  51.         return;
  52.  
  53.     if (ch->IsDead() || ch->IsStun())
  54.         return;
  55.  
  56.     if (ch->IsHorseRiding() == false)
  57.     {
  58.         // ���� �ƴ� �ٸ�Ż���� Ÿ���ִ�.
  59.         if (ch->GetMountVnum())
  60.         {
  61.             ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("�̹� Ż���� �̿����Դϴ�."));
  62.             return;
  63.         }
  64.  
  65.         if (ch->GetHorse() == NULL)
  66.         {
  67.             ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("���� ���� ��ȯ���ּ���."));
  68.             return;
  69.         }
  70.  
  71.         ch->StartRiding();
  72.     }
  73.     else
  74.     {
  75.         ch->StopRiding();
  76.     }
  77. }
  78.  
  79. ACMD(do_user_horse_back)
  80. {
  81.     if (ch->GetHorse() != NULL)
  82.     {
  83.         ch->HorseSummon(false);
  84.         ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("���� �������½��ϴ�."));
  85.     }
  86.     else if (ch->IsHorseRiding() == true)
  87.     {
  88.         ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("������ ���� ������ �մϴ�."));
  89.     }
  90.     else
  91.     {
  92.         ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("���� ���� ��ȯ���ּ���."));
  93.     }
  94. }
  95.  
  96. ACMD(do_user_horse_feed)
  97. {
  98.     // ���λ����� �� ���¿����� �� ���̸� �� �� ����.
  99.     if (ch->GetMyShop())
  100.         return;
  101.  
  102.     if (ch->GetHorse() == NULL)
  103.     {
  104.         if (ch->IsHorseRiding() == false)
  105.             ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("���� ���� ��ȯ���ּ���."));
  106.         else
  107.             ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("���� ź ���¿����� ���̸� �� �� �����ϴ�."));
  108.         return;
  109.     }
  110.  
  111.     DWORD dwFood = ch->GetHorseGrade() + 50054 - 1;
  112.  
  113.     if (ch->CountSpecifyItem(dwFood) > 0)
  114.     {
  115.         ch->RemoveSpecifyItem(dwFood, 1);
  116.         ch->FeedHorse();
  117.         ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("������ %s%s �־����ϴ�."),
  118.                 ITEM_MANAGER::instance().GetTable(dwFood)->szLocaleName,
  119.                 g_iUseLocale ? "" : under_han(ITEM_MANAGER::instance().GetTable(dwFood)->szLocaleName) ? LC_TEXT("��") : LC_TEXT("��"));
  120.     }
  121.     else
  122.     {
  123.         ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("%s �������� �ʿ��մϴ�"), ITEM_MANAGER::instance().GetTable(dwFood)->szLocaleName);
  124.     }
  125. }
  126.  
  127. #define MAX_REASON_LEN      128
  128.  
  129. EVENTINFO(TimedEventInfo)
  130. {
  131.     DynamicCharacterPtr ch;
  132.     int     subcmd;
  133.     int             left_second;
  134.     char        szReason[MAX_REASON_LEN];
  135.  
  136.     TimedEventInfo()
  137.     : ch()
  138.     , subcmd( 0 )
  139.     , left_second( 0 )
  140.     {
  141.         ::memset( szReason, 0, MAX_REASON_LEN );
  142.     }
  143. };
  144.  
  145. #ifdef ENABLE_CHANGE_CHANNEL
  146. EVENTINFO(ChangeChannelEventInfo)
  147. {
  148.     DynamicCharacterPtr ch;
  149.     int             channel_number;
  150.     int             left_second;
  151.  
  152.     ChangeChannelEventInfo()
  153.     : ch()
  154.     , channel_number( 0 )
  155.     , left_second( 0 )
  156.     {
  157.     }
  158. };
  159. #endif
  160.  
  161. struct SendDisconnectFunc
  162. {
  163.     void operator () (LPDESC d)
  164.     {
  165.         if (d->GetCharacter())
  166.         {
  167.             if (d->GetCharacter()->GetGMLevel() == GM_PLAYER)
  168.                 d->GetCharacter()->ChatPacket(CHAT_TYPE_COMMAND, "quit Shutdown(SendDisconnectFunc)");
  169.         }
  170.     }
  171. };
  172.  
  173. struct DisconnectFunc
  174. {
  175.     void operator () (LPDESC d)
  176.     {
  177.         if (d->GetType() == DESC_TYPE_CONNECTOR)
  178.             return;
  179.  
  180.         if (d->IsPhase(PHASE_P2P))
  181.             return;
  182.  
  183.         if (d->GetCharacter())
  184.             d->GetCharacter()->Disconnect("Shutdown(DisconnectFunc)");
  185.  
  186.         d->SetPhase(PHASE_CLOSE);
  187.     }
  188. };
  189.  
  190. EVENTINFO(shutdown_event_data)
  191. {
  192.     int seconds;
  193.  
  194.     shutdown_event_data()
  195.     : seconds( 0 )
  196.     {
  197.     }
  198. };
  199.  
  200. EVENTFUNC(shutdown_event)
  201. {
  202.     shutdown_event_data* info = dynamic_cast<shutdown_event_data*>( event->info );
  203.  
  204.     if ( info == NULL )
  205.     {
  206.         sys_err( "shutdown_event> <Factor> Null pointer" );
  207.         return 0;
  208.     }
  209.  
  210.     int * pSec = & (info->seconds);
  211.  
  212.     if (*pSec < 0)
  213.     {
  214.         sys_log(0, "shutdown_event sec %d", *pSec);
  215.  
  216.         if (--*pSec == -10)
  217.         {
  218.             const DESC_MANAGER::DESC_SET & c_set_desc = DESC_MANAGER::instance().GetClientSet();
  219.             std::for_each(c_set_desc.begin(), c_set_desc.end(), DisconnectFunc());
  220.             return passes_per_sec;
  221.         }
  222.         else if (*pSec < -10)
  223.             return 0;
  224.  
  225.         return passes_per_sec;
  226.     }
  227.     else if (*pSec == 0)
  228.     {
  229.         const DESC_MANAGER::DESC_SET & c_set_desc = DESC_MANAGER::instance().GetClientSet();
  230.         std::for_each(c_set_desc.begin(), c_set_desc.end(), SendDisconnectFunc());
  231.         g_bNoMoreClient = true;
  232.         --*pSec;
  233.         return passes_per_sec;
  234.     }
  235.     else
  236.     {
  237.         char buf[64];
  238.         snprintf(buf, sizeof(buf), LC_TEXT("�˴ٿ��� %d�� ���ҽ��ϴ�."), *pSec);
  239.         SendNotice(buf);
  240.  
  241.         --*pSec;
  242.         return passes_per_sec;
  243.     }
  244. }
  245.  
  246. void Shutdown(int iSec)
  247. {
  248.     if (g_bNoMoreClient)
  249.     {
  250.         thecore_shutdown();
  251.         return;
  252.     }
  253.  
  254.     CWarMapManager::instance().OnShutdown();
  255.  
  256.     char buf[64];
  257.     snprintf(buf, sizeof(buf), LC_TEXT("%d�� �� ������ �˴ٿ� �˴ϴ�."), iSec);
  258.  
  259.     SendNotice(buf);
  260.  
  261.     shutdown_event_data* info = AllocEventInfo<shutdown_event_data>();
  262.     info->seconds = iSec;
  263.  
  264.     event_create(shutdown_event, info, 1);
  265. }
  266.  
  267. ACMD(do_shutdown)
  268. {
  269.     if (NULL == ch)
  270.     {
  271.         sys_err("Accept shutdown command from %s.", ch->GetName());
  272.     }
  273.     TPacketGGShutdown p;
  274.     p.bHeader = HEADER_GG_SHUTDOWN;
  275.     P2P_MANAGER::instance().Send(&p, sizeof(TPacketGGShutdown));
  276.  
  277.     Shutdown(10);
  278. }
  279.  
  280. EVENTFUNC(timed_event)
  281. {
  282.     TimedEventInfo * info = dynamic_cast<TimedEventInfo *>( event->info );
  283.    
  284.     if ( info == NULL )
  285.     {
  286.         sys_err( "timed_event> <Factor> Null pointer" );
  287.         return 0;
  288.     }
  289.  
  290.     LPCHARACTER ch = info->ch;
  291.     if (ch == NULL) { // <Factor>
  292.         return 0;
  293.     }
  294.     LPDESC d = ch->GetDesc();
  295.  
  296.     if (info->left_second <= 0)
  297.     {
  298.         ch->m_pkTimedEvent = NULL;
  299.  
  300.         if (true == LC_IsEurope() || true == LC_IsYMIR() || true == LC_IsKorea())
  301.         {
  302.             switch (info->subcmd)
  303.             {
  304.                 case SCMD_LOGOUT:
  305.                 case SCMD_QUIT:
  306.                 case SCMD_PHASE_SELECT:
  307.                     {
  308.                         TPacketNeedLoginLogInfo acc_info;
  309.                         acc_info.dwPlayerID = ch->GetDesc()->GetAccountTable().id;
  310.  
  311.                         db_clientdesc->DBPacket( HEADER_GD_VALID_LOGOUT, 0, &acc_info, sizeof(acc_info) );
  312.  
  313.                         LogManager::instance().DetailLoginLog( false, ch );
  314.                     }
  315.                     break;
  316.             }
  317.         }
  318.  
  319.         switch (info->subcmd)
  320.         {
  321.             case SCMD_LOGOUT:
  322.                 if (d)
  323.                     d->SetPhase(PHASE_CLOSE);
  324.                 break;
  325.  
  326.             case SCMD_QUIT:
  327.                 ch->ChatPacket(CHAT_TYPE_COMMAND, "quit");
  328.                 break;
  329.  
  330.             case SCMD_PHASE_SELECT:
  331.                 {
  332.                     ch->Disconnect("timed_event - SCMD_PHASE_SELECT");
  333.  
  334.                     if (d)
  335.                     {
  336.                         d->SetPhase(PHASE_SELECT);
  337.                     }
  338.                 }
  339.                 break;
  340.         }
  341.  
  342.         return 0;
  343.     }
  344.     else
  345.     {
  346.         ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("%d�� ���ҽ��ϴ�."), info->left_second);
  347.         --info->left_second;
  348.     }
  349.  
  350.     return PASSES_PER_SEC(1);
  351. }
  352.  
  353. #ifdef ENABLE_CHANGE_CHANNEL
  354. EVENTFUNC(change_channel_event)
  355. {
  356.     ChangeChannelEventInfo * info = dynamic_cast<ChangeChannelEventInfo *>( event->info );
  357.  
  358.     if ( info == NULL )
  359.     {
  360.         sys_err( "change_channel_event> <Factor> Null pointer" );
  361.         return 0;
  362.     }
  363.  
  364.     LPCHARACTER ch = info->ch;
  365.     if (ch == NULL) { // <Factor>
  366.         return 0;
  367.     }
  368.  
  369.     if (info->left_second <= 0)
  370.     {
  371.         ch->m_pkChangeChannelEvent = NULL;
  372.  
  373.         ch->ChangeChannel(info->channel_number);
  374.    
  375.         return 0;
  376.     }
  377.     else
  378.     {
  379.         ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Change channel in %d seconds."), info->left_second);
  380.         --info->left_second;
  381.     }
  382.  
  383.     return PASSES_PER_SEC(1);
  384. }
  385. #endif
  386.  
  387. #ifdef ENABLE_CHANGE_CHANNEL
  388. ACMD(do_change_channel)
  389. {
  390.     char arg1[256];
  391.     one_argument(argument, arg1, sizeof(arg1));
  392.  
  393.     DWORD channel_number = 0;
  394.     str_to_number(channel_number, arg1);
  395.    
  396.     //if (ch->m_pkChangeChannelEvent)
  397.     //{
  398.     //  ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Change channel canceled."));
  399.     //  event_cancel(&ch->m_pkChangeChannelEvent);
  400.     //  return;
  401.     //}
  402.    
  403.     if(!ch)
  404.     {
  405.         return;
  406.     }
  407.    
  408.     if(channel_number == 99 || g_bChannel == 99){
  409.         ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("You can't change channel in this map."));
  410.         return;    
  411.     }
  412.    
  413.     if(channel_number == g_bChannel)
  414.     {
  415.         ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("You are already in this channel."));
  416.         return;    
  417.     }
  418.    
  419.     if (ch->IsDead() || !ch->CanWarp())
  420.     {
  421.         ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("You can't do that now. Wait 10 seconds and try again."));
  422.         return;
  423.     }
  424.    
  425.     if(channel_number <= 0 || channel_number > 6)
  426.     {
  427.         ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("This channel is not valid."));
  428.         return;
  429.     }
  430.    
  431.     if (channel_number != 0)
  432.     {
  433.         if (ch->m_pkChangeChannelEvent)
  434.         {
  435.             ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Change channel canceled."));
  436.             event_cancel(&ch->m_pkChangeChannelEvent);
  437.             return;
  438.         }
  439.    
  440.         ChangeChannelEventInfo* info = AllocEventInfo<ChangeChannelEventInfo>();
  441.    
  442.         {
  443.             if (ch->IsPosition(POS_FIGHTING))
  444.                 info->left_second = 10;
  445.             else
  446.                 info->left_second = 3;
  447.         }
  448.    
  449.         info->ch                    = ch;
  450.         info->channel_number        = channel_number;
  451.    
  452.         ch->m_pkChangeChannelEvent  = event_create(change_channel_event, info, 1);
  453.     }
  454. }
  455. #endif
  456.  
  457. ACMD(do_cmd)
  458. {
  459.     /* RECALL_DELAY
  460.        if (ch->m_pkRecallEvent != NULL)
  461.        {
  462.        ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("��� �Ǿ����ϴ�."));
  463.        event_cancel(&ch->m_pkRecallEvent);
  464.        return;
  465.        }
  466.     // END_OF_RECALL_DELAY */
  467.  
  468.     if (ch->m_pkTimedEvent)
  469.     {
  470.         ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("��� �Ǿ����ϴ�."));
  471.         event_cancel(&ch->m_pkTimedEvent);
  472.         return;
  473.     }
  474.  
  475.     switch (subcmd)
  476.     {
  477.         case SCMD_LOGOUT:
  478.             ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("�α��� ȭ������ ���� ���ϴ�. ��ø� ��ٸ�����."));
  479.             break;
  480.  
  481.         case SCMD_QUIT:
  482.             ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("������ ���� �մϴ�. ��ø� ��ٸ�����."));
  483.             break;
  484.  
  485.         case SCMD_PHASE_SELECT:
  486.             ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ij���͸� ��ȯ �մϴ�. ��ø� ��ٸ�����."));
  487.             break;
  488.     }
  489.  
  490.     int nExitLimitTime = 10;
  491.  
  492.     if (ch->IsHack(false, true, nExitLimitTime) &&
  493.         false == CThreeWayWar::instance().IsSungZiMapIndex(ch->GetMapIndex()) &&
  494.         (!ch->GetWarMap() || ch->GetWarMap()->GetType() == GUILD_WAR_TYPE_FLAG))
  495.     {
  496.         return;
  497.     }
  498.    
  499.     switch (subcmd)
  500.     {
  501.         case SCMD_LOGOUT:
  502.         case SCMD_QUIT:
  503.         case SCMD_PHASE_SELECT:
  504.             {
  505.                 TimedEventInfo* info = AllocEventInfo<TimedEventInfo>();
  506.  
  507.                 {
  508.                     if (ch->IsPosition(POS_FIGHTING))
  509.                         info->left_second = 10;
  510.                     else
  511.                         info->left_second = 3;
  512.                 }
  513.  
  514.                 info->ch        = ch;
  515.                 info->subcmd        = subcmd;
  516.                 strlcpy(info->szReason, argument, sizeof(info->szReason));
  517.  
  518.                 ch->m_pkTimedEvent  = event_create(timed_event, info, 1);
  519.             }
  520.             break;
  521.     }
  522. }
  523.  
  524. ACMD(do_mount)
  525. {
  526.     /*
  527.        char         arg1[256];
  528.        struct action_mount_param    param;
  529.  
  530.     // �̹� Ÿ�� ������
  531.     if (ch->GetMountingChr())
  532.     {
  533.     char arg2[256];
  534.     two_arguments(argument, arg1, sizeof(arg1), arg2, sizeof(arg2));
  535.  
  536.     if (!*arg1 || !*arg2)
  537.     return;
  538.  
  539.     param.x     = atoi(arg1);
  540.     param.y     = atoi(arg2);
  541.     param.vid   = ch->GetMountingChr()->GetVID();
  542.     param.is_unmount = true;
  543.  
  544.     float distance = DISTANCE_SQRT(param.x - (DWORD) ch->GetX(), param.y - (DWORD) ch->GetY());
  545.  
  546.     if (distance > 600.0f)
  547.     {
  548.     ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("�� �� ������ ���� ��������."));
  549.     return;
  550.     }
  551.  
  552.     action_enqueue(ch, ACTION_TYPE_MOUNT, &param, 0.0f, true);
  553.     return;
  554.     }
  555.  
  556.     one_argument(argument, arg1, sizeof(arg1));
  557.  
  558.     if (!*arg1)
  559.     return;
  560.  
  561.     LPCHARACTER tch = CHARACTER_MANAGER::instance().Find(atoi(arg1));
  562.  
  563.     if (!tch->IsNPC() || !tch->IsMountable())
  564.     {
  565.     ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("�ű⿡�� Ż �� �����."));
  566.     return;
  567.     }
  568.  
  569.     float distance = DISTANCE_SQRT(tch->GetX() - ch->GetX(), tch->GetY() - ch->GetY());
  570.  
  571.     if (distance > 600.0f)
  572.     {
  573.     ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("�� �� ������ ���� Ÿ����."));
  574.     return;
  575.     }
  576.  
  577.     param.vid       = tch->GetVID();
  578.     param.is_unmount    = false;
  579.  
  580.     action_enqueue(ch, ACTION_TYPE_MOUNT, &param, 0.0f, true);
  581.      */
  582. }
  583.  
  584. ACMD(do_fishing)
  585. {
  586.     char arg1[256];
  587.     one_argument(argument, arg1, sizeof(arg1));
  588.  
  589.     if (!*arg1)
  590.         return;
  591.  
  592.     ch->SetRotation(atof(arg1));
  593.     ch->fishing();
  594. }
  595.  
  596. ACMD(do_console)
  597. {
  598.     ch->ChatPacket(CHAT_TYPE_COMMAND, "ConsoleEnable");
  599. }
  600.  
  601. ACMD(do_restart)
  602. {
  603.     if (false == ch->IsDead())
  604.     {
  605.         ch->ChatPacket(CHAT_TYPE_COMMAND, "CloseRestartWindow");
  606.         ch->StartRecoveryEvent();
  607.         return;
  608.     }
  609.  
  610.     if (NULL == ch->m_pkDeadEvent)
  611.         return;
  612.  
  613.     int iTimeToDead = (event_time(ch->m_pkDeadEvent) / passes_per_sec);
  614.  
  615.     if (subcmd != SCMD_RESTART_TOWN && (!ch->GetWarMap() || ch->GetWarMap()->GetType() == GUILD_WAR_TYPE_FLAG))
  616.     {
  617.         if (!test_server)
  618.         {
  619.             if (ch->IsHack())
  620.             {
  621.                 //���� ���ϰ�쿡�� üũ ���� �ʴ´�.
  622.                 if (false == CThreeWayWar::instance().IsSungZiMapIndex(ch->GetMapIndex()))
  623.                 {
  624.                     ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("���� ����� �� �� �����ϴ�. (%d�� ����)"), iTimeToDead - (180 - g_nPortalLimitTime));
  625.                     return;
  626.                 }
  627.             }
  628.  
  629.             if (iTimeToDead > 170)
  630.             {
  631.                 ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("���� ����� �� �� �����ϴ�. (%d�� ����)"), iTimeToDead - 170);
  632.                 return;
  633.             }
  634.         }
  635.     }
  636.  
  637.     //PREVENT_HACK
  638.     //DESC : â��, ��ȯ â �� ��Ż�� ����ϴ� ���׿� �̿�ɼ� �־
  639.     //      ��Ÿ���� �߰�
  640.     if (subcmd == SCMD_RESTART_TOWN)
  641.     {
  642.         if (ch->IsHack())
  643.         {
  644.             //����, �����ʿ����� üũ ���� �ʴ´�.
  645.             if ((!ch->GetWarMap() || ch->GetWarMap()->GetType() == GUILD_WAR_TYPE_FLAG) ||
  646.                 false == CThreeWayWar::instance().IsSungZiMapIndex(ch->GetMapIndex()))
  647.             {
  648.                 ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("���� ����� �� �� �����ϴ�. (%d�� ����)"), iTimeToDead - (180 - g_nPortalLimitTime));
  649.                 return;
  650.             }
  651.         }
  652.  
  653.         if (iTimeToDead > 173)
  654.         {
  655.             ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("���� �������� ����� �� �� �����ϴ�. (%d �� ����)"), iTimeToDead - 173);
  656.             return;
  657.         }
  658.     }
  659.     //END_PREVENT_HACK
  660.  
  661.     ch->ChatPacket(CHAT_TYPE_COMMAND, "CloseRestartWindow");
  662.  
  663.     ch->GetDesc()->SetPhase(PHASE_GAME);
  664.     ch->SetPosition(POS_STANDING);
  665.     ch->StartRecoveryEvent();
  666.  
  667.     //FORKED_LOAD
  668.     //DESC: ��Ÿ� ������ ��Ȱ�� �Ұ�� ���� �Ա��� �ƴ� ��Ÿ� ������ ������������ �̵��ϰ� �ȴ�.
  669.     if (1 == quest::CQuestManager::instance().GetEventFlag("threeway_war"))
  670.     {
  671.         if (subcmd == SCMD_RESTART_TOWN || subcmd == SCMD_RESTART_HERE)
  672.         {
  673.             if (true == CThreeWayWar::instance().IsThreeWayWarMapIndex(ch->GetMapIndex()) &&
  674.                     false == CThreeWayWar::instance().IsSungZiMapIndex(ch->GetMapIndex()))
  675.             {
  676.                 ch->WarpSet(EMPIRE_START_X(ch->GetEmpire()), EMPIRE_START_Y(ch->GetEmpire()));
  677.  
  678.                 ch->ReviveInvisible(5);
  679.                 ch->PointChange(POINT_HP, ch->GetMaxHP() - ch->GetHP());
  680.                 ch->PointChange(POINT_SP, ch->GetMaxSP() - ch->GetSP());
  681.  
  682.                 return;
  683.             }
  684.  
  685.             //����
  686.             if (true == CThreeWayWar::instance().IsSungZiMapIndex(ch->GetMapIndex()))
  687.             {
  688.                 if (CThreeWayWar::instance().GetReviveTokenForPlayer(ch->GetPlayerID()) <= 0)
  689.                 {
  690.                     ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("�������� ��Ȱ ��ȸ�� ��� �Ҿ����ϴ�! ������ �̵��մϴ�!"));
  691.                     ch->WarpSet(EMPIRE_START_X(ch->GetEmpire()), EMPIRE_START_Y(ch->GetEmpire()));
  692.                 }
  693.                 else
  694.                 {
  695.                     ch->Show(ch->GetMapIndex(), GetSungziStartX(ch->GetEmpire()), GetSungziStartY(ch->GetEmpire()));
  696.                 }
  697.  
  698.                 ch->PointChange(POINT_HP, ch->GetMaxHP() - ch->GetHP());
  699.                 ch->PointChange(POINT_SP, ch->GetMaxSP() - ch->GetSP());
  700.                 ch->ReviveInvisible(5);
  701.  
  702.                 return;
  703.             }
  704.         }
  705.     }
  706.     //END_FORKED_LOAD
  707.  
  708.     if (ch->GetDungeon())
  709.         ch->GetDungeon()->UseRevive(ch);
  710.  
  711.     if (ch->GetWarMap() && !ch->IsObserverMode())
  712.     {
  713.         CWarMap * pMap = ch->GetWarMap();
  714.         DWORD dwGuildOpponent = pMap ? pMap->GetGuildOpponent(ch) : 0;
  715.  
  716.         if (dwGuildOpponent)
  717.         {
  718.             switch (subcmd)
  719.             {
  720.                 case SCMD_RESTART_TOWN:
  721.                     sys_log(0, "do_restart: restart town");
  722.                     PIXEL_POSITION pos;
  723.  
  724.                     if (CWarMapManager::instance().GetStartPosition(ch->GetMapIndex(), ch->GetGuild()->GetID() < dwGuildOpponent ? 0 : 1, pos))
  725.                         ch->Show(ch->GetMapIndex(), pos.x, pos.y);
  726.                     else
  727.                         ch->ExitToSavedLocation();
  728.  
  729.                     ch->PointChange(POINT_HP, ch->GetMaxHP() - ch->GetHP());
  730.                     ch->PointChange(POINT_SP, ch->GetMaxSP() - ch->GetSP());
  731.                     ch->ReviveInvisible(5);
  732.                     break;
  733.  
  734.                 case SCMD_RESTART_HERE:
  735.                     sys_log(0, "do_restart: restart here");
  736.                     ch->RestartAtSamePos();
  737.                     //ch->Show(ch->GetMapIndex(), ch->GetX(), ch->GetY());
  738.                     ch->PointChange(POINT_HP, ch->GetMaxHP() - ch->GetHP());
  739.                     ch->PointChange(POINT_SP, ch->GetMaxSP() - ch->GetSP());
  740.                     ch->ReviveInvisible(5);
  741.                     break;
  742.             }
  743.  
  744.             return;
  745.         }
  746.     }
  747.  
  748.     switch (subcmd)
  749.     {
  750.         case SCMD_RESTART_TOWN:
  751.             sys_log(0, "do_restart: restart town");
  752.             PIXEL_POSITION pos;
  753.  
  754.             if (SECTREE_MANAGER::instance().GetRecallPositionByEmpire(ch->GetMapIndex(), ch->GetEmpire(), pos))
  755.                 ch->WarpSet(pos.x, pos.y);
  756.             else
  757.                 ch->WarpSet(EMPIRE_START_X(ch->GetEmpire()), EMPIRE_START_Y(ch->GetEmpire()));
  758.  
  759.             ch->PointChange(POINT_HP, 50 - ch->GetHP());
  760.             ch->DeathPenalty(1);
  761.             break;
  762.  
  763.         case SCMD_RESTART_HERE:
  764.             sys_log(0, "do_restart: restart here");
  765.             ch->RestartAtSamePos();
  766.             //ch->Show(ch->GetMapIndex(), ch->GetX(), ch->GetY());
  767.             ch->PointChange(POINT_HP, 50 - ch->GetHP());
  768.             ch->DeathPenalty(0);
  769.             ch->ReviveInvisible(5);
  770.             break;
  771.     }
  772. }
  773.  
  774. #define MAX_STAT 125
  775.  
  776. ACMD(do_stat_reset)
  777. {
  778.     ch->PointChange(POINT_STAT_RESET_COUNT, 12 - ch->GetPoint(POINT_STAT_RESET_COUNT));
  779. }
  780.  
  781. ACMD(do_stat_minus)
  782. {
  783.     char arg1[256];
  784.     one_argument(argument, arg1, sizeof(arg1));
  785.  
  786.     if (!*arg1)
  787.         return;
  788.  
  789.     if (ch->IsPolymorphed())
  790.     {
  791.         ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("�а� �߿��� �ɷ��� �ø� �� �����ϴ�."));
  792.         return;
  793.     }
  794.  
  795.     if (ch->GetPoint(POINT_STAT_RESET_COUNT) <= 0)
  796.         return;
  797.  
  798.     if (!strcmp(arg1, "st"))
  799.     {
  800.         if (ch->GetRealPoint(POINT_ST) <= JobInitialPoints[ch->GetJob()].st)
  801.             return;
  802.  
  803.         ch->SetRealPoint(POINT_ST, ch->GetRealPoint(POINT_ST) - 1);
  804.         ch->SetPoint(POINT_ST, ch->GetPoint(POINT_ST) - 1);
  805.         ch->ComputePoints();
  806.         ch->PointChange(POINT_ST, 0);
  807.     }
  808.     else if (!strcmp(arg1, "dx"))
  809.     {
  810.         if (ch->GetRealPoint(POINT_DX) <= JobInitialPoints[ch->GetJob()].dx)
  811.             return;
  812.  
  813.         ch->SetRealPoint(POINT_DX, ch->GetRealPoint(POINT_DX) - 1);
  814.         ch->SetPoint(POINT_DX, ch->GetPoint(POINT_DX) - 1);
  815.         ch->ComputePoints();
  816.         ch->PointChange(POINT_DX, 0);
  817.     }
  818.     else if (!strcmp(arg1, "ht"))
  819.     {
  820.         if (ch->GetRealPoint(POINT_HT) <= JobInitialPoints[ch->GetJob()].ht)
  821.             return;
  822.  
  823.         ch->SetRealPoint(POINT_HT, ch->GetRealPoint(POINT_HT) - 1);
  824.         ch->SetPoint(POINT_HT, ch->GetPoint(POINT_HT) - 1);
  825.         ch->ComputePoints();
  826.         ch->PointChange(POINT_HT, 0);
  827.         ch->PointChange(POINT_MAX_HP, 0);
  828.     }
  829.     else if (!strcmp(arg1, "iq"))
  830.     {
  831.         if (ch->GetRealPoint(POINT_IQ) <= JobInitialPoints[ch->GetJob()].iq)
  832.             return;
  833.  
  834.         ch->SetRealPoint(POINT_IQ, ch->GetRealPoint(POINT_IQ) - 1);
  835.         ch->SetPoint(POINT_IQ, ch->GetPoint(POINT_IQ) - 1);
  836.         ch->ComputePoints();
  837.         ch->PointChange(POINT_IQ, 0);
  838.         ch->PointChange(POINT_MAX_SP, 0);
  839.     }
  840.     else
  841.         return;
  842.  
  843.     ch->PointChange(POINT_STAT, +1);
  844.     ch->PointChange(POINT_STAT_RESET_COUNT, -1);
  845.     ch->ComputePoints();
  846. }
  847.  
  848. ACMD(do_stat)
  849. {
  850.     char arg1[256];
  851.     one_argument(argument, arg1, sizeof(arg1));
  852.  
  853.     if (!*arg1)
  854.         return;
  855.  
  856.     if (ch->IsPolymorphed())
  857.     {
  858.         ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("�а� �߿��� �ɷ��� �ø� �� �����ϴ�."));
  859.         return;
  860.     }
  861.  
  862.     if (ch->GetPoint(POINT_STAT) <= 0)
  863.         return;
  864.  
  865.     BYTE idx = 0;
  866.    
  867.     if (!strcmp(arg1, "st"))
  868.         idx = POINT_ST;
  869.     else if (!strcmp(arg1, "dx"))
  870.         idx = POINT_DX;
  871.     else if (!strcmp(arg1, "ht"))
  872.         idx = POINT_HT;
  873.     else if (!strcmp(arg1, "iq"))
  874.         idx = POINT_IQ;
  875.     else
  876.         return;
  877.  
  878.     if (ch->GetRealPoint(idx) >= MAX_STAT)
  879.         return;
  880.  
  881.     ch->SetRealPoint(idx, ch->GetRealPoint(idx) + 1);
  882.     ch->SetPoint(idx, ch->GetPoint(idx) + 1);
  883.     ch->ComputePoints();
  884.     ch->PointChange(idx, 0);
  885.  
  886.     if (idx == POINT_IQ)
  887.     {
  888.         ch->PointChange(POINT_MAX_HP, 0);
  889.     }
  890.     else if (idx == POINT_HT)
  891.     {
  892.         ch->PointChange(POINT_MAX_SP, 0);
  893.     }
  894.  
  895.     ch->PointChange(POINT_STAT, -1);
  896.     ch->ComputePoints();
  897. }
  898.  
  899. ACMD(do_pvp)
  900. {
  901.     if (ch->GetArena() != NULL || CArenaManager::instance().IsArenaMap(ch->GetMapIndex()) == true)
  902.     {
  903.         ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("����忡�� ����Ͻ� �� �����ϴ�."));
  904.         return;
  905.     }
  906.  
  907.     char arg1[256];
  908.     one_argument(argument, arg1, sizeof(arg1));
  909.  
  910.     DWORD vid = 0;
  911.     str_to_number(vid, arg1);
  912.     LPCHARACTER pkVictim = CHARACTER_MANAGER::instance().Find(vid);
  913.  
  914.     if (!pkVictim)
  915.         return;
  916.  
  917.     if (pkVictim->IsNPC())
  918.         return;
  919.  
  920.     if (pkVictim->GetArena() != NULL)
  921.     {
  922.         pkVictim->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("������ ������Դϴ�."));
  923.         return;
  924.     }
  925.  
  926.     CPVPManager::instance().Insert(ch, pkVictim);
  927. }
  928.  
  929. ACMD(do_guildskillup)
  930. {
  931.     char arg1[256];
  932.     one_argument(argument, arg1, sizeof(arg1));
  933.  
  934.     if (!*arg1)
  935.         return;
  936.  
  937.     if (!ch->GetGuild())
  938.     {
  939.         ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<���> ��忡 �������� �ʽ��ϴ�."));
  940.         return;
  941.     }
  942.  
  943.     CGuild* g = ch->GetGuild();
  944.     TGuildMember* gm = g->GetMember(ch->GetPlayerID());
  945.     if (gm->grade == GUILD_LEADER_GRADE)
  946.     {
  947.         DWORD vnum = 0;
  948.         str_to_number(vnum, arg1);
  949.         g->SkillLevelUp(vnum);
  950.     }
  951.     else
  952.     {
  953.         ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<���> ��� ��ų ������ ������ ������ �����ϴ�."));
  954.     }
  955. }
  956.  
  957. ACMD(do_skillup)
  958. {
  959.     char arg1[256];
  960.     one_argument(argument, arg1, sizeof(arg1));
  961.  
  962.     if (!*arg1)
  963.         return;
  964.  
  965.     DWORD vnum = 0;
  966.     str_to_number(vnum, arg1);
  967.  
  968.     if (true == ch->CanUseSkill(vnum))
  969.     {
  970.         ch->SkillLevelUp(vnum);
  971.     }
  972.     else
  973.     {
  974.         switch(vnum)
  975.         {
  976.             case SKILL_HORSE_WILDATTACK:
  977.             case SKILL_HORSE_CHARGE:
  978.             case SKILL_HORSE_ESCAPE:
  979.             case SKILL_HORSE_WILDATTACK_RANGE:
  980.             case SKILL_ADD_HP:
  981.             case SKILL_RESIST_PENETRATE:
  982. #ifdef __7AND8TH_SKILLS__
  983.             case SKILL_ANTI_PALBANG:
  984.             case SKILL_ANTI_AMSEOP:
  985.             case SKILL_ANTI_SWAERYUNG:
  986.             case SKILL_ANTI_YONGBI:
  987.             case SKILL_ANTI_GIGONGCHAM:
  988.             case SKILL_ANTI_HWAJO:
  989.             case SKILL_ANTI_MARYUNG:
  990.             case SKILL_ANTI_BYEURAK:
  991. #ifdef __WOLFMAN_CHARACTER__
  992.             case SKILL_ANTI_SALPOONG:
  993. #endif
  994.             case SKILL_HELP_PALBANG:
  995.             case SKILL_HELP_AMSEOP:
  996.             case SKILL_HELP_SWAERYUNG:
  997.             case SKILL_HELP_YONGBI:
  998.             case SKILL_HELP_GIGONGCHAM:
  999.             case SKILL_HELP_HWAJO:
  1000.             case SKILL_HELP_MARYUNG:
  1001.             case SKILL_HELP_BYEURAK:
  1002. #ifdef __WOLFMAN_CHARACTER__
  1003.             case SKILL_HELP_SALPOONG:
  1004. #endif
  1005. #endif
  1006.                 ch->SkillLevelUp(vnum);
  1007.                 break;
  1008.         }
  1009.     }
  1010. }
  1011.  
  1012. //
  1013. // @version 05/06/20 Bang2ni - Ŀ�ǵ� ó�� Delegate to CHARACTER class
  1014. //
  1015. ACMD(do_safebox_close)
  1016. {
  1017.     ch->CloseSafebox();
  1018. }
  1019.  
  1020. //
  1021. // @version 05/06/20 Bang2ni - Ŀ�ǵ� ó�� Delegate to CHARACTER class
  1022. //
  1023. ACMD(do_safebox_password)
  1024. {
  1025.     char arg1[256];
  1026.     one_argument(argument, arg1, sizeof(arg1));
  1027.     ch->ReqSafeboxLoad(arg1);
  1028. }
  1029.  
  1030. ACMD(do_safebox_change_password)
  1031. {
  1032.     char arg1[256];
  1033.     char arg2[256];
  1034.  
  1035.     two_arguments(argument, arg1, sizeof(arg1), arg2, sizeof(arg2));
  1036.  
  1037.     if (!*arg1 || strlen(arg1)>6)
  1038.     {
  1039.         ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<â��> �߸��� ��ȣ�� �Է��ϼ̽��ϴ�."));
  1040.         return;
  1041.     }
  1042.  
  1043.     if (!*arg2 || strlen(arg2)>6)
  1044.     {
  1045.         ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<â��> �߸��� ��ȣ�� �Է��ϼ̽��ϴ�."));
  1046.         return;
  1047.     }
  1048.  
  1049.     if (LC_IsBrazil() == true)
  1050.     {
  1051.         for (int i = 0; i < 6; ++i)
  1052.         {
  1053.             if (arg2[i] == '\0')
  1054.                 break;
  1055.  
  1056.             if (isalpha(arg2[i]) == false)
  1057.             {
  1058.                 ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<â��> ��й�ȣ�� �����ڸ� �����մϴ�."));
  1059.                 return;
  1060.             }
  1061.         }
  1062.     }
  1063.  
  1064.     TSafeboxChangePasswordPacket p;
  1065.  
  1066.     p.dwID = ch->GetDesc()->GetAccountTable().id;
  1067.     strlcpy(p.szOldPassword, arg1, sizeof(p.szOldPassword));
  1068.     strlcpy(p.szNewPassword, arg2, sizeof(p.szNewPassword));
  1069.  
  1070.     db_clientdesc->DBPacket(HEADER_GD_SAFEBOX_CHANGE_PASSWORD, ch->GetDesc()->GetHandle(), &p, sizeof(p));
  1071. }
  1072.  
  1073. ACMD(do_mall_password)
  1074. {
  1075.     char arg1[256];
  1076.     one_argument(argument, arg1, sizeof(arg1));
  1077.  
  1078.     if (!*arg1 || strlen(arg1) > 6)
  1079.     {
  1080.         ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<â��> �߸��� ��ȣ�� �Է��ϼ̽��ϴ�."));
  1081.         return;
  1082.     }
  1083.  
  1084.     int iPulse = thecore_pulse();
  1085.  
  1086.     if (ch->GetMall())
  1087.     {
  1088.         ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<â��> â���� �̹� �����ֽ��ϴ�."));
  1089.         return;
  1090.     }
  1091.  
  1092.     if (iPulse - ch->GetMallLoadTime() < passes_per_sec * 10) // 10�ʿ� �ѹ��� ��û ����
  1093.     {
  1094.         ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<â��> â���� ������ 10�� �ȿ��� �� �� �����ϴ�."));
  1095.         return;
  1096.     }
  1097.  
  1098.     ch->SetMallLoadTime(iPulse);
  1099.  
  1100.     TSafeboxLoadPacket p;
  1101.     p.dwID = ch->GetDesc()->GetAccountTable().id;
  1102.     strlcpy(p.szLogin, ch->GetDesc()->GetAccountTable().login, sizeof(p.szLogin));
  1103.     strlcpy(p.szPassword, arg1, sizeof(p.szPassword));
  1104.  
  1105.     db_clientdesc->DBPacket(HEADER_GD_MALL_LOAD, ch->GetDesc()->GetHandle(), &p, sizeof(p));
  1106. }
  1107.  
  1108. ACMD(do_mall_close)
  1109. {
  1110.     if (ch->GetMall())
  1111.     {
  1112.         ch->SetMallLoadTime(thecore_pulse());
  1113.         ch->CloseMall();
  1114.         ch->Save();
  1115.     }
  1116. }
  1117.  
  1118. ACMD(do_ungroup)
  1119. {
  1120.     if (!ch->GetParty())
  1121.         return;
  1122.  
  1123.     if (!CPartyManager::instance().IsEnablePCParty())
  1124.     {
  1125.         ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<��Ƽ> ���� ������ ��Ƽ ���� ó���� �� �� �����ϴ�."));
  1126.         return;
  1127.     }
  1128.  
  1129.     if (ch->GetDungeon())
  1130.     {
  1131.         ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<��Ƽ> ���� �ȿ����� ��Ƽ���� ���� �� �����ϴ�."));
  1132.         return;
  1133.     }
  1134.  
  1135.     LPPARTY pParty = ch->GetParty();
  1136.  
  1137.     if (pParty->GetMemberCount() == 2)
  1138.     {
  1139.         // party disband
  1140.         CPartyManager::instance().DeleteParty(pParty);
  1141.     }
  1142.     else
  1143.     {
  1144.         ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<��Ƽ> ��Ƽ���� �����̽��ϴ�."));
  1145.         //pParty->SendPartyRemoveOneToAll(ch);
  1146.         pParty->Quit(ch->GetPlayerID());
  1147.         //pParty->SendPartyRemoveAllToOne(ch);
  1148.     }
  1149. }
  1150.  
  1151. ACMD(do_close_shop)
  1152. {
  1153.     if (ch->GetMyShop())
  1154.     {
  1155.         ch->CloseMyShop();
  1156.         return;
  1157.     }
  1158. }
  1159.  
  1160. ACMD(do_set_walk_mode)
  1161. {
  1162.     ch->SetNowWalking(true);
  1163.     ch->SetWalking(true);
  1164. }
  1165.  
  1166. ACMD(do_set_run_mode)
  1167. {
  1168.     ch->SetNowWalking(false);
  1169.     ch->SetWalking(false);
  1170. }
  1171.  
  1172. ACMD(do_war)
  1173. {
  1174.     //�� ��� ������ ������
  1175.     CGuild * g = ch->GetGuild();
  1176.  
  1177.     if (!g)
  1178.         return;
  1179.  
  1180.     //���������� üũ�ѹ�!
  1181.     if (g->UnderAnyWar())
  1182.     {
  1183.         ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<���> �̹� �ٸ� ���£ ���� �� �Դϴ�."));
  1184.         return;
  1185.     }
  1186.  
  1187.     //�Ķ���͸� �ι�� ������
  1188.     char arg1[256], arg2[256];
  1189.     int type = GUILD_WAR_TYPE_FIELD;
  1190.     two_arguments(argument, arg1, sizeof(arg1), arg2, sizeof(arg2));
  1191.  
  1192.     if (!*arg1)
  1193.         return;
  1194.  
  1195.     if (*arg2)
  1196.     {
  1197.         str_to_number(type, arg2);
  1198.  
  1199.         if (type >= GUILD_WAR_TYPE_MAX_NUM)
  1200.             type = GUILD_WAR_TYPE_FIELD;
  1201.            
  1202.         if(type < 0) //war crash fix
  1203.             return;
  1204.     }
  1205.  
  1206.     //����� ������ ���̵� ���µ�
  1207.     DWORD gm_pid = g->GetMasterPID();
  1208.  
  1209.     //���������� üũ(������ ����常�� ����)
  1210.     if (gm_pid != ch->GetPlayerID())
  1211.     {
  1212.         ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<���> ������� ���� ������ �����ϴ�."));
  1213.         return;
  1214.     }
  1215.  
  1216.     //��� ��带 ������
  1217.     CGuild * opp_g = CGuildManager::instance().FindGuildByName(arg1);
  1218.  
  1219.     if (!opp_g)
  1220.     {
  1221.         ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<���> �׷� ��尡 �����ϴ�."));
  1222.         return;
  1223.     }
  1224.  
  1225.     //�������� ���� üũ
  1226.     switch (g->GetGuildWarState(opp_g->GetID()))
  1227.     {
  1228.         case GUILD_WAR_NONE:
  1229.             {
  1230.                 if (opp_g->UnderAnyWar())
  1231.                 {
  1232.                     ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<���> ���� ��尡 �̹� ���� �� �Դϴ�."));
  1233.                     return;
  1234.                 }
  1235.  
  1236.                 int iWarPrice = KOR_aGuildWarInfo[type].iWarPrice;
  1237.  
  1238.                 if (g->GetGuildMoney() < iWarPrice)
  1239.                 {
  1240.                     ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<���> ���� �����Ͽ� ������� �� �� �����ϴ�."));
  1241.                     return;
  1242.                 }
  1243.  
  1244.                 if (opp_g->GetGuildMoney() < iWarPrice)
  1245.                 {
  1246.                     ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<���> ���� ����� ���� �����Ͽ� ������� �� �� �����ϴ�."));
  1247.                     return;
  1248.                 }
  1249.             }
  1250.             break;
  1251.  
  1252.         case GUILD_WAR_SEND_DECLARE:
  1253.             {
  1254.                 ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("�̹� �������� ���� ����Դϴ�."));
  1255.                 return;
  1256.             }
  1257.             break;
  1258.  
  1259.         case GUILD_WAR_RECV_DECLARE:
  1260.             {
  1261.                 if (opp_g->UnderAnyWar())
  1262.                 {
  1263.                     ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<���> ���� ��尡 �̹� ���� �� �Դϴ�."));
  1264.                     g->RequestRefuseWar(opp_g->GetID());
  1265.                     return;
  1266.                 }
  1267.             }
  1268.             break;
  1269.  
  1270.         case GUILD_WAR_RESERVE:
  1271.             {
  1272.                 ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<���> �̹� ������ ����� ��� �Դϴ�."));
  1273.                 return;
  1274.             }
  1275.             break;
  1276.  
  1277.         case GUILD_WAR_END:
  1278.             return;
  1279.  
  1280.         default:
  1281.             ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<���> �̹� ���� ���� ����Դϴ�."));
  1282.             g->RequestRefuseWar(opp_g->GetID());
  1283.             return;
  1284.     }
  1285.  
  1286.     if (!g->CanStartWar(type))
  1287.     {
  1288.         // ������� �� �� �ִ� ������ ���������ʴ´�.
  1289.         if (g->GetLadderPoint() == 0)
  1290.         {
  1291.             ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<���> ���� ������ ���ڶ� ������� �� �� �����ϴ�."));
  1292.             sys_log(0, "GuildWar.StartError.NEED_LADDER_POINT");
  1293.         }
  1294.         else if (g->GetMemberCount() < GUILD_WAR_MIN_MEMBER_COUNT)
  1295.         {
  1296.             ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<���> ������� �ϱ� ���ؼ� �ּ��� %d���� �־�� �մϴ�."), GUILD_WAR_MIN_MEMBER_COUNT);
  1297.             sys_log(0, "GuildWar.StartError.NEED_MINIMUM_MEMBER[%d]", GUILD_WAR_MIN_MEMBER_COUNT);
  1298.         }
  1299.         else
  1300.         {
  1301.             sys_log(0, "GuildWar.StartError.UNKNOWN_ERROR");
  1302.         }
  1303.         return;
  1304.     }
  1305.  
  1306.     // �ʵ��� üũ�� �ϰ� ������ üũ�� ������ �³��Ҷ� �Ѵ�.
  1307.     if (!opp_g->CanStartWar(GUILD_WAR_TYPE_FIELD))
  1308.     {
  1309.         if (opp_g->GetLadderPoint() == 0)
  1310.             ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<���> ���� ����� ���� ������ ���ڶ� ������� �� �� �����ϴ�."));
  1311.         else if (opp_g->GetMemberCount() < GUILD_WAR_MIN_MEMBER_COUNT)
  1312.             ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<���> ���� ����� ���� ���� �����Ͽ� ������� �� �� �����ϴ�."));
  1313.         return;
  1314.     }
  1315.  
  1316.     do
  1317.     {
  1318.         if (g->GetMasterCharacter() != NULL)
  1319.             break;
  1320.  
  1321.         CCI *pCCI = P2P_MANAGER::instance().FindByPID(g->GetMasterPID());
  1322.  
  1323.         if (pCCI != NULL)
  1324.             break;
  1325.  
  1326.         ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<���> ���� ����� ������� �������� �ƴմϴ�."));
  1327.         g->RequestRefuseWar(opp_g->GetID());
  1328.         return;
  1329.  
  1330.     } while (false);
  1331.  
  1332.     do
  1333.     {
  1334.         if (opp_g->GetMasterCharacter() != NULL)
  1335.             break;
  1336.        
  1337.         CCI *pCCI = P2P_MANAGER::instance().FindByPID(opp_g->GetMasterPID());
  1338.        
  1339.         if (pCCI != NULL)
  1340.             break;
  1341.  
  1342.         ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<���> ���� ����� ������� �������� �ƴմϴ�."));
  1343.         g->RequestRefuseWar(opp_g->GetID());
  1344.         return;
  1345.  
  1346.     } while (false);
  1347.  
  1348.     g->RequestDeclareWar(opp_g->GetID(), type);
  1349. }
  1350.  
  1351. ACMD(do_nowar)
  1352. {
  1353.     CGuild* g = ch->GetGuild();
  1354.     if (!g)
  1355.         return;
  1356.  
  1357.     char arg1[256];
  1358.     one_argument(argument, arg1, sizeof(arg1));
  1359.  
  1360.     if (!*arg1)
  1361.         return;
  1362.  
  1363.     DWORD gm_pid = g->GetMasterPID();
  1364.  
  1365.     if (gm_pid != ch->GetPlayerID())
  1366.     {
  1367.         ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<���> ������� ���� ������ �����ϴ�."));
  1368.         return;
  1369.     }
  1370.  
  1371.     CGuild* opp_g = CGuildManager::instance().FindGuildByName(arg1);
  1372.  
  1373.     if (!opp_g)
  1374.     {
  1375.         ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<���> �׷� ��尡 �����ϴ�."));
  1376.         return;
  1377.     }
  1378.  
  1379.     g->RequestRefuseWar(opp_g->GetID());
  1380. }
  1381.  
  1382. ACMD(do_detaillog)
  1383. {
  1384.     ch->DetailLog();
  1385. }
  1386.  
  1387. ACMD(do_monsterlog)
  1388. {
  1389.     ch->ToggleMonsterLog();
  1390. }
  1391.  
  1392. ACMD(do_pkmode)
  1393. {
  1394.     char arg1[256];
  1395.     one_argument(argument, arg1, sizeof(arg1));
  1396.  
  1397.     if (!*arg1)
  1398.         return;
  1399.  
  1400.     BYTE mode = 0;
  1401.     str_to_number(mode, arg1);
  1402.  
  1403.     if (mode == PK_MODE_PROTECT)
  1404.         return;
  1405.  
  1406.     if (ch->GetLevel() < PK_PROTECT_LEVEL && mode != 0)
  1407.         return;
  1408.  
  1409.     ch->SetPKMode(mode);
  1410. }
  1411.  
  1412. ACMD(do_messenger_auth)
  1413. {
  1414.     if (ch->GetArena())
  1415.     {
  1416.         ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("����忡�� ����Ͻ� �� �����ϴ�."));
  1417.         return;
  1418.     }
  1419.  
  1420.     char arg1[256], arg2[256];
  1421.     two_arguments(argument, arg1, sizeof(arg1), arg2, sizeof(arg2));
  1422.  
  1423.     if (!*arg1 || !*arg2)
  1424.         return;
  1425.  
  1426.     char answer = LOWER(*arg1);
  1427.  
  1428.     if (answer != 'y')
  1429.     {
  1430.         LPCHARACTER tch = CHARACTER_MANAGER::instance().FindPC(arg2);
  1431.  
  1432.         if (tch)
  1433.             tch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("%s ������ ���� ģ�� ����� �ź� ���߽��ϴ�."), ch->GetName());
  1434.     }
  1435.  
  1436.     MessengerManager::instance().AuthToAdd(ch->GetName(), arg2, answer == 'y' ? false : true); // DENY
  1437. }
  1438.  
  1439. ACMD(do_setblockmode)
  1440. {
  1441.     char arg1[256];
  1442.     one_argument(argument, arg1, sizeof(arg1));
  1443.  
  1444.     if (*arg1)
  1445.     {
  1446.         BYTE flag = 0;
  1447.         str_to_number(flag, arg1);
  1448.         ch->SetBlockMode(flag);
  1449.     }
  1450. }
  1451.  
  1452. ACMD(do_unmount)
  1453. {
  1454.     LPITEM item = ch->GetWear(WEAR_UNIQUE1);
  1455.     LPITEM item2 = ch->GetWear(WEAR_UNIQUE2);
  1456.     LPITEM item3 = ch->GetWear(WEAR_COSTUME_MOUNT);
  1457.  
  1458.     if (item && item->IsRideItem())
  1459.         ch->UnequipItem(item);
  1460.  
  1461.     if (item2 && item2->IsRideItem())
  1462.         ch->UnequipItem(item2);
  1463.  
  1464.     if (item3 && item3->IsRideItem())
  1465.         ch->UnequipItem(item3);
  1466.  
  1467.     if (true == ch->UnEquipSpecialRideUniqueItem())
  1468.     {
  1469.         ch->RemoveAffect(AFFECT_MOUNT);
  1470.         ch->RemoveAffect(AFFECT_MOUNT_BONUS);
  1471.  
  1472.         if (ch->IsHorseRiding())
  1473.         {
  1474.             ch->StopRiding();
  1475.         }
  1476.     }
  1477.     else
  1478.     {
  1479.         ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("AI??Aa���? ?E A�?� ??�� ?o ???A�I�U."));
  1480.     }
  1481.  
  1482. }
  1483.  
  1484. ACMD(do_observer_exit)
  1485. {
  1486.     if (ch->IsObserverMode())
  1487.     {
  1488.         if (ch->GetWarMap())
  1489.             ch->SetWarMap(NULL);
  1490.  
  1491.         if (ch->GetArena() != NULL || ch->GetArenaObserverMode() == true)
  1492.         {
  1493.             ch->SetArenaObserverMode(false);
  1494.  
  1495.             if (ch->GetArena() != NULL)
  1496.                 ch->GetArena()->RemoveObserver(ch->GetPlayerID());
  1497.  
  1498.             ch->SetArena(NULL);
  1499.             ch->WarpSet(ARENA_RETURN_POINT_X(ch->GetEmpire()), ARENA_RETURN_POINT_Y(ch->GetEmpire()));
  1500.         }
  1501.         else
  1502.         {
  1503.             ch->ExitToSavedLocation();
  1504.         }
  1505.         ch->SetObserverMode(false);
  1506.     }
  1507. }
  1508.  
  1509. ACMD(do_view_equip)
  1510. {
  1511.     if (ch->GetGMLevel() <= GM_PLAYER)
  1512.         return;
  1513.  
  1514.     char arg1[256];
  1515.     one_argument(argument, arg1, sizeof(arg1));
  1516.  
  1517.     if (*arg1)
  1518.     {
  1519.         DWORD vid = 0;
  1520.         str_to_number(vid, arg1);
  1521.         LPCHARACTER tch = CHARACTER_MANAGER::instance().Find(vid);
  1522.  
  1523.         if (!tch)
  1524.             return;
  1525.  
  1526.         if (!tch->IsPC())
  1527.             return;
  1528.         /*
  1529.            int iSPCost = ch->GetMaxSP() / 3;
  1530.  
  1531.            if (ch->GetSP() < iSPCost)
  1532.            {
  1533.            ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("���ŷ��� �����Ͽ� �ٸ� ����� ��� �� �� �����ϴ�."));
  1534.            return;
  1535.            }
  1536.            ch->PointChange(POINT_SP, -iSPCost);
  1537.          */
  1538.         tch->SendEquipment(ch);
  1539.     }
  1540. }
  1541.  
  1542. ACMD(do_party_request)
  1543. {
  1544.     if (ch->GetArena())
  1545.     {
  1546.         ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("����忡�� ����Ͻ� �� �����ϴ�."));
  1547.         return;
  1548.     }
  1549.  
  1550.     if (ch->GetParty())
  1551.     {
  1552.         ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("�̹� ��Ƽ�� ���� �����Ƿ� ���Խ�û�� �� �� �����ϴ�."));
  1553.         return;
  1554.     }
  1555.  
  1556.     char arg1[256];
  1557.     one_argument(argument, arg1, sizeof(arg1));
  1558.  
  1559.     if (!*arg1)
  1560.         return;
  1561.  
  1562.     DWORD vid = 0;
  1563.     str_to_number(vid, arg1);
  1564.     LPCHARACTER tch = CHARACTER_MANAGER::instance().Find(vid);
  1565.  
  1566.     if (tch)
  1567.         if (!ch->RequestToParty(tch))
  1568.             ch->ChatPacket(CHAT_TYPE_COMMAND, "PartyRequestDenied");
  1569. }
  1570.  
  1571. ACMD(do_party_request_accept)
  1572. {
  1573.     char arg1[256];
  1574.     one_argument(argument, arg1, sizeof(arg1));
  1575.  
  1576.     if (!*arg1)
  1577.         return;
  1578.  
  1579.     DWORD vid = 0;
  1580.     str_to_number(vid, arg1);
  1581.     LPCHARACTER tch = CHARACTER_MANAGER::instance().Find(vid);
  1582.  
  1583.     if (tch)
  1584.         ch->AcceptToParty(tch);
  1585. }
  1586.  
  1587. ACMD(do_party_request_deny)
  1588. {
  1589.     char arg1[256];
  1590.     one_argument(argument, arg1, sizeof(arg1));
  1591.  
  1592.     if (!*arg1)
  1593.         return;
  1594.  
  1595.     DWORD vid = 0;
  1596.     str_to_number(vid, arg1);
  1597.     LPCHARACTER tch = CHARACTER_MANAGER::instance().Find(vid);
  1598.  
  1599.     if (tch)
  1600.         ch->DenyToParty(tch);
  1601. }
  1602.  
  1603. ACMD(do_monarch_warpto)
  1604. {
  1605.     if (true == LC_IsYMIR() || true == LC_IsKorea())
  1606.         return;
  1607.  
  1608.     if (!CMonarch::instance().IsMonarch(ch->GetPlayerID(), ch->GetEmpire()))
  1609.     {
  1610.         ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("���ָ��� ��� ������ ����Դϴ�"));
  1611.         return;
  1612.     }
  1613.    
  1614.     //���� ��Ÿ�� �˻�
  1615.     if (!ch->IsMCOK(CHARACTER::MI_WARP))
  1616.     {
  1617.         ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("%d �ʰ� ��Ÿ���� �������Դϴ�."), ch->GetMCLTime(CHARACTER::MI_WARP));
  1618.         return;
  1619.     }
  1620.  
  1621.     //���� �� ��ȯ ���
  1622.     const int WarpPrice = 10000;
  1623.    
  1624.     //���� ���� �˻�
  1625.     if (!CMonarch::instance().IsMoneyOk(WarpPrice, ch->GetEmpire()))
  1626.     {
  1627.         int NationMoney = CMonarch::instance().GetMoney(ch->GetEmpire());
  1628.         ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("������ ���� �����մϴ�. ���� : %u �ʿ�ݾ� : %u"), NationMoney, WarpPrice);
  1629.         return;
  1630.     }
  1631.  
  1632.     int x = 0, y = 0;
  1633.     char arg1[256];
  1634.  
  1635.     one_argument(argument, arg1, sizeof(arg1));
  1636.  
  1637.     if (!*arg1)
  1638.     {
  1639.         ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("����: warpto <character name>"));
  1640.         return;
  1641.     }
  1642.  
  1643.     LPCHARACTER tch = CHARACTER_MANAGER::instance().FindPC(arg1);
  1644.  
  1645.     if (!tch)
  1646.     {
  1647.         CCI * pkCCI = P2P_MANAGER::instance().Find(arg1);
  1648.  
  1649.         if (pkCCI)
  1650.         {
  1651.             if (pkCCI->bEmpire != ch->GetEmpire())
  1652.             {
  1653.                 ch->ChatPacket (CHAT_TYPE_INFO, LC_TEXT("Ÿ���� �������Դ� �̵��Ҽ� �����ϴ�"));
  1654.                 return;
  1655.             }
  1656.  
  1657.             if (pkCCI->bChannel != g_bChannel)
  1658.             {
  1659.                 ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("�ش� ������ %d ä�ο� �ֽ��ϴ�. (���� ä�� %d)"), pkCCI->bChannel, g_bChannel);
  1660.                 return;
  1661.             }
  1662.             if (!IsMonarchWarpZone(pkCCI->lMapIndex))
  1663.             {
  1664.                 ch->ChatPacket (CHAT_TYPE_INFO, LC_TEXT("�ش� �������� �̵��� �� �����ϴ�."));
  1665.                 return;
  1666.             }
  1667.  
  1668.             PIXEL_POSITION pos;
  1669.    
  1670.             if (!SECTREE_MANAGER::instance().GetCenterPositionOfMap(pkCCI->lMapIndex, pos))
  1671.                 ch->ChatPacket(CHAT_TYPE_INFO, "Cannot find map (index %d)", pkCCI->lMapIndex);
  1672.             else
  1673.             {
  1674.                 //ch->ChatPacket(CHAT_TYPE_INFO, "You warp to (%d, %d)", pos.x, pos.y);
  1675.                 ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("%s ���Է� �̵��մϴ�"), arg1);
  1676.                 ch->WarpSet(pos.x, pos.y);
  1677.                
  1678.                 //���� �� �谨   
  1679.                 CMonarch::instance().SendtoDBDecMoney(WarpPrice, ch->GetEmpire(), ch);
  1680.  
  1681.                 //��Ÿ�� �ʱ�ȭ
  1682.                 ch->SetMC(CHARACTER::MI_WARP);
  1683.             }
  1684.         }
  1685.         else if (NULL == CHARACTER_MANAGER::instance().FindPC(arg1))
  1686.         {
  1687.             ch->ChatPacket(CHAT_TYPE_INFO, "There is no one by that name");
  1688.         }
  1689.  
  1690.         return;
  1691.     }
  1692.     else
  1693.     {
  1694.         if (tch->GetEmpire() != ch->GetEmpire())
  1695.         {
  1696.             ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Ÿ���� �������Դ� �̵��Ҽ� �����ϴ�"));
  1697.             return;
  1698.         }
  1699.         if (!IsMonarchWarpZone(tch->GetMapIndex()))
  1700.         {
  1701.             ch->ChatPacket (CHAT_TYPE_INFO, LC_TEXT("�ش� �������� �̵��� �� �����ϴ�."));
  1702.             return;
  1703.         }
  1704.         x = tch->GetX();
  1705.         y = tch->GetY();
  1706.     }
  1707.  
  1708.     ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("%s ���Է� �̵��մϴ�"), arg1);
  1709.     ch->WarpSet(x, y);
  1710.     ch->Stop();
  1711.  
  1712.     //���� �� �谨   
  1713.     CMonarch::instance().SendtoDBDecMoney(WarpPrice, ch->GetEmpire(), ch);
  1714.  
  1715.     //��Ÿ�� �ʱ�ȭ
  1716.     ch->SetMC(CHARACTER::MI_WARP);
  1717. }
  1718.  
  1719. ACMD(do_monarch_transfer)
  1720. {
  1721.     if (true == LC_IsYMIR() || true == LC_IsKorea())
  1722.         return;
  1723.  
  1724.     char arg1[256];
  1725.     one_argument(argument, arg1, sizeof(arg1));
  1726.  
  1727.     if (!*arg1)
  1728.     {
  1729.         ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("����: transfer <name>"));
  1730.         return;
  1731.     }
  1732.    
  1733.     if (!CMonarch::instance().IsMonarch(ch->GetPlayerID(), ch->GetEmpire()))
  1734.     {
  1735.         ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("���ָ��� ��� ������ ����Դϴ�"));
  1736.         return;
  1737.     }
  1738.    
  1739.     //���� ��Ÿ�� �˻�
  1740.     if (!ch->IsMCOK(CHARACTER::MI_TRANSFER))
  1741.     {
  1742.         ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("%d �ʰ� ��Ÿ���� �������Դϴ�."), ch->GetMCLTime(CHARACTER::MI_TRANSFER)); 
  1743.         return;
  1744.     }
  1745.  
  1746.     //���� ���� ���
  1747.     const int WarpPrice = 10000;
  1748.  
  1749.     //���� ���� �˻�
  1750.     if (!CMonarch::instance().IsMoneyOk(WarpPrice, ch->GetEmpire()))
  1751.     {
  1752.         int NationMoney = CMonarch::instance().GetMoney(ch->GetEmpire());
  1753.         ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("������ ���� �����մϴ�. ���� : %u �ʿ�ݾ� : %u"), NationMoney, WarpPrice);
  1754.         return;
  1755.     }
  1756.  
  1757.  
  1758.     LPCHARACTER tch = CHARACTER_MANAGER::instance().FindPC(arg1);
  1759.  
  1760.     if (!tch)
  1761.     {
  1762.         CCI * pkCCI = P2P_MANAGER::instance().Find(arg1);
  1763.  
  1764.         if (pkCCI)
  1765.         {
  1766.             if (pkCCI->bEmpire != ch->GetEmpire())
  1767.             {
  1768.                 ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("�ٸ� ���� ������ ��ȯ�� �� �����ϴ�."));
  1769.                 return;
  1770.             }
  1771.             if (pkCCI->bChannel != g_bChannel)
  1772.             {
  1773.                 ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("%s ���� %d ä�ο� ���� �� �Դϴ�. (���� ä��: %d)"), arg1, pkCCI->bChannel, g_bChannel);
  1774.                 return;
  1775.             }
  1776.             if (!IsMonarchWarpZone(pkCCI->lMapIndex))
  1777.             {
  1778.                 ch->ChatPacket (CHAT_TYPE_INFO, LC_TEXT("�ش� �������� �̵��� �� �����ϴ�."));
  1779.                 return;
  1780.             }
  1781.             if (!IsMonarchWarpZone(ch->GetMapIndex()))
  1782.             {
  1783.                 ch->ChatPacket (CHAT_TYPE_INFO, LC_TEXT("�ش� �������� ��ȯ�� �� �����ϴ�."));
  1784.                 return;
  1785.             }
  1786.  
  1787.             TPacketGGTransfer pgg;
  1788.  
  1789.             pgg.bHeader = HEADER_GG_TRANSFER;
  1790.             strlcpy(pgg.szName, arg1, sizeof(pgg.szName));
  1791.             pgg.lX = ch->GetX();
  1792.             pgg.lY = ch->GetY();
  1793.  
  1794.             P2P_MANAGER::instance().Send(&pgg, sizeof(TPacketGGTransfer));
  1795.             ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("%s ���� ��ȯ�Ͽ����ϴ�."), arg1);
  1796.            
  1797.             //���� �� �谨   
  1798.             CMonarch::instance().SendtoDBDecMoney(WarpPrice, ch->GetEmpire(), ch);
  1799.             //��Ÿ�� �ʱ�ȭ
  1800.             ch->SetMC(CHARACTER::MI_TRANSFER);
  1801.         }
  1802.         else
  1803.         {
  1804.             ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("�Է��Ͻ� �̸��� ���� ����ڰ� �����ϴ�."));
  1805.         }
  1806.  
  1807.         return;
  1808.     }
  1809.  
  1810.  
  1811.     if (ch == tch)
  1812.     {
  1813.         ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("�ڽ��� ��ȯ�� �� �����ϴ�."));
  1814.         return;
  1815.     }
  1816.  
  1817.     if (tch->GetEmpire() != ch->GetEmpire())
  1818.     {
  1819.         ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("�ٸ� ���� ������ ��ȯ�� �� �����ϴ�."));
  1820.         return;
  1821.     }
  1822.     if (!IsMonarchWarpZone(tch->GetMapIndex()))
  1823.     {
  1824.         ch->ChatPacket (CHAT_TYPE_INFO, LC_TEXT("�ش� �������� �̵��� �� �����ϴ�."));
  1825.         return;
  1826.     }
  1827.     if (!IsMonarchWarpZone(ch->GetMapIndex()))
  1828.     {
  1829.         ch->ChatPacket (CHAT_TYPE_INFO, LC_TEXT("�ش� �������� ��ȯ�� �� �����ϴ�."));
  1830.         return;
  1831.     }
  1832.  
  1833.     //tch->Show(ch->GetMapIndex(), ch->GetX(), ch->GetY(), ch->GetZ());
  1834.     tch->WarpSet(ch->GetX(), ch->GetY(), ch->GetMapIndex());
  1835.    
  1836.     //���� �� �谨   
  1837.     CMonarch::instance().SendtoDBDecMoney(WarpPrice, ch->GetEmpire(), ch);
  1838.     //��Ÿ�� �ʱ�ȭ
  1839.     ch->SetMC(CHARACTER::MI_TRANSFER);
  1840. }
  1841.  
  1842. ACMD(do_monarch_info)
  1843. {
  1844.     if (CMonarch::instance().IsMonarch(ch->GetPlayerID(), ch->GetEmpire()))
  1845.     {
  1846.         ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("���� ���� ����"));
  1847.         TMonarchInfo * p = CMonarch::instance().GetMonarch();
  1848.         for (int n = 1; n < 4; ++n)
  1849.         {
  1850.             if (n == ch->GetEmpire())
  1851.                 ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("[%s����] : %s  �����ݾ� %lld "), EMPIRE_NAME(n), p->name[n], p->money[n]);
  1852.             else
  1853.                 ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("[%s����] : %s  "), EMPIRE_NAME(n), p->name[n]);
  1854.                
  1855.         }
  1856.     }
  1857.     else
  1858.     {
  1859.         ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("���� ����"));
  1860.         TMonarchInfo * p = CMonarch::instance().GetMonarch();
  1861.         for (int n = 1; n < 4; ++n)
  1862.         {
  1863.             ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("[%s����] : %s  "), EMPIRE_NAME(n), p->name[n]);
  1864.                
  1865.         }
  1866.     }
  1867.    
  1868. }  
  1869.  
  1870. ACMD(do_elect)
  1871. {
  1872.     db_clientdesc->DBPacketHeader(HEADER_GD_COME_TO_VOTE, ch->GetDesc()->GetHandle(), 0);
  1873. }
  1874.  
  1875. // LUA_ADD_GOTO_INFO
  1876. struct GotoInfo
  1877. {
  1878.     std::string     st_name;
  1879.  
  1880.     BYTE    empire;
  1881.     int     mapIndex;
  1882.     DWORD   x, y;
  1883.  
  1884.     GotoInfo()
  1885.     {
  1886.         st_name     = "";
  1887.         empire      = 0;
  1888.         mapIndex    = 0;
  1889.  
  1890.         x = 0;
  1891.         y = 0;
  1892.     }
  1893.  
  1894.     GotoInfo(const GotoInfo& c_src)
  1895.     {
  1896.         __copy__(c_src);
  1897.     }
  1898.  
  1899.     void operator = (const GotoInfo& c_src)
  1900.     {
  1901.         __copy__(c_src);
  1902.     }
  1903.  
  1904.     void __copy__(const GotoInfo& c_src)
  1905.     {
  1906.         st_name     = c_src.st_name;
  1907.         empire      = c_src.empire;
  1908.         mapIndex    = c_src.mapIndex;
  1909.  
  1910.         x = c_src.x;
  1911.         y = c_src.y;
  1912.     }
  1913. };
  1914.  
  1915. extern void BroadcastNotice(const char * c_pszBuf);
  1916.  
  1917. ACMD(do_monarch_tax)
  1918. {
  1919.     char arg1[256];
  1920.     one_argument(argument, arg1, sizeof(arg1));
  1921.  
  1922.     if (!*arg1)
  1923.     {
  1924.         ch->ChatPacket(CHAT_TYPE_INFO, "Usage: monarch_tax <1-50>");
  1925.         return;
  1926.     }
  1927.  
  1928.     // ���� �˻�   
  1929.     if (!ch->IsMonarch())
  1930.     {
  1931.         ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("���ָ��� ����Ҽ� �ִ� ����Դϴ�"));
  1932.         return;
  1933.     }
  1934.  
  1935.     // ���ݼ���
  1936.     int tax = 0;
  1937.     str_to_number(tax,  arg1);
  1938.  
  1939.     if (tax < 1 || tax > 50)
  1940.         ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("1-50 ������ ��ġ�� �������ּ���"));
  1941.  
  1942.     quest::CQuestManager::instance().SetEventFlag("trade_tax", tax);
  1943.  
  1944.     // ���ֿ��� �޼��� �ϳ�
  1945.     ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("������ %d %�� �����Ǿ����ϴ�"));
  1946.  
  1947.     // ����
  1948.     char szMsg[1024];  
  1949.  
  1950.     snprintf(szMsg, sizeof(szMsg), "������ ������ ������ %d %% �� ����Ǿ����ϴ�", tax);
  1951.     BroadcastNotice(szMsg);
  1952.  
  1953.     snprintf(szMsg, sizeof(szMsg), "�����δ� �ŷ� �ݾ��� %d %% �� ������ ���Ե˴ϴ�.", tax);
  1954.     BroadcastNotice(szMsg);
  1955.  
  1956.     // ��Ÿ�� �ʱ�ȭ
  1957.     ch->SetMC(CHARACTER::MI_TAX);
  1958. }
  1959.  
  1960. static const DWORD cs_dwMonarchMobVnums[] =
  1961. {
  1962.     191, // ��߽�
  1963.     192, // ����
  1964.     193, // ����
  1965.     194, // ȣ��
  1966.     391, // ����
  1967.     392, // ����
  1968.     393, // ����
  1969.     394, // ����
  1970.     491, // ��ȯ
  1971.     492, // ����
  1972.     493, // ����
  1973.     494, // ����
  1974.     591, // ����ܴ���
  1975.     691, // ���� ����
  1976.     791, // �б�����
  1977.     1304, // ��������
  1978.     1901, // ����ȣ
  1979.     2091, // ���հŹ�
  1980.     2191, // �Ŵ�縷�ź�
  1981.     2206, // ȭ����i
  1982.     0,
  1983. };
  1984.  
  1985. ACMD(do_monarch_mob)
  1986. {
  1987.     char arg1[256];
  1988.     LPCHARACTER tch;
  1989.  
  1990.     one_argument(argument, arg1, sizeof(arg1));
  1991.  
  1992.     if (!ch->IsMonarch())
  1993.     {
  1994.         ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("���ָ��� ����Ҽ� �ִ� ����Դϴ�"));
  1995.         return;
  1996.     }
  1997.    
  1998.     if (!*arg1)
  1999.     {
  2000.         ch->ChatPacket(CHAT_TYPE_INFO, "Usage: mmob <mob name>");
  2001.         return;
  2002.     }
  2003.  
  2004.     BYTE pcEmpire = ch->GetEmpire();
  2005.     BYTE mapEmpire = SECTREE_MANAGER::instance().GetEmpireFromMapIndex(ch->GetMapIndex());
  2006.  
  2007.     if (LC_IsYMIR() == true || LC_IsKorea() == true)
  2008.     {
  2009.         if (mapEmpire != pcEmpire && mapEmpire != 0)
  2010.         {
  2011.             ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("�ڱ� ���信���� ����� �� �ִ� ����Դϴ�"));
  2012.             return;
  2013.         }
  2014.     }
  2015.  
  2016.     // ���� �� ��ȯ ���
  2017.     const int SummonPrice = 5000000;
  2018.  
  2019.     // ���� ��Ÿ�� �˻�
  2020.     if (!ch->IsMCOK(CHARACTER::MI_SUMMON))
  2021.     {
  2022.         ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("%d �ʰ� ��Ÿ���� �������Դϴ�."), ch->GetMCLTime(CHARACTER::MI_SUMMON));   
  2023.         return;
  2024.     }
  2025.    
  2026.     // ���� ���� �˻�
  2027.     if (!CMonarch::instance().IsMoneyOk(SummonPrice, ch->GetEmpire()))
  2028.     {
  2029.         int NationMoney = CMonarch::instance().GetMoney(ch->GetEmpire());
  2030.         ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("������ ���� �����մϴ�. ���� : %u �ʿ�ݾ� : %u"), NationMoney, SummonPrice);
  2031.         return;
  2032.     }
  2033.  
  2034.     const CMob * pkMob;
  2035.     DWORD vnum = 0;
  2036.  
  2037.     if (isdigit(*arg1))
  2038.     {
  2039.         str_to_number(vnum, arg1);
  2040.  
  2041.         if ((pkMob = CMobManager::instance().Get(vnum)) == NULL)
  2042.             vnum = 0;
  2043.     }
  2044.     else
  2045.     {
  2046.         pkMob = CMobManager::Instance().Get(arg1, true);
  2047.  
  2048.         if (pkMob)
  2049.             vnum = pkMob->m_table.dwVnum;
  2050.     }
  2051.  
  2052.     DWORD count;
  2053.  
  2054.     // ��ȯ ���� �� �˻�
  2055.     for (count = 0; cs_dwMonarchMobVnums[count] != 0; ++count)
  2056.         if (cs_dwMonarchMobVnums[count] == vnum)
  2057.             break;
  2058.  
  2059.     if (0 == cs_dwMonarchMobVnums[count])
  2060.     {
  2061.         ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("��ȯ�Ҽ� ���� ���� �Դϴ�. ��ȯ������ ���ʹ� Ȩ�������� �����ϼ���"));
  2062.         return;
  2063.     }
  2064.  
  2065.     tch = CHARACTER_MANAGER::instance().SpawnMobRange(vnum,
  2066.             ch->GetMapIndex(),
  2067.             ch->GetX() - number(200, 750),
  2068.             ch->GetY() - number(200, 750),
  2069.             ch->GetX() + number(200, 750),
  2070.             ch->GetY() + number(200, 750),
  2071.             true,
  2072.             pkMob->m_table.bType == CHAR_TYPE_STONE,
  2073.             true);
  2074.  
  2075.     if (tch)
  2076.     {
  2077.         // ���� �� �谨  
  2078.         CMonarch::instance().SendtoDBDecMoney(SummonPrice, ch->GetEmpire(), ch);
  2079.  
  2080.         // ��Ÿ�� �ʱ�ȭ
  2081.         ch->SetMC(CHARACTER::MI_SUMMON);
  2082.     }
  2083. }
  2084.  
  2085. static const char* FN_point_string(int apply_number)
  2086. {
  2087.     switch (apply_number)
  2088.     {
  2089.         case POINT_MAX_HP:  return LC_TEXT("�ִ� ������ +%d");
  2090.         case POINT_MAX_SP:  return LC_TEXT("�ִ� ���ŷ� +%d");
  2091.         case POINT_HT:      return LC_TEXT("ü�� +%d");
  2092.         case POINT_IQ:      return LC_TEXT("���� +%d");
  2093.         case POINT_ST:      return LC_TEXT("�ٷ� +%d");
  2094.         case POINT_DX:      return LC_TEXT("��ø +%d");
  2095.         case POINT_ATT_SPEED:   return LC_TEXT("���ݼӵ� +%d");
  2096.         case POINT_MOV_SPEED:   return LC_TEXT("�̵��ӵ� %d");
  2097.         case POINT_CASTING_SPEED:   return LC_TEXT("��Ÿ�� -%d");
  2098.         case POINT_HP_REGEN:    return LC_TEXT("������ ȸ�� +%d");
  2099.         case POINT_SP_REGEN:    return LC_TEXT("���ŷ� ȸ�� +%d");
  2100.         case POINT_POISON_PCT:  return LC_TEXT("������ %d");
  2101.         case POINT_STUN_PCT:    return LC_TEXT("���� +%d");
  2102.         case POINT_SLOW_PCT:    return LC_TEXT("���ο� +%d");
  2103.         case POINT_CRITICAL_PCT:    return LC_TEXT("%d%% Ȯ���� ġ��Ÿ ����");
  2104.         case POINT_RESIST_CRITICAL: return LC_TEXT("����� ġ��Ÿ Ȯ�� %d%% ����");
  2105.         case POINT_PENETRATE_PCT:   return LC_TEXT("%d%% Ȯ���� ���� ����");
  2106.         case POINT_RESIST_PENETRATE: return LC_TEXT("����� ���� ���� Ȯ�� %d%% ����");
  2107.         case POINT_ATTBONUS_HUMAN:  return LC_TEXT("�ΰ��� ���� Ÿ��ġ +%d%%");
  2108.         case POINT_ATTBONUS_ANIMAL: return LC_TEXT("������ ���� Ÿ��ġ +%d%%");
  2109.         case POINT_ATTBONUS_ORC:    return LC_TEXT("������ Ÿ��ġ +%d%%");
  2110.         case POINT_ATTBONUS_MILGYO: return LC_TEXT("�б��� Ÿ��ġ +%d%%");
  2111.         case POINT_ATTBONUS_UNDEAD: return LC_TEXT("��ü�� Ÿ��ġ +%d%%");
  2112.         case POINT_ATTBONUS_DEVIL:  return LC_TEXT("�Ǹ��� Ÿ��ġ +%d%%");
  2113.         case POINT_STEAL_HP:        return LC_TEXT("Ÿ��ġ %d%% �� ���������� ����");
  2114.         case POINT_STEAL_SP:        return LC_TEXT("Ÿ��ġ %d%% �� ���ŷ����� ����");
  2115.         case POINT_MANA_BURN_PCT:   return LC_TEXT("%d%% Ȯ���� Ÿ�ݽ� ��� ���ŷ� �Ҹ�");
  2116.         case POINT_DAMAGE_SP_RECOVER:   return LC_TEXT("%d%% Ȯ���� ���ؽ� ���ŷ� ȸ��");
  2117.         case POINT_BLOCK:           return LC_TEXT("����Ÿ�ݽ� ���� Ȯ�� %d%%");
  2118.         case POINT_DODGE:           return LC_TEXT("Ȱ ���� ȸ�� Ȯ�� %d%%");
  2119.         case POINT_RESIST_SWORD:    return LC_TEXT("�Ѽհ� ��� %d%%");
  2120.         case POINT_RESIST_TWOHAND:  return LC_TEXT("��հ� ��� %d%%");
  2121.         case POINT_RESIST_DAGGER:   return LC_TEXT("�μհ� ��� %d%%");
  2122.         case POINT_RESIST_BELL:     return LC_TEXT("��� ��� %d%%");
  2123.         case POINT_RESIST_FAN:      return LC_TEXT("��ä ��� %d%%");
  2124.         case POINT_RESIST_BOW:      return LC_TEXT("Ȱ���� ���� %d%%");
  2125.         case POINT_RESIST_FIRE:     return LC_TEXT("ȭ�� ���� %d%%");
  2126.         case POINT_RESIST_ELEC:     return LC_TEXT("���� ���� %d%%");
  2127.         case POINT_RESIST_MAGIC:    return LC_TEXT("���� ���� %d%%");
  2128.         case POINT_RESIST_WIND:     return LC_TEXT("�ٶ� ���� %d%%");
  2129.         case POINT_RESIST_ICE:      return LC_TEXT("�ñ� ���� %d%%");
  2130.         case POINT_RESIST_EARTH:    return LC_TEXT("���� ���� %d%%");
  2131.         case POINT_RESIST_DARK:     return LC_TEXT("��� ���� %d%%");
  2132.         case POINT_REFLECT_MELEE:   return LC_TEXT("���� Ÿ��ġ �ݻ� Ȯ�� : %d%%");
  2133.         case POINT_REFLECT_CURSE:   return LC_TEXT("���� �ǵ����� Ȯ�� %d%%");
  2134.         case POINT_POISON_REDUCE:   return LC_TEXT("�� ���� %d%%");
  2135.         case POINT_KILL_SP_RECOVER: return LC_TEXT("%d%% Ȯ���� ����ġ�� ���ŷ� ȸ��");
  2136.         case POINT_EXP_DOUBLE_BONUS:    return LC_TEXT("%d%% Ȯ���� ����ġ�� ����ġ �߰� ���");
  2137.         case POINT_GOLD_DOUBLE_BONUS:   return LC_TEXT("%d%% Ȯ���� ����ġ�� �� 2�� ���");
  2138.         case POINT_ITEM_DROP_BONUS: return LC_TEXT("%d%% Ȯ���� ����ġ�� ������ 2�� ���");
  2139.         case POINT_POTION_BONUS:    return LC_TEXT("���� ���� %d%% ���� ����");
  2140.         case POINT_KILL_HP_RECOVERY:    return LC_TEXT("%d%% Ȯ���� ����ġ�� ������ ȸ��");
  2141. //      case POINT_IMMUNE_STUN: return LC_TEXT("�������� ���� %d%%");
  2142. //      case POINT_IMMUNE_SLOW: return LC_TEXT("�������� ���� %d%%");
  2143. //      case POINT_IMMUNE_FALL: return LC_TEXT("�Ѿ����� ���� %d%%");
  2144. //      case POINT_SKILL:   return LC_TEXT("");
  2145. //      case POINT_BOW_DISTANCE:    return LC_TEXT("");
  2146.         case POINT_ATT_GRADE_BONUS: return LC_TEXT("���ݷ� +%d");
  2147.         case POINT_DEF_GRADE_BONUS: return LC_TEXT("���� +%d");
  2148.         case POINT_MAGIC_ATT_GRADE: return LC_TEXT("���� ���ݷ� +%d");
  2149.         case POINT_MAGIC_DEF_GRADE: return LC_TEXT("���� ���� +%d");
  2150. //      case POINT_CURSE_PCT:   return LC_TEXT("");
  2151.         case POINT_MAX_STAMINA: return LC_TEXT("�ִ� ������ +%d");
  2152.         case POINT_ATTBONUS_WARRIOR:    return LC_TEXT("���翡�� ���� +%d%%");
  2153.         case POINT_ATTBONUS_ASSASSIN:   return LC_TEXT("�ڰ����� ���� +%d%%");
  2154.         case POINT_ATTBONUS_SURA:       return LC_TEXT("���󿡰� ���� +%d%%");
  2155.         case POINT_ATTBONUS_SHAMAN:     return LC_TEXT("���翡�� ���� +%d%%");
  2156.         case POINT_ATTBONUS_MONSTER:    return LC_TEXT("���Ϳ��� ���� +%d%%");
  2157.         case POINT_MALL_ATTBONUS:       return LC_TEXT("���ݷ� +%d%%");
  2158.         case POINT_MALL_DEFBONUS:       return LC_TEXT("���� +%d%%");
  2159.         case POINT_MALL_EXPBONUS:       return LC_TEXT("����ġ %d%%");
  2160.         case POINT_MALL_ITEMBONUS:      return LC_TEXT("������ ����� %.1f��");
  2161.         case POINT_MALL_GOLDBONUS:      return LC_TEXT("�� ����� %.1f��");
  2162.         case POINT_MAX_HP_PCT:          return LC_TEXT("�ִ� ������ +%d%%");
  2163.         case POINT_MAX_SP_PCT:          return LC_TEXT("�ִ� ���ŷ� +%d%%");
  2164.         case POINT_SKILL_DAMAGE_BONUS:  return LC_TEXT("��ų ������ %d%%");
  2165.         case POINT_NORMAL_HIT_DAMAGE_BONUS: return LC_TEXT("��Ÿ ������ %d%%");
  2166.         case POINT_SKILL_DEFEND_BONUS:      return LC_TEXT("��ų ������ ���� %d%%");
  2167.         case POINT_NORMAL_HIT_DEFEND_BONUS: return LC_TEXT("��Ÿ ������ ���� %d%%");
  2168. //      case POINT_PC_BANG_EXP_BONUS:   return LC_TEXT("");
  2169. //      case POINT_PC_BANG_DROP_BONUS:  return LC_TEXT("");
  2170. //      case POINT_EXTRACT_HP_PCT:  return LC_TEXT("");
  2171.         case POINT_RESIST_WARRIOR:  return LC_TEXT("������ݿ� %d%% ����");
  2172.         case POINT_RESIST_ASSASSIN: return LC_TEXT("�ڰ����ݿ� %d%% ����");
  2173.         case POINT_RESIST_SURA:     return LC_TEXT("������ݿ� %d%% ����");
  2174.         case POINT_RESIST_SHAMAN:   return LC_TEXT("������ݿ� %d%% ����");
  2175. #ifdef __ANTI_RESIST_MAGIC_BONUS__
  2176.         case POINT_ANTI_RESIST_MAGIC:
  2177.             return LC_TEXT("Anti Magic Resistance: %d%%");
  2178. #endif
  2179.         default:                    return NULL;
  2180.     }
  2181. }
  2182.  
  2183. static bool FN_hair_affect_string(LPCHARACTER ch, char *buf, size_t bufsiz)
  2184. {
  2185.     if (NULL == ch || NULL == buf)
  2186.         return false;
  2187.  
  2188.     CAffect* aff = NULL;
  2189.     time_t expire = 0;
  2190.     struct tm ltm;
  2191.     int year, mon, day;
  2192.     int offset = 0;
  2193.  
  2194.     aff = ch->FindAffect(AFFECT_HAIR);
  2195.  
  2196.     if (NULL == aff)
  2197.         return false;
  2198.  
  2199.     expire = ch->GetQuestFlag("hair.limit_time");
  2200.  
  2201.     if (expire < get_global_time())
  2202.         return false;
  2203.  
  2204.     // set apply string
  2205.     offset = snprintf(buf, bufsiz, FN_point_string(aff->bApplyOn), aff->lApplyValue);
  2206.  
  2207.     if (offset < 0 || offset >= (int) bufsiz)
  2208.         offset = bufsiz - 1;
  2209.  
  2210.     localtime_r(&expire, &ltm);
  2211.  
  2212.     year    = ltm.tm_year + 1900;
  2213.     mon     = ltm.tm_mon + 1;
  2214.     day     = ltm.tm_mday;
  2215.  
  2216.     snprintf(buf + offset, bufsiz - offset, LC_TEXT(" (������ : %d�� %d�� %d��)"), year, mon, day);
  2217.  
  2218.     return true;
  2219. }
  2220.  
  2221. ACMD(do_costume)
  2222. {
  2223.     char buf[512];
  2224.     const size_t bufferSize = sizeof(buf);
  2225.  
  2226.     char arg1[256];
  2227.     one_argument(argument, arg1, sizeof(arg1));
  2228.  
  2229.     CItem* pBody = ch->GetWear(WEAR_COSTUME_BODY);
  2230.     CItem* pHair = ch->GetWear(WEAR_COSTUME_HAIR);
  2231.     CItem* pAcce = ch->GetWear(WEAR_COSTUME_ACCE);
  2232.  
  2233.     ch->ChatPacket(CHAT_TYPE_INFO, "COSTUME status:");
  2234.  
  2235.     if (pHair)
  2236.     {
  2237.         const char* itemName = pHair->GetName();
  2238.         ch->ChatPacket(CHAT_TYPE_INFO, "  HAIR : %s", itemName);
  2239.  
  2240.         for (int i = 0; i < pHair->GetAttributeCount(); ++i)
  2241.         {
  2242.             const TPlayerItemAttribute& attr = pHair->GetAttribute(i);
  2243.             if (0 < attr.bType)
  2244.             {
  2245.                 snprintf(buf, bufferSize, FN_point_string(attr.bType), attr.sValue);
  2246.                 ch->ChatPacket(CHAT_TYPE_INFO, "     %s", buf);
  2247.             }
  2248.         }
  2249.  
  2250.         if (pHair->IsEquipped() && arg1[0] == 'h')
  2251.             ch->UnequipItem(pHair);
  2252.     }
  2253.  
  2254.     if (pBody)
  2255.     {
  2256.         const char* itemName = pBody->GetName();
  2257.         ch->ChatPacket(CHAT_TYPE_INFO, "  BODY : %s", itemName);
  2258.  
  2259.         if (pBody->IsEquipped() && arg1[0] == 'b')
  2260.             ch->UnequipItem(pBody);
  2261.     }
  2262.    
  2263.     if (pAcce)
  2264.     {
  2265.         const char* itemName = pAcce->GetName();
  2266.         ch->ChatPacket(CHAT_TYPE_INFO, "  Acce : %s", itemName);
  2267.  
  2268.         for (int i = 0; i < pAcce->GetAttributeCount(); ++i)
  2269.         {
  2270.             const TPlayerItemAttribute& attr = pAcce->GetAttribute(i);
  2271.             if (0 < attr.bType)
  2272.             {
  2273.                 snprintf(buf, bufferSize, FN_point_string(attr.bType), attr.sValue);
  2274.                 ch->ChatPacket(CHAT_TYPE_INFO, "     %s", buf);
  2275.             }
  2276.         }
  2277.  
  2278.         if (pAcce->IsEquipped() && arg1[0] == 'a')
  2279.             ch->UnequipItem(pAcce);
  2280.     }
  2281. }
  2282.  
  2283. ACMD(do_hair)
  2284. {
  2285.     char buf[256];
  2286.  
  2287.     if (false == FN_hair_affect_string(ch, buf, sizeof(buf)))
  2288.         return;
  2289.  
  2290.     ch->ChatPacket(CHAT_TYPE_INFO, buf);
  2291. }
  2292.  
  2293. ACMD(do_acce)
  2294. {
  2295.     if (!ch->CanDoAcce())
  2296.         return;
  2297.    
  2298.     dev_log(LOG_DEB0, "Acce command <%s>: %s", ch->GetName(), argument);
  2299.     int acce_index = 0, inven_index = 0;
  2300.     const char *line;
  2301.    
  2302.     char arg1[256], arg2[256], arg3[256];
  2303.     line = two_arguments(argument, arg1, sizeof(arg1), arg2, sizeof(arg2));
  2304.     one_argument(line, arg3, sizeof(arg3));
  2305.     if (0 == arg1[0])
  2306.     {
  2307.         ch->ChatPacket(CHAT_TYPE_INFO, "Usage: acce open");
  2308.         ch->ChatPacket(CHAT_TYPE_INFO, "       acce close");
  2309.         ch->ChatPacket(CHAT_TYPE_INFO, "       acce add <inveltory_index>");
  2310.         ch->ChatPacket(CHAT_TYPE_INFO, "       acce delete <acce_index>");
  2311.         ch->ChatPacket(CHAT_TYPE_INFO, "       acce list");
  2312.         ch->ChatPacket(CHAT_TYPE_INFO, "       acce cancel");
  2313.         ch->ChatPacket(CHAT_TYPE_INFO, "       acce make [all]");
  2314.         return;
  2315.     }
  2316.    
  2317.     const std::string& strArg1 = std::string(arg1);
  2318.     if (strArg1 == "r_info")
  2319.     {
  2320.         if (0 == arg2[0])
  2321.             Acce_request_result_list(ch);
  2322.         else
  2323.         {
  2324.             if (isdigit(*arg2))
  2325.             {
  2326.                 int listIndex = 0, requestCount = 1;
  2327.                 str_to_number(listIndex, arg2);
  2328.                 if (0 != arg3[0] && isdigit(*arg3))
  2329.                     str_to_number(requestCount, arg3);
  2330.                
  2331.                 Acce_request_material_info(ch, listIndex, requestCount);
  2332.             }
  2333.         }
  2334.        
  2335.         return;
  2336.     }
  2337.     else if (strArg1 == "absorption")
  2338.     {
  2339.         Acce_absorption_make(ch);
  2340.         return;
  2341.     }
  2342.     else if (strArg1 == "open_absorption")
  2343.     {
  2344.         Acce_absorption_open(ch);
  2345.         return;
  2346.     }
  2347.    
  2348.     switch (LOWER(arg1[0]))
  2349.     {
  2350.         case 'o':
  2351.             Acce_open(ch);
  2352.             break;
  2353.         case 'c':
  2354.             Acce_close(ch);
  2355.             break;
  2356.         case 'l':
  2357.             Acce_show_list(ch);
  2358.             break;
  2359.         case 'a':
  2360.             {
  2361.                 if (0 == arg2[0] || !isdigit(*arg2) || 0 == arg3[0] || !isdigit(*arg3))
  2362.                     return;
  2363.                
  2364.                 str_to_number(acce_index, arg2);
  2365.                 str_to_number(inven_index, arg3);
  2366.                 Acce_add_item (ch, acce_index, inven_index);
  2367.             }
  2368.             break;
  2369.         case 'd':
  2370.             {
  2371.                 if (0 == arg2[0] || !isdigit(*arg2))
  2372.                     return;
  2373.                
  2374.                 str_to_number(acce_index, arg2);
  2375.                 Acce_delete_item (ch, acce_index);
  2376.             }
  2377.             break;
  2378.         case 'm':
  2379.             if (0 != arg2[0])
  2380.             {
  2381.                 while (true == Acce_make(ch))
  2382.                     dev_log(LOG_DEB0, "Acce make success!");
  2383.             }
  2384.             else
  2385.                 Acce_make(ch);
  2386.             break;
  2387.         default:
  2388.             return;
  2389.     }
  2390. }
  2391.  
  2392. ACMD(do_inventory)
  2393. {
  2394.     int index = 0;
  2395.     int count       = 1;
  2396.  
  2397.     char arg1[256];
  2398.     char arg2[256];
  2399.  
  2400.     LPITEM  item;
  2401.  
  2402.     two_arguments(argument, arg1, sizeof(arg1), arg2, sizeof(arg2));
  2403.  
  2404.     if (!*arg1)
  2405.     {
  2406.         ch->ChatPacket(CHAT_TYPE_INFO, "Usage: inventory <start_index> <count>");
  2407.         return;
  2408.     }
  2409.  
  2410.     if (!*arg2)
  2411.     {
  2412.         index = 0;
  2413.         str_to_number(count, arg1);
  2414.     }
  2415.     else
  2416.     {
  2417.         str_to_number(index, arg1); index = MIN(index, INVENTORY_MAX_NUM);
  2418.         str_to_number(count, arg2); count = MIN(count, INVENTORY_MAX_NUM);
  2419.     }
  2420.  
  2421.     for (int i = 0; i < count; ++i)
  2422.     {
  2423.         if (index >= INVENTORY_MAX_NUM)
  2424.             break;
  2425.  
  2426.         item = ch->GetInventoryItem(index);
  2427.  
  2428.         ch->ChatPacket(CHAT_TYPE_INFO, "inventory [%d] = %s",
  2429.                         index, item ? item->GetName() : "<NONE>");
  2430.         ++index;
  2431.     }
  2432. }
  2433.  
  2434. //gift notify quest command
  2435. ACMD(do_gift)
  2436. {
  2437.     ch->ChatPacket(CHAT_TYPE_COMMAND, "gift");
  2438. }
  2439.  
  2440. #ifdef NEW_PET_SYSTEM
  2441. ACMD(do_CubePetAdd) {
  2442.  
  2443.     int pos = 0;
  2444.     int invpos = 0;
  2445.  
  2446.     const char *line;
  2447.     char arg1[256], arg2[256], arg3[256];
  2448.  
  2449.     line = two_arguments(argument, arg1, sizeof(arg1), arg2, sizeof(arg2));
  2450.     one_argument(line, arg3, sizeof(arg3));
  2451.  
  2452.     if (0 == arg1[0])
  2453.         return;
  2454.     //const std::string& strArg1 = std::string(arg1);
  2455.     switch (LOWER(arg1[0]))
  2456.     {
  2457.     case 'a':   // add cue_index inven_index
  2458.     {
  2459.         if (0 == arg2[0] || !isdigit(*arg2) ||
  2460.             0 == arg3[0] || !isdigit(*arg3))
  2461.             return;
  2462.  
  2463.         str_to_number(pos, arg2);
  2464.         str_to_number(invpos, arg3);
  2465.  
  2466.     }
  2467.     break;
  2468.  
  2469.     default:
  2470.         return;
  2471.     }
  2472.  
  2473.     if (ch->GetNewPetSystem()->IsActivePet())
  2474.         ch->GetNewPetSystem()->SetItemCube(pos, invpos);
  2475.     else
  2476.         return;
  2477.  
  2478. }
  2479.  
  2480. ACMD(do_PetSkill) {
  2481.     char arg1[256];
  2482.     one_argument(argument, arg1, sizeof(arg1));
  2483.     if (!*arg1)
  2484.         return;
  2485.  
  2486.     DWORD skillslot = 0;
  2487.     str_to_number(skillslot, arg1);
  2488.     if (skillslot > 2 || skillslot < 0)
  2489.         return;
  2490.  
  2491.     if (ch->GetNewPetSystem()->IsActivePet())
  2492.         ch->GetNewPetSystem()->DoPetSkill(skillslot);
  2493.     else
  2494.         ch->ChatPacket(CHAT_TYPE_INFO, "Devi aver evocato il pet per procedere");
  2495. }
  2496.  
  2497. ACMD(do_FeedCubePet) {
  2498.     char arg1[256];
  2499.     one_argument(argument, arg1, sizeof(arg1));
  2500.     if (!*arg1)
  2501.         return;
  2502.  
  2503.     DWORD feedtype = 0;
  2504.     str_to_number(feedtype, arg1);
  2505.     if (ch->GetNewPetSystem()->IsActivePet())
  2506.         ch->GetNewPetSystem()->ItemCubeFeed(feedtype);
  2507.     else
  2508.         ch->ChatPacket(CHAT_TYPE_INFO, "Nu aveti un insotitor chemat");
  2509. }
  2510. ACMD(do_PetEvo) {
  2511.  
  2512.     if (ch->GetNewPetSystem()->IsActivePet()) {
  2513.  
  2514.         int it[3][7] = {
  2515.                         { 55003, 30058, 30073, 30041, 30017, 30074, 30088 }, //Here Modify Items to request for 1 evo
  2516.                         { 55004, 30035, 30038, 30031, 30080, 30074, 27994 }, //Here Modify Items to request for 2 evo
  2517.                         { 55005, 30083, 27992, 27993, 30086, 30077, 27994 }  //Here Modify Items to request for 3 evo
  2518.         };
  2519.         int ic[3][7] = {{ 10, 10, 10, 10, 10, 5, 5 },
  2520.                         { 10, 10, 10, 10, 5, 10, 8 },
  2521.                         { 10, 10, 2, 10, 10, 10, 5 }
  2522.         };
  2523.         int tmpevo = ch->GetNewPetSystem()->GetEvolution();
  2524.  
  2525.         if (ch->GetNewPetSystem()->GetLevel() == 40 && tmpevo == 0 ||
  2526.             ch->GetNewPetSystem()->GetLevel() == 80 && tmpevo == 1 ||
  2527.             ch->GetNewPetSystem()->GetLevel() >= 82 && tmpevo == 2) {
  2528.             for (int b = 0; b < 7; b++) {
  2529.                 if (ch->CountSpecifyItem(it[tmpevo][b]) < ic[tmpevo][b]) {
  2530.                     ch->ChatPacket(CHAT_TYPE_INFO, "[PetEvolution] Items Required:");
  2531.                     for (int c = 0; c < 7; c++) {
  2532.                         DWORD vnum = it[tmpevo][c];
  2533.                         ch->ChatPacket(CHAT_TYPE_INFO, "%s X%d", ITEM_MANAGER::instance().GetTable(vnum)->szLocaleName , ic[tmpevo][c]);
  2534.                     }
  2535.                     return;
  2536.                 }
  2537.             }
  2538.             for (int c = 0; c < 7; c++) {
  2539.                 ch->RemoveSpecifyItem(it[tmpevo][c], ic[tmpevo][c]);
  2540.             }
  2541.             ch->GetNewPetSystem()->IncreasePetEvolution();
  2542.  
  2543.         }
  2544.         else {
  2545.             ch->ChatPacket(CHAT_TYPE_INFO, "You can't evolve your pet!");
  2546.             return;
  2547.         }
  2548.  
  2549.     }else
  2550.         ch->ChatPacket(CHAT_TYPE_INFO, "Your pet should be summoned!");
  2551.  
  2552. }
  2553. #endif
  2554.  
  2555. ACMD(do_cube)
  2556. {
  2557.     if (!ch->CanDoCube())
  2558.         return;
  2559.  
  2560.     dev_log(LOG_DEB0, "CUBE COMMAND <%s>: %s", ch->GetName(), argument);
  2561.     int cube_index = 0, inven_index = 0;
  2562.     const char *line;
  2563.  
  2564.     char arg1[256], arg2[256], arg3[256];
  2565.  
  2566.     line = two_arguments(argument, arg1, sizeof(arg1), arg2, sizeof(arg2));
  2567.     one_argument(line, arg3, sizeof(arg3));
  2568.  
  2569.     if (0 == arg1[0])
  2570.     {
  2571.         // print usage
  2572.         ch->ChatPacket(CHAT_TYPE_INFO, "Usage: cube open");
  2573.         ch->ChatPacket(CHAT_TYPE_INFO, "       cube close");
  2574.         ch->ChatPacket(CHAT_TYPE_INFO, "       cube add <inveltory_index>");
  2575.         ch->ChatPacket(CHAT_TYPE_INFO, "       cube delete <cube_index>");
  2576.         ch->ChatPacket(CHAT_TYPE_INFO, "       cube list");
  2577.         ch->ChatPacket(CHAT_TYPE_INFO, "       cube cancel");
  2578.         ch->ChatPacket(CHAT_TYPE_INFO, "       cube make [all]");
  2579.         return;
  2580.     }
  2581.  
  2582.     const std::string& strArg1 = std::string(arg1);
  2583.  
  2584.     // r_info (request information)
  2585.     // /cube r_info     ==> (Client -> Server) ���� NPC�� ���� �� �ִ� ������ ��û
  2586.     //                      (Server -> Client) /cube r_list npcVNUM resultCOUNT 123,1/125,1/128,1/130,5
  2587.     //
  2588.     // /cube r_info 3   ==> (Client -> Server) ���� NPC�� ����� �ִ� ������ �� 3��° �������� ����� �� �ʿ��� ������ ��û
  2589.     // /cube r_info 3 5 ==> (Client -> Server) ���� NPC�� ����� �ִ� ������ �� 3��° �����ۺ��� ���� 5���� �������� ����� �� �ʿ��� ��� ������ ��û
  2590.     //                     (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
  2591.     //
  2592.     if (strArg1 == "r_info")
  2593.     {
  2594.         if (0 == arg2[0])
  2595.             Cube_request_result_list(ch);
  2596.         else
  2597.         {
  2598.             if (isdigit(*arg2))
  2599.             {
  2600.                 int listIndex = 0, requestCount = 1;
  2601.                 str_to_number(listIndex, arg2);
  2602.  
  2603.                 if (0 != arg3[0] && isdigit(*arg3))
  2604.                     str_to_number(requestCount, arg3);
  2605.  
  2606.                 Cube_request_material_info(ch, listIndex, requestCount);
  2607.             }
  2608.         }
  2609.  
  2610.         return;
  2611.     }
  2612.  
  2613.     switch (LOWER(arg1[0]))
  2614.     {
  2615.         case 'o':   // open
  2616.             Cube_open(ch);
  2617.             break;
  2618.  
  2619.         case 'c':   // close
  2620.             Cube_close(ch);
  2621.             break;
  2622.  
  2623.         case 'l':   // list
  2624.             Cube_show_list(ch);
  2625.             break;
  2626.  
  2627.         case 'a':   // add cue_index inven_index
  2628.             {
  2629.                 if (0 == arg2[0] || !isdigit(*arg2) ||
  2630.                     0 == arg3[0] || !isdigit(*arg3))
  2631.                     return;
  2632.  
  2633.                 str_to_number(cube_index, arg2);
  2634.                 str_to_number(inven_index, arg3);
  2635.                 Cube_add_item (ch, cube_index, inven_index);
  2636.             }
  2637.             break;
  2638.  
  2639.         case 'd':   // delete
  2640.             {
  2641.                 if (0 == arg2[0] || !isdigit(*arg2))
  2642.                     return;
  2643.  
  2644.                 str_to_number(cube_index, arg2);
  2645.                 Cube_delete_item (ch, cube_index);
  2646.             }
  2647.             break;
  2648.  
  2649.         case 'm':   // make
  2650.             if (0 != arg2[0])
  2651.             {
  2652.                 while (true == Cube_make(ch))
  2653.                     dev_log (LOG_DEB0, "cube make success");
  2654.             }
  2655.             else
  2656.                 Cube_make(ch);
  2657.             break;
  2658.  
  2659.         default:
  2660.             return;
  2661.     }
  2662. }
  2663.  
  2664. ACMD(do_in_game_mall)
  2665. {
  2666.     if (LC_IsYMIR() == true || LC_IsKorea() == true)
  2667.     {
  2668.         ch->ChatPacket(CHAT_TYPE_COMMAND, "mall http://metin2.co.kr/04_mall/mall/login.htm");
  2669.         return;
  2670.     }
  2671.  
  2672.     if (true == LC_IsTaiwan())
  2673.     {
  2674.         ch->ChatPacket(CHAT_TYPE_COMMAND, "mall http://203.69.141.203/mall/mall/item_main.htm");
  2675.         return;
  2676.     }
  2677.  
  2678.     // ��_�� �赵���� �����۸� URL �ϵ��ڵ� �߰�
  2679.     if (true == LC_IsWE_Korea())
  2680.     {
  2681.         ch->ChatPacket(CHAT_TYPE_COMMAND, "mall http://metin2.co.kr/50_we_mall/mall/login.htm");
  2682.         return;
  2683.     }
  2684.  
  2685.     if (LC_IsJapan() == true)
  2686.     {
  2687.         ch->ChatPacket(CHAT_TYPE_COMMAND, "mall http://mt2.oge.jp/itemmall/itemList.php");
  2688.         return;
  2689.     }
  2690.    
  2691.     if (LC_IsNewCIBN() == true && test_server)
  2692.     {
  2693.         ch->ChatPacket(CHAT_TYPE_COMMAND, "mall http://218.99.6.51/04_mall/mall/login.htm");
  2694.         return;
  2695.     }
  2696.  
  2697.     if (LC_IsSingapore() == true)
  2698.     {
  2699.         ch->ChatPacket(CHAT_TYPE_COMMAND, "mall http://www.metin2.sg/ishop.php");
  2700.         return;
  2701.     }  
  2702.    
  2703.     /*
  2704.     if (LC_IsCanada() == true)
  2705.     {
  2706.         ch->ChatPacket(CHAT_TYPE_COMMAND, "mall http://mall.z8games.com/mall_entry.aspx?tb=m2");
  2707.         return;
  2708.     }*/
  2709.  
  2710.     if (LC_IsEurope() == true)
  2711.     {
  2712.         char country_code[3];
  2713.  
  2714.         switch (LC_GetLocalType())
  2715.         {
  2716.             case LC_GERMANY:    country_code[0] = 'd'; country_code[1] = 'e'; country_code[2] = '\0'; break;
  2717.             case LC_FRANCE:     country_code[0] = 'f'; country_code[1] = 'r'; country_code[2] = '\0'; break;
  2718.             case LC_ITALY:      country_code[0] = 'i'; country_code[1] = 't'; country_code[2] = '\0'; break;
  2719.             case LC_SPAIN:      country_code[0] = 'e'; country_code[1] = 's'; country_code[2] = '\0'; break;
  2720.             case LC_UK:         country_code[0] = 'e'; country_code[1] = 'n'; country_code[2] = '\0'; break;
  2721.             case LC_TURKEY:     country_code[0] = 't'; country_code[1] = 'r'; country_code[2] = '\0'; break;
  2722.             case LC_POLAND:     country_code[0] = 'p'; country_code[1] = 'l'; country_code[2] = '\0'; break;
  2723.             case LC_PORTUGAL:   country_code[0] = 'p'; country_code[1] = 't'; country_code[2] = '\0'; break;
  2724.             case LC_GREEK:      country_code[0] = 'g'; country_code[1] = 'r'; country_code[2] = '\0'; break;
  2725.             case LC_RUSSIA:     country_code[0] = 'r'; country_code[1] = 'u'; country_code[2] = '\0'; break;
  2726.             case LC_DENMARK:    country_code[0] = 'd'; country_code[1] = 'k'; country_code[2] = '\0'; break;
  2727.             case LC_BULGARIA:   country_code[0] = 'b'; country_code[1] = 'g'; country_code[2] = '\0'; break;
  2728.             case LC_CROATIA:    country_code[0] = 'h'; country_code[1] = 'r'; country_code[2] = '\0'; break;
  2729.             case LC_MEXICO:     country_code[0] = 'm'; country_code[1] = 'x'; country_code[2] = '\0'; break;
  2730.             case LC_ARABIA:     country_code[0] = 'a'; country_code[1] = 'e'; country_code[2] = '\0'; break;
  2731.             case LC_CZECH:      country_code[0] = 'c'; country_code[1] = 'z'; country_code[2] = '\0'; break;
  2732.             case LC_ROMANIA:    country_code[0] = 'r'; country_code[1] = 'o'; country_code[2] = '\0'; break;
  2733.             case LC_HUNGARY:    country_code[0] = 'h'; country_code[1] = 'u'; country_code[2] = '\0'; break;
  2734.             case LC_NETHERLANDS: country_code[0] = 'n'; country_code[1] = 'l'; country_code[2] = '\0'; break;
  2735.             case LC_USA:        country_code[0] = 'u'; country_code[1] = 's'; country_code[2] = '\0'; break;
  2736.             case LC_CANADA: country_code[0] = 'c'; country_code[1] = 'a'; country_code[2] = '\0'; break;
  2737.             default:
  2738.                 if (test_server == true)
  2739.                 {
  2740.                     country_code[0] = 'd'; country_code[1] = 'e'; country_code[2] = '\0';
  2741.                 }
  2742.                 break;
  2743.         }
  2744.  
  2745.         char buf[512+1];
  2746.         char sas[33];
  2747.         MD5_CTX ctx;
  2748.         const char sas_key[] = "GF9001";
  2749.  
  2750.         snprintf(buf, sizeof(buf), "%u%u%s", ch->GetPlayerID(), ch->GetAID(), sas_key);
  2751.  
  2752.         MD5Init(&ctx);
  2753.         MD5Update(&ctx, (const unsigned char *) buf, strlen(buf));
  2754. #ifdef __FreeBSD__
  2755.         MD5End(&ctx, sas);
  2756. #else
  2757.         static const char hex[] = "0123456789abcdef";
  2758.         unsigned char digest[16];
  2759.         MD5Final(digest, &ctx);
  2760.         int i;
  2761.         for (i = 0; i < 16; ++i) {
  2762.             sas[i+i] = hex[digest[i] >> 4];
  2763.             sas[i+i+1] = hex[digest[i] & 0x0f];
  2764.         }
  2765.         sas[i+i] = '\0';
  2766. #endif
  2767.  
  2768.         snprintf(buf, sizeof(buf), "mall http://%s/ishop?pid=%u&c=%s&sid=%d&sas=%s",
  2769.                 g_strWebMallURL.c_str(), ch->GetPlayerID(), country_code, g_server_id, sas);
  2770.  
  2771.         ch->ChatPacket(CHAT_TYPE_COMMAND, buf);
  2772.     }
  2773. }
  2774.  
  2775. // �ֻ���
  2776. ACMD(do_dice)
  2777. {
  2778.     char arg1[256], arg2[256];
  2779.     int start = 1, end = 100;
  2780.  
  2781.     two_arguments(argument, arg1, sizeof(arg1), arg2, sizeof(arg2));
  2782.  
  2783.     if (*arg1 && *arg2)
  2784.     {
  2785.         start = atoi(arg1);
  2786.         end = atoi(arg2);
  2787.     }
  2788.     else if (*arg1 && !*arg2)
  2789.     {
  2790.         start = 1;
  2791.         end = atoi(arg1);
  2792.     }
  2793.  
  2794.     end = MAX(start, end);
  2795.     start = MIN(start, end);
  2796.  
  2797.     int n = number(start, end);
  2798.    
  2799.     if (ch->GetParty())
  2800.         ch->GetParty()->ChatPacketToAllMember(CHAT_TYPE_INFO, LC_TEXT("%s���� �ֻ����� ���� %d�� ���Խ��ϴ�. (%d-%d)"), ch->GetName(), n, start, end);
  2801.     else
  2802.         ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("����� �ֻ����� ���� %d�� ���Խ��ϴ�. (%d-%d)"), n, start, end);
  2803. }
  2804.  
  2805. ACMD(do_click_mall)
  2806. {
  2807.     ch->ChatPacket(CHAT_TYPE_COMMAND, "ShowMeMallPassword");
  2808. }
  2809.  
  2810. ACMD(do_ride)
  2811. {
  2812.     dev_log(LOG_DEB0, "[DO_RIDE] start");
  2813.     if (ch->IsDead() || ch->IsStun())
  2814.     return;
  2815.  
  2816.     {
  2817.     if (ch->IsHorseRiding())
  2818.     {
  2819.         dev_log(LOG_DEB0, "[DO_RIDE] stop riding");
  2820.         ch->StopRiding();
  2821.         return;
  2822.     }
  2823.  
  2824.     if (ch->GetMountVnum())
  2825.     {
  2826.         dev_log(LOG_DEB0, "[DO_RIDE] unmount");
  2827.         do_unmount(ch, NULL, 0, 0);
  2828.         return;
  2829.     }
  2830.     }
  2831.  
  2832.     {
  2833.     if (ch->GetHorse() != NULL)
  2834.     {
  2835.         dev_log(LOG_DEB0, "[DO_RIDE] start riding");
  2836.         ch->StartRiding();
  2837.         return;
  2838.     }
  2839.  
  2840.     for (BYTE i=0; i<INVENTORY_MAX_NUM; ++i)
  2841.     {
  2842.         LPITEM item = ch->GetInventoryItem(i);
  2843.         if (NULL == item)
  2844.         continue;
  2845.  
  2846.         if (item->IsRideItem())
  2847.         {
  2848.             if (NULL==ch->GetWear(WEAR_UNIQUE1) || NULL==ch->GetWear(WEAR_UNIQUE2) || NULL==ch->GetWear(WEAR_COSTUME_MOUNT))
  2849.             {
  2850.                 dev_log(LOG_DEB0, "[DO_RIDE] USE UNIQUE ITEM");
  2851.                 ch->UseItem(TItemPos (INVENTORY, i));
  2852.                 return;
  2853.             }
  2854.         }
  2855.  
  2856.         switch (item->GetVnum())
  2857.         {
  2858.         case 71114:
  2859.         case 71116:
  2860.         case 71118:
  2861.         case 71120:
  2862.             dev_log(LOG_DEB0, "[DO_RIDE] USE QUEST ITEM");
  2863.             ch->UseItem(TItemPos (INVENTORY, i));
  2864.             return;
  2865.         }
  2866.  
  2867.         if( (item->GetVnum() > 52000) && (item->GetVnum() < 52091) )    {
  2868.             dev_log(LOG_DEB0, "[DO_RIDE] USE QUEST ITEM");
  2869.             ch->UseItem(TItemPos (INVENTORY, i));
  2870.             return;
  2871.         }
  2872.     }
  2873.     }
  2874.  
  2875.     ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("?? ?? ??????."));
  2876. }
  2877.  
  2878. #ifdef __AUCTION__
  2879. // temp_auction
  2880. ACMD(do_get_item_id_list)
  2881. {
  2882.     for (int i = 0; i < INVENTORY_MAX_NUM; i++)
  2883.     {
  2884.         LPITEM item = ch->GetInventoryItem(i);
  2885.         if (item != NULL)
  2886.             ch->ChatPacket(CHAT_TYPE_INFO, "name : %s id : %d", item->GetProto()->szName, item->GetID());
  2887.     }
  2888. }
  2889.  
  2890. // temp_auction
  2891.  
  2892. ACMD(do_enroll_auction)
  2893. {
  2894.     char arg1[256];
  2895.     char arg2[256];
  2896.     char arg3[256];
  2897.     char arg4[256];
  2898.     two_arguments (two_arguments(argument, arg1, sizeof(arg1), arg2, sizeof(arg2)), arg3, sizeof(arg3), arg4, sizeof(arg4));
  2899.    
  2900.     DWORD item_id = strtoul(arg1, NULL, 10);
  2901.     BYTE empire = strtoul(arg2, NULL, 10);
  2902.     int bidPrice = strtol(arg3, NULL, 10);
  2903.     int immidiatePurchasePrice = strtol(arg4, NULL, 10);
  2904.  
  2905.     LPITEM item = ITEM_MANAGER::instance().Find(item_id);
  2906.     if (item == NULL)
  2907.         return;
  2908.  
  2909.     AuctionManager::instance().enroll_auction(ch, item, empire, bidPrice, immidiatePurchasePrice);
  2910. }
  2911.  
  2912. ACMD(do_enroll_wish)
  2913. {
  2914.     char arg1[256];
  2915.     char arg2[256];
  2916.     char arg3[256];
  2917.     one_argument (two_arguments(argument, arg1, sizeof(arg1), arg2, sizeof(arg2)), arg3, sizeof(arg3));
  2918.    
  2919.     DWORD item_num = strtoul(arg1, NULL, 10);
  2920.     BYTE empire = strtoul(arg2, NULL, 10);
  2921.     int wishPrice = strtol(arg3, NULL, 10);
  2922.  
  2923.     AuctionManager::instance().enroll_wish(ch, item_num, empire, wishPrice);
  2924. }
  2925.  
  2926. ACMD(do_enroll_sale)
  2927. {
  2928.     char arg1[256];
  2929.     char arg2[256];
  2930.     char arg3[256];
  2931.     one_argument (two_arguments(argument, arg1, sizeof(arg1), arg2, sizeof(arg2)), arg3, sizeof(arg3));
  2932.    
  2933.     DWORD item_id = strtoul(arg1, NULL, 10);
  2934.     DWORD wisher_id = strtoul(arg2, NULL, 10);
  2935.     int salePrice = strtol(arg3, NULL, 10);
  2936.  
  2937.     LPITEM item = ITEM_MANAGER::instance().Find(item_id);
  2938.     if (item == NULL)
  2939.         return;
  2940.  
  2941.     AuctionManager::instance().enroll_sale(ch, item, wisher_id, salePrice);
  2942. }
  2943.  
  2944. // temp_auction
  2945. // packet���� ����ϰ� �ϰ�, �̰� �����ؾ��Ѵ�.
  2946. ACMD(do_get_auction_list)
  2947. {
  2948.     char arg1[256];
  2949.     char arg2[256];
  2950.     char arg3[256];
  2951.     two_arguments (one_argument (argument, arg1, sizeof(arg1)), arg2, sizeof(arg2), arg3, sizeof(arg3));
  2952.  
  2953.     AuctionManager::instance().get_auction_list (ch, strtoul(arg1, NULL, 10), strtoul(arg2, NULL, 10), strtoul(arg3, NULL, 10));
  2954. }
  2955. //
  2956. //ACMD(do_get_wish_list)
  2957. //{
  2958. //  char arg1[256];
  2959. //  char arg2[256];
  2960. //  char arg3[256];
  2961. //  two_arguments (one_argument (argument, arg1, sizeof(arg1)), arg2, sizeof(arg2), arg3, sizeof(arg3));
  2962. //
  2963. //  AuctionManager::instance().get_wish_list (ch, strtoul(arg1, NULL, 10), strtoul(arg2, NULL, 10), strtoul(arg3, NULL, 10));
  2964. //}
  2965. ACMD (do_get_my_auction_list)
  2966. {
  2967.     char arg1[256];
  2968.     char arg2[256];
  2969.     two_arguments (argument, arg1, sizeof(arg1), arg2, sizeof(arg2));
  2970.  
  2971.     AuctionManager::instance().get_my_auction_list (ch, strtoul(arg1, NULL, 10), strtoul(arg2, NULL, 10));
  2972. }
  2973.  
  2974. ACMD (do_get_my_purchase_list)
  2975. {
  2976.     char arg1[256];
  2977.     char arg2[256];
  2978.     two_arguments (argument, arg1, sizeof(arg1), arg2, sizeof(arg2));
  2979.  
  2980.     AuctionManager::instance().get_my_purchase_list (ch, strtoul(arg1, NULL, 10), strtoul(arg2, NULL, 10));
  2981. }
  2982.  
  2983. ACMD (do_auction_bid)
  2984. {
  2985.     char arg1[256];
  2986.     char arg2[256];
  2987.     two_arguments (argument, arg1, sizeof(arg1), arg2, sizeof(arg2));
  2988.  
  2989.     AuctionManager::instance().bid (ch, strtoul(arg1, NULL, 10), strtoul(arg2, NULL, 10));
  2990. }
  2991.  
  2992. ACMD (do_auction_impur)
  2993. {
  2994.     char arg1[256];
  2995.     one_argument (argument, arg1, sizeof(arg1));
  2996.  
  2997.     AuctionManager::instance().immediate_purchase (ch, strtoul(arg1, NULL, 10));
  2998. }
  2999.  
  3000. ACMD (do_get_auctioned_item)
  3001. {
  3002.     char arg1[256];
  3003.     char arg2[256];
  3004.     two_arguments (argument, arg1, sizeof(arg1), arg2, sizeof(arg2));
  3005.  
  3006.     AuctionManager::instance().get_auctioned_item (ch, strtoul(arg1, NULL, 10), strtoul(arg2, NULL, 10));
  3007. }
  3008.  
  3009. ACMD (do_buy_sold_item)
  3010. {
  3011.     char arg1[256];
  3012.     char arg2[256];
  3013.     one_argument (argument, arg1, sizeof(arg1));
  3014.  
  3015.     AuctionManager::instance().get_auctioned_item (ch, strtoul(arg1, NULL, 10), strtoul(arg2, NULL, 10));
  3016. }
  3017.  
  3018. ACMD (do_cancel_auction)
  3019. {
  3020.     char arg1[256];
  3021.     one_argument (argument, arg1, sizeof(arg1));
  3022.  
  3023.     AuctionManager::instance().cancel_auction (ch, strtoul(arg1, NULL, 10));
  3024. }
  3025.  
  3026. ACMD (do_cancel_wish)
  3027. {
  3028.     char arg1[256];
  3029.     one_argument (argument, arg1, sizeof(arg1));
  3030.  
  3031.     AuctionManager::instance().cancel_wish (ch, strtoul(arg1, NULL, 10));
  3032. }
  3033.  
  3034. ACMD (do_cancel_sale)
  3035. {
  3036.     char arg1[256];
  3037.     one_argument (argument, arg1, sizeof(arg1));
  3038.  
  3039.     AuctionManager::instance().cancel_sale (ch, strtoul(arg1, NULL, 10));
  3040. }
  3041.  
  3042. ACMD (do_rebid)
  3043. {
  3044.     char arg1[256];
  3045.     char arg2[256];
  3046.     two_arguments (argument, arg1, sizeof(arg1), arg2, sizeof(arg2));
  3047.  
  3048.     AuctionManager::instance().rebid (ch, strtoul(arg1, NULL, 10), strtoul(arg2, NULL, 10));
  3049. }
  3050.  
  3051. ACMD (do_bid_cancel)
  3052. {
  3053.     char arg1[256];
  3054.     char arg2[256];
  3055.     two_arguments (argument, arg1, sizeof(arg1), arg2, sizeof(arg2));
  3056.  
  3057.     AuctionManager::instance().bid_cancel (ch, strtoul(arg1, NULL, 10));
  3058. }
  3059. #endif
Advertisement
Add Comment
Please, Sign In to add comment