Guest User

cmd

a guest
Jul 12th, 2024
28
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 19.00 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include "utils.h"
  3. #include "config.h"
  4. #include "char.h"
  5. #include "locale_service.h"
  6. #include "log.h"
  7. #include "desc.h"
  8.  
  9. ACMD(do_who);
  10. ACMD(do_war);
  11. ACMD(do_user_horse_ride);
  12.  
  13. ACMD(do_drop);
  14.  
  15. ACMD(do_user_horse_back);
  16. ACMD(do_user_horse_feed);
  17. ACMD(do_slow);
  18. ACMD(do_stun);
  19. ACMD(do_warp);
  20. ACMD(do_goto);
  21. ACMD(do_item);
  22. ACMD(do_mob);
  23. ACMD(do_mob_ld);
  24. ACMD(do_mob_aggresive);
  25. ACMD(do_mob_coward);
  26. ACMD(do_mob_map);
  27. ACMD(do_purge);
  28. ACMD(do_weaken);
  29. ACMD(do_item_purge);
  30. ACMD(do_state);
  31. ACMD(do_notice);
  32. ACMD(do_map_notice);
  33. ACMD(do_big_notice);
  34. ACMD(do_user);
  35. ACMD(do_disconnect);
  36. ACMD(do_kill);
  37. ACMD(do_emotion_allow);
  38. ACMD(do_emotion);
  39. ACMD(do_transfer);
  40. ACMD(do_set);
  41. ACMD(do_cmd);
  42. ACMD(do_reset);
  43. ACMD(do_greset);
  44. ACMD(do_mount);
  45. ACMD(do_fishing);
  46. ACMD(do_refine_rod);
  47. ACMD(do_max_pick);
  48. ACMD(do_refine_pick);
  49. ACMD(do_fishing_simul);
  50. ACMD(do_console);
  51. ACMD(do_restart);
  52. ACMD(do_advance);
  53. ACMD(do_stat);
  54. ACMD(do_respawn);
  55. ACMD(do_skillup);
  56. ACMD(do_guildskillup);
  57. ACMD(do_pvp);
  58. ACMD(do_point_reset);
  59. ACMD(do_safebox_size);
  60. ACMD(do_safebox_close);
  61. ACMD(do_safebox_password);
  62. ACMD(do_safebox_change_password);
  63. ACMD(do_mall_password);
  64. ACMD(do_mall_close);
  65. ACMD(do_ungroup);
  66. ACMD(do_makeguild);
  67. ACMD(do_deleteguild);
  68. ACMD(do_shutdown);
  69. ACMD(do_group);
  70. ACMD(do_group_random);
  71. ACMD(do_invisibility);
  72. ACMD(do_event_flag);
  73. ACMD(do_get_event_flag);
  74. ACMD(do_private);
  75. ACMD(do_qf);
  76. ACMD(do_clear_quest);
  77. ACMD(do_book);
  78. ACMD(do_reload);
  79. ACMD(do_nowar);
  80. ACMD(do_setskill);
  81. ACMD(do_setskillother);
  82. ACMD(do_level);
  83. ACMD(do_polymorph);
  84. ACMD(do_polymorph_item);
  85. ACMD(do_close_shop);
  86. ACMD(do_set_walk_mode);
  87. ACMD(do_set_run_mode);
  88. ACMD(do_set_skill_group);
  89. ACMD(do_set_skill_point);
  90. ACMD(do_cooltime);
  91. ACMD(do_detaillog);
  92. ACMD(do_monsterlog);
  93. ACMD(do_gwlist);
  94. ACMD(do_stop_guild_war);
  95. ACMD(do_cancel_guild_war);
  96. ACMD(do_guild_state);
  97. ACMD(do_pkmode);
  98. ACMD(do_messenger_auth);
  99. ACMD(do_getqf);
  100. ACMD(do_setqf);
  101. ACMD(do_delqf);
  102. ACMD(do_set_state);
  103. ACMD(do_forgetme);
  104. ACMD(do_aggregate);
  105. ACMD(do_attract_ranger);
  106. ACMD(do_pull_monster);
  107. ACMD(do_setblockmode);
  108. ACMD(do_priv_empire);
  109. ACMD(do_priv_guild);
  110. ACMD(do_mount_test);
  111. ACMD(do_unmount);
  112. ACMD(do_observer);
  113. ACMD(do_observer_exit);
  114. ACMD(do_socket_item);
  115. ACMD(do_xmas);
  116. ACMD(do_stat_minus);
  117. ACMD(do_stat_reset);
  118. ACMD(do_view_equip);
  119. ACMD(do_block_chat);
  120. ACMD(do_vote_block_chat);
  121. ACMD(do_block_chat_list);
  122. ACMD(do_party_request);
  123. ACMD(do_party_request_deny);
  124. ACMD(do_party_request_accept);
  125. ACMD(do_build);
  126. ACMD(do_clear_land);
  127. ACMD(do_horse_state);
  128. ACMD(do_horse_level);
  129. ACMD(do_horse_ride);
  130. ACMD(do_horse_summon);
  131. ACMD(do_horse_unsummon);
  132. ACMD(do_horse_set_stat);
  133. ACMD(do_save_attribute_to_image);
  134. ACMD(do_affect_remove);
  135. ACMD(do_change_attr);
  136. ACMD(do_add_attr);
  137. ACMD(do_add_socket);
  138. ACMD(do_inputall)
  139. {
  140.     ch->ChatPacket(CHAT_TYPE_INFO, "[LS;409]");
  141. }
  142. ACMD(do_show_arena_list);
  143. ACMD(do_end_all_duel);
  144. ACMD(do_end_duel);
  145. ACMD(do_duel);
  146. ACMD(do_stat_plus_amount);
  147. ACMD(do_break_marriage);
  148. ACMD(do_oxevent_show_quiz);
  149. ACMD(do_oxevent_log);
  150. ACMD(do_oxevent_get_attender);
  151. ACMD(do_effect);
  152. ACMD(do_hair);
  153. ACMD(do_gift);
  154. ACMD(do_inventory);
  155. ACMD(do_cube);
  156. ACMD(do_reset_subskill );
  157. ACMD(do_flush);
  158. ACMD(do_eclipse);
  159. ACMD(do_weeklyevent);
  160. ACMD(do_event_helper);
  161. ACMD(do_in_game_mall);
  162. ACMD(do_get_mob_count);
  163. ACMD(do_dice);
  164. ACMD(do_special_item);
  165. ACMD(do_click_mall);
  166. ACMD(do_ride);
  167. ACMD(do_get_item_id_list);
  168. ACMD(do_set_socket);
  169. ACMD(do_costume);
  170. ACMD(do_set_stat);
  171. ACMD(do_can_dead);
  172. ACMD(do_full_set);
  173. ACMD(do_item_full_set);
  174. ACMD(do_attr_full_set);
  175. ACMD(do_all_skill_master);
  176. ACMD(do_use_item);
  177. ACMD(do_dragon_soul);
  178. ACMD(do_ds_list);
  179. ACMD(do_clear_affect);
  180.  
  181. struct command_info cmd_info[] =
  182. {
  183.     {"!RESERVED!", nullptr, 0, POS_DEAD, GM_IMPLEMENTOR},
  184.     {"who", do_who, 0, POS_DEAD, GM_IMPLEMENTOR},
  185.     {"war", do_war, 0, POS_DEAD, GM_PLAYER},
  186.     {"warp", do_warp, 0, POS_DEAD, GM_LOW_WIZARD},
  187.     {"user", do_user, 0, POS_DEAD, GM_HIGH_WIZARD},
  188.     {"notice", do_notice, 0, POS_DEAD, GM_HIGH_WIZARD},
  189.     {"notice_map", do_map_notice, 0, POS_DEAD, GM_LOW_WIZARD},
  190.     {"big_notice", do_big_notice, 0, POS_DEAD, GM_HIGH_WIZARD},
  191.     {"nowar", do_nowar, 0, POS_DEAD, GM_PLAYER},
  192.     {"purge", do_purge, 0, POS_DEAD, GM_WIZARD},
  193.     {"weaken", do_weaken, 0, POS_DEAD, GM_GOD},
  194.     {"dc", do_disconnect, 0, POS_DEAD, GM_LOW_WIZARD},
  195.     {"transfer", do_transfer, 0, POS_DEAD, GM_LOW_WIZARD},
  196.     {"goto", do_goto, 0, POS_DEAD, GM_LOW_WIZARD},
  197.     {"level", do_level, 0, POS_DEAD, GM_LOW_WIZARD},
  198.     {"eventflag", do_event_flag, 0, POS_DEAD, GM_HIGH_WIZARD},
  199.     {"geteventflag", do_get_event_flag, 0, POS_DEAD, GM_LOW_WIZARD},
  200.     {"item", do_item, 0, POS_DEAD, GM_GOD},
  201.     {"mob", do_mob, 0, POS_DEAD, GM_HIGH_WIZARD},
  202.     {"mob_ld", do_mob_ld, 0, POS_DEAD, GM_HIGH_WIZARD},
  203.     {"ma", do_mob_aggresive, 0, POS_DEAD, GM_HIGH_WIZARD},
  204.     {"mc", do_mob_coward, 0, POS_DEAD, GM_HIGH_WIZARD},
  205.     {"mm", do_mob_map, 0, POS_DEAD, GM_HIGH_WIZARD},
  206.     {"kill", do_kill, 0, POS_DEAD, GM_HIGH_WIZARD},
  207.     {"ipurge", do_item_purge, 0, POS_DEAD, GM_HIGH_WIZARD},
  208.     {"group", do_group, 0, POS_DEAD, GM_HIGH_WIZARD},
  209.     {"grrandom", do_group_random, 0, POS_DEAD, GM_HIGH_WIZARD},
  210.     {"set", do_set, 0, POS_DEAD, GM_IMPLEMENTOR},
  211.     {"reset", do_reset, 0, POS_DEAD, GM_HIGH_WIZARD},
  212.     {"greset", do_greset, 0, POS_DEAD, GM_HIGH_WIZARD},
  213.     {"advance", do_advance, 0, POS_DEAD, GM_GOD},
  214.     {"book", do_book, 0, POS_DEAD,  GM_IMPLEMENTOR},
  215.     {"console", do_console, 0, POS_DEAD, GM_LOW_WIZARD},
  216.     {"shutdow", do_inputall, 0, POS_DEAD, GM_HIGH_WIZARD},
  217.     {"shutdown", do_shutdown, 0, POS_DEAD, GM_HIGH_WIZARD},
  218.     {"stat", do_stat, 0, POS_DEAD, GM_PLAYER},
  219.     {"stat-", do_stat_minus, 0, POS_DEAD, GM_PLAYER},
  220.     {"stat_reset",  do_stat_reset, 0, POS_DEAD, GM_LOW_WIZARD},
  221.     {"state", do_state, 0, POS_DEAD, GM_LOW_WIZARD},
  222.     {"stun", do_stun, 0, POS_DEAD, GM_LOW_WIZARD},
  223.     {"slow", do_slow, 0, POS_DEAD, GM_LOW_WIZARD},
  224.     {"respawn", do_respawn, 0, POS_DEAD, GM_WIZARD  },
  225.     {"makeguild", do_makeguild, 0, POS_DEAD, GM_HIGH_WIZARD},
  226.     {"deleteguild", do_deleteguild, 0, POS_DEAD, GM_HIGH_WIZARD},
  227.     {"mount", do_mount, 0, POS_MOUNTING, GM_PLAYER},
  228.     {"restart_here", do_restart, SCMD_RESTART_HERE, POS_DEAD, GM_PLAYER},
  229.     {"restart_town", do_restart, SCMD_RESTART_TOWN, POS_DEAD, GM_PLAYER},
  230.     {"phase_selec", do_inputall, 0, POS_DEAD, GM_PLAYER},
  231.     {"phase_select", do_cmd, SCMD_PHASE_SELECT, POS_DEAD, GM_PLAYER},
  232.     {"qui", do_inputall, 0, POS_DEAD, GM_PLAYER},
  233.     {"quit", do_cmd, SCMD_QUIT, POS_DEAD, GM_PLAYER},
  234.     {"logou", do_inputall, 0, POS_DEAD, GM_PLAYER},
  235.     {"logout", do_cmd, SCMD_LOGOUT, POS_DEAD, GM_PLAYER},
  236.     {"skillup", do_skillup, 0, POS_DEAD, GM_PLAYER},
  237.     {"gskillup", do_guildskillup, 0, POS_DEAD, GM_PLAYER},
  238.     {"pvp", do_pvp, 0, POS_DEAD, GM_PLAYER},
  239.     {"safebox", do_safebox_size, 0, POS_DEAD, GM_HIGH_WIZARD},
  240.     {"safebox_close", do_safebox_close, 0, POS_DEAD, GM_PLAYER},
  241.     {"safebox_passwor",do_inputall, 0, POS_DEAD, GM_PLAYER},
  242.     {"safebox_password",do_safebox_password, 0, POS_DEAD, GM_PLAYER},
  243.     {"safebox_change_passwor", do_inputall, 0, POS_DEAD, GM_PLAYER},
  244.     {"safebox_change_password", do_safebox_change_password, 0, POS_DEAD, GM_PLAYER},
  245.     {"mall_passwor", do_inputall, 0, POS_DEAD, GM_PLAYER},
  246.     {"mall_password", do_mall_password, 0, POS_DEAD, GM_PLAYER},
  247.     {"mall_close", do_mall_close, 0, POS_DEAD, GM_PLAYER},
  248.     {"ungroup", do_ungroup, 0, POS_DEAD, GM_PLAYER},
  249.     {"refine_rod", do_refine_rod, 0, POS_DEAD, GM_IMPLEMENTOR},
  250.     {"refine_pick", do_refine_pick, 0, POS_DEAD, GM_IMPLEMENTOR},
  251.     {"max_pick", do_max_pick, 0, POS_DEAD, GM_IMPLEMENTOR},
  252.     {"fish_simul", do_fishing_simul, 0, POS_DEAD, GM_IMPLEMENTOR},
  253.     {"invisible", do_invisibility, 0, POS_DEAD, GM_LOW_WIZARD},
  254.     {"qf", do_qf, 0, POS_DEAD, GM_IMPLEMENTOR},
  255.     {"clear_quest", do_clear_quest, 0, POS_DEAD, GM_HIGH_WIZARD},
  256.     {"close_shop",  do_close_shop, 0, POS_DEAD, GM_PLAYER},
  257.     {"set_walk_mode", do_set_walk_mode, 0, POS_DEAD, GM_PLAYER},
  258.     {"set_run_mode", do_set_run_mode, 0, POS_DEAD, GM_PLAYER},
  259.     {"setjob",do_set_skill_group, 0, POS_DEAD, GM_IMPLEMENTOR},
  260.     {"setskill", do_setskill, 0, POS_DEAD, GM_LOW_WIZARD},
  261.     {"setskillother", do_setskillother, 0, POS_DEAD, GM_HIGH_WIZARD},
  262.     {"setskillpoint", do_set_skill_point, 0, POS_DEAD, GM_IMPLEMENTOR},
  263.     {"reload", do_reload, 0, POS_DEAD, GM_IMPLEMENTOR},
  264.     {"cooltime", do_cooltime, 0, POS_DEAD, GM_HIGH_WIZARD},
  265.     {"gwlist", do_gwlist, 0, POS_DEAD, GM_LOW_WIZARD},
  266.     {"gwstop", do_stop_guild_war, 0, POS_DEAD, GM_LOW_WIZARD},
  267.     {"gwcancel", do_cancel_guild_war, 0, POS_DEAD, GM_LOW_WIZARD},
  268.     {"gstate", do_guild_state, 0, POS_DEAD, GM_LOW_WIZARD},
  269.     {"pkmode", do_pkmode, 0, POS_DEAD, GM_PLAYER},
  270.     {"messenger_auth", do_messenger_auth, 0, POS_DEAD, GM_PLAYER},
  271.     {"getqf", do_getqf, 0, POS_DEAD, GM_LOW_WIZARD},
  272.     {"setqf", do_setqf, 0, POS_DEAD, GM_LOW_WIZARD},
  273.     {"delqf", do_delqf, 0, POS_DEAD, GM_LOW_WIZARD},
  274.     {"set_state", do_set_state, 0, POS_DEAD, GM_LOW_WIZARD},
  275.     {"detaillog", do_detaillog, 0, POS_DEAD, GM_LOW_WIZARD},
  276.     {"monsterlog", do_monsterlog, 0, POS_DEAD, GM_LOW_WIZARD},
  277.     {"forgetme", do_forgetme, 0, POS_DEAD, GM_LOW_WIZARD},
  278.     {"aggregate", do_aggregate, 0, POS_DEAD, GM_LOW_WIZARD},
  279.     {"attract_ranger", do_attract_ranger, 0, POS_DEAD, GM_LOW_WIZARD},
  280.     {"pull_monster", do_pull_monster, 0, POS_DEAD, GM_LOW_WIZARD},
  281.     {"setblockmode", do_setblockmode, 0, POS_DEAD, GM_PLAYER},
  282.     {"polymorph", do_polymorph, 0, POS_DEAD, GM_LOW_WIZARD},
  283.     {"polyitem", do_polymorph_item, 0, POS_DEAD, GM_HIGH_WIZARD},
  284.     {"priv_empire", do_priv_empire, 0, POS_DEAD, GM_HIGH_WIZARD},
  285.     {"priv_guild", do_priv_guild, 0, POS_DEAD, GM_HIGH_WIZARD},
  286.     {"mount_test", do_mount_test, 0, POS_DEAD, GM_IMPLEMENTOR},
  287.     {"unmount", do_unmount, 0, POS_DEAD, GM_PLAYER},
  288.     {"private", do_private, 0, POS_DEAD, GM_IMPLEMENTOR},
  289.     {"party_request", do_party_request, 0, POS_DEAD, GM_PLAYER},
  290.     {"party_request_accept", do_party_request_accept,0, POS_DEAD, GM_PLAYER},
  291.     {"party_request_deny", do_party_request_deny, 0, POS_DEAD, GM_PLAYER},
  292.     {"observer", do_observer, 0, POS_DEAD, GM_IMPLEMENTOR},
  293.     {"observer_exit", do_observer_exit, 0, POS_DEAD, GM_PLAYER},
  294.     {"socketitem", do_socket_item, 0, POS_DEAD, GM_IMPLEMENTOR},
  295.     {"saveati", do_save_attribute_to_image, 0, POS_DEAD, GM_IMPLEMENTOR},
  296.     {"xmas_boom", do_xmas, SCMD_XMAS_BOOM, POS_DEAD, GM_HIGH_WIZARD},
  297.     {"xmas_snow", do_xmas, SCMD_XMAS_SNOW, POS_DEAD, GM_HIGH_WIZARD},
  298.     {"xmas_santa", do_xmas, SCMD_XMAS_SANTA, POS_DEAD, GM_HIGH_WIZARD},
  299.     {"view_equip", do_view_equip, 0, POS_DEAD, GM_PLAYER},
  300.     {"jy", do_block_chat, 0, POS_DEAD, GM_HIGH_WIZARD},
  301.     {"vote_block_chat", do_vote_block_chat, 0, POS_DEAD, GM_PLAYER},
  302.     {"block_chat", do_block_chat, 0, POS_DEAD, GM_PLAYER},
  303.     {"block_chat_list", do_block_chat_list, 0, POS_DEAD, GM_PLAYER},
  304.     {"build", do_build, 0, POS_DEAD, GM_PLAYER},
  305.     {"clear_land", do_clear_land, 0, POS_DEAD, GM_HIGH_WIZARD},
  306.     {"affect_remove", do_affect_remove, 0, POS_DEAD, GM_LOW_WIZARD},
  307.     {"horse_state", do_horse_state, 0, POS_DEAD, GM_HIGH_WIZARD},
  308.     {"horse_level", do_horse_level, 0, POS_DEAD, GM_HIGH_WIZARD},
  309.     {"horse_ride", do_horse_ride, 0, POS_DEAD, GM_HIGH_WIZARD},
  310.     {"horse_summon", do_horse_summon, 0, POS_DEAD, GM_HIGH_WIZARD},
  311.     {"horse_unsummon", do_horse_unsummon, 0, POS_DEAD, GM_HIGH_WIZARD},
  312.     {"horse_set_stat", do_horse_set_stat, 0, POS_DEAD, GM_HIGH_WIZARD},
  313.     {"emotion_allow", do_emotion_allow, 0, POS_FIGHTING, GM_PLAYER},
  314.     {"kiss", do_emotion, 0, POS_FIGHTING, GM_PLAYER},
  315.     {"slap", do_emotion, 0, POS_FIGHTING, GM_PLAYER},
  316.     {"french_kiss", do_emotion, 0, POS_FIGHTING, GM_PLAYER},
  317.     {"clap", do_emotion, 0, POS_FIGHTING, GM_PLAYER},
  318.     {"cheer1", do_emotion, 0, POS_FIGHTING, GM_PLAYER},
  319.     {"cheer2", do_emotion, 0, POS_FIGHTING, GM_PLAYER},
  320.     {"dance1", do_emotion, 0, POS_FIGHTING, GM_PLAYER},
  321.     {"dance2", do_emotion, 0, POS_FIGHTING, GM_PLAYER},
  322.     {"dance3", do_emotion, 0, POS_FIGHTING, GM_PLAYER},
  323.     {"dance4", do_emotion, 0, POS_FIGHTING, GM_PLAYER},
  324.     {"dance5", do_emotion, 0, POS_FIGHTING, GM_PLAYER},
  325.     {"dance6", do_emotion, 0, POS_FIGHTING, GM_PLAYER},
  326.     {"congratulation", do_emotion, 0, POS_FIGHTING, GM_PLAYER},
  327.     {"forgive", do_emotion, 0, POS_FIGHTING, GM_PLAYER},
  328.     {"angry", do_emotion, 0, POS_FIGHTING, GM_PLAYER},
  329.     {"attractive", do_emotion, 0, POS_FIGHTING, GM_PLAYER},
  330.     {"sad", do_emotion, 0, POS_FIGHTING, GM_PLAYER},
  331.     {"shy", do_emotion, 0, POS_FIGHTING, GM_PLAYER},
  332.     {"cheerup", do_emotion, 0, POS_FIGHTING, GM_PLAYER},
  333.     {"banter", do_emotion, 0, POS_FIGHTING, GM_PLAYER},
  334.     {"joy", do_emotion, 0, POS_FIGHTING, GM_PLAYER},
  335.     {"change_attr", do_change_attr, 0, POS_DEAD, GM_IMPLEMENTOR},
  336.     {"add_attr", do_add_attr, 0, POS_DEAD, GM_IMPLEMENTOR},
  337.     {"add_socket", do_add_socket, 0, POS_DEAD, GM_IMPLEMENTOR},
  338.     {"user_horse_ride", do_user_horse_ride, 0, POS_FISHING, GM_PLAYER},
  339.  
  340.     {"drop", do_drop, 0, POS_DEAD, GM_IMPLEMENTOR},
  341.  
  342.     {"user_horse_back", do_user_horse_back, 0, POS_FISHING, GM_PLAYER},
  343.     {"user_horse_feed", do_user_horse_feed, 0, POS_FISHING, GM_PLAYER},
  344.     {"show_arena_list", do_show_arena_list, 0, POS_DEAD, GM_LOW_WIZARD},
  345.     {"end_all_duel", do_end_all_duel, 0, POS_DEAD, GM_LOW_WIZARD},
  346.     {"end_duel", do_end_duel, 0, POS_DEAD, GM_LOW_WIZARD},
  347.     {"duel", do_duel, 0, POS_DEAD, GM_LOW_WIZARD},
  348.     {"con+", do_stat_plus_amount, POINT_HT, POS_DEAD, GM_LOW_WIZARD},
  349.     {"int+", do_stat_plus_amount, POINT_IQ, POS_DEAD, GM_LOW_WIZARD},
  350.     {"str+", do_stat_plus_amount, POINT_ST, POS_DEAD, GM_LOW_WIZARD},
  351.     {"dex+", do_stat_plus_amount, POINT_DX, POS_DEAD, GM_LOW_WIZARD},
  352.     {"break_marriage", do_break_marriage, 0, POS_DEAD, GM_LOW_WIZARD},
  353.     {"show_quiz", do_oxevent_show_quiz, 0, POS_DEAD, GM_LOW_WIZARD},
  354.     {"log_oxevent", do_oxevent_log, 0, POS_DEAD, GM_LOW_WIZARD},
  355.     {"get_oxevent_att", do_oxevent_get_attender, 0, POS_DEAD, GM_LOW_WIZARD},
  356.     {"effect", do_effect, 0, POS_DEAD, GM_LOW_WIZARD},
  357.     {"hair", do_hair, 0, POS_DEAD, GM_PLAYER},
  358.     {"inventory", do_inventory, 0, POS_DEAD, GM_LOW_WIZARD},
  359.     {"cube", do_cube, 0, POS_DEAD, GM_PLAYER},
  360.     {"reset_subskill", do_reset_subskill, 0, POS_DEAD, GM_HIGH_WIZARD},
  361.     {"flush", do_flush, 0, POS_DEAD, GM_IMPLEMENTOR},
  362.     {"gift", do_gift, 0, POS_DEAD, GM_PLAYER},
  363.     {"eclipse", do_eclipse, 0, POS_DEAD, GM_HIGH_WIZARD},
  364.     {"weeklyevent", do_weeklyevent, 0, POS_DEAD, GM_LOW_WIZARD},
  365.     {"eventhelper", do_event_helper, 0, POS_DEAD, GM_HIGH_WIZARD},
  366.     {"in_game_mall", do_in_game_mall, 0, POS_DEAD, GM_PLAYER},
  367.     {"get_mob_count", do_get_mob_count, 0, POS_DEAD, GM_LOW_WIZARD},
  368.     {"dice", do_dice, 0, POS_DEAD, GM_PLAYER},
  369.     {"special_item", do_special_item, 0, POS_DEAD, GM_IMPLEMENTOR},
  370.     {"click_mall", do_click_mall, 0, POS_DEAD, GM_PLAYER},
  371.     {"ride", do_ride, 0, POS_DEAD, GM_PLAYER},
  372.     {"item_id_list", do_get_item_id_list, 0, POS_DEAD, GM_LOW_WIZARD},
  373.     {"set_socket", do_set_socket, 0, POS_DEAD, GM_LOW_WIZARD},
  374.     {"costume", do_costume, 0, POS_DEAD, GM_PLAYER},
  375.     {"tcon", do_set_stat, POINT_HT, POS_DEAD, GM_LOW_WIZARD},
  376.     {"tint", do_set_stat, POINT_IQ, POS_DEAD, GM_LOW_WIZARD},
  377.     {"tstr", do_set_stat, POINT_ST, POS_DEAD, GM_LOW_WIZARD},
  378.     {"tdex", do_set_stat, POINT_DX, POS_DEAD, GM_LOW_WIZARD},
  379.     {"cannot_dead", do_can_dead, 1, POS_DEAD, GM_LOW_WIZARD},
  380.     {"can_dead", do_can_dead, 0, POS_DEAD, GM_LOW_WIZARD},
  381.     {"full_set", do_full_set, 0, POS_DEAD, GM_LOW_WIZARD},
  382.     {"item_full_set", do_item_full_set, 0, POS_DEAD, GM_LOW_WIZARD},
  383.     {"attr_full_set", do_attr_full_set, 0, POS_DEAD, GM_LOW_WIZARD},
  384.     {"all_skill_master", do_all_skill_master, 0, POS_DEAD, GM_LOW_WIZARD},
  385.     {"use_item", do_use_item, 0, POS_DEAD, GM_LOW_WIZARD},
  386.     {"dragon_soul", do_dragon_soul, 0, POS_DEAD, GM_PLAYER},
  387.     {"ds_list", do_ds_list, 0, POS_DEAD, GM_PLAYER},
  388.     {"do_clear_affect", do_clear_affect, 0, POS_DEAD, GM_LOW_WIZARD},
  389.     {"\n", nullptr, 0, POS_DEAD, GM_IMPLEMENTOR}
  390. };
  391.  
  392. void interpreter_set_privilege(const char *cmd, int lvl)
  393. {
  394.     int i;
  395.  
  396.     for (i = 0; *cmd_info[i].command != '\n'; ++i)
  397.     {
  398.         if (!str_cmp(cmd, cmd_info[i].command))
  399.         {
  400.             cmd_info[i].gm_level = lvl;
  401.             sys_log(0, "Setting command privilege: %s -> %d", cmd, lvl);
  402.             break;
  403.         }
  404.     }
  405. }
  406.  
  407. void double_dollar(const char *src, size_t src_len, char *dest, size_t dest_len)
  408. {      
  409.     const char * tmp = src;
  410.     size_t cur_len = 0;
  411.  
  412.     // \0 넣을 자리 확보
  413.     dest_len -= 1;
  414.  
  415.     while (src_len-- && *tmp)
  416.     {
  417.         if (*tmp == '$')
  418.         {
  419.             if (cur_len + 1 >= dest_len)
  420.                 break;
  421.  
  422.             *(dest++) = '$';
  423.             *(dest++) = *(tmp++);
  424.             cur_len += 2;
  425.         }
  426.         else
  427.         {
  428.             if (cur_len >= dest_len)
  429.                 break;
  430.  
  431.             *(dest++) = *(tmp++);
  432.             cur_len += 1;
  433.         }
  434.     }
  435.  
  436.     *dest = '\0';
  437. }
  438.  
  439. void interpret_command(LPCHARACTER ch, const char * argument, size_t len)
  440. {
  441.     if (NULL == ch)
  442.     {
  443.         sys_err ("NULL CHRACTER");
  444.         return ;
  445.     }
  446.  
  447.     char cmd[128 + 1];  // buffer overflow 문제가 생기지 않도록 일부러 길이를 짧게 잡음
  448.     char new_line[256 + 1];
  449.     const char * line;
  450.     int icmd;
  451.  
  452.     if (len == 0 || !*argument)
  453.         return;
  454.  
  455.     double_dollar(argument, len, new_line, sizeof(new_line));
  456.  
  457.     size_t cmdlen;
  458.     line = first_cmd(new_line, cmd, sizeof(cmd), &cmdlen);
  459.  
  460.     for (icmd = 1; *cmd_info[icmd].command != '\n'; ++icmd)
  461.     {
  462.         if (cmd_info[icmd].command_pointer == do_cmd)
  463.         {
  464.             if (!strcmp(cmd_info[icmd].command, cmd)) // do_cmd는 모든 명령어를 쳐야 할 수 있다.
  465.                 break;
  466.         }
  467.         else if (!strncmp(cmd_info[icmd].command, cmd, cmdlen))
  468.             break;
  469.     }
  470.  
  471.     if (ch->GetPosition() < cmd_info[icmd].minimum_position)
  472.     {
  473.         switch (ch->GetPosition())
  474.         {
  475.             case POS_MOUNTING:
  476.                 ch->ChatPacket(CHAT_TYPE_INFO, "[LS;411]");
  477.                 break;
  478.  
  479.             case POS_DEAD:
  480.                 ch->ChatPacket(CHAT_TYPE_INFO, "[LS;412]");
  481.                 break;
  482.  
  483.             case POS_SLEEPING:
  484.                 ch->ChatPacket(CHAT_TYPE_INFO, "[LS;413]");
  485.                 break;
  486.  
  487.             case POS_RESTING:
  488.             case POS_SITTING:
  489.                 ch->ChatPacket(CHAT_TYPE_INFO, "[LS;414]");
  490.                 break;
  491.  
  492.             default:
  493.                 sys_err("unknown position %d", ch->GetPosition());
  494.                 break;
  495.         }
  496.  
  497.         return;
  498.     }
  499.  
  500.     if (*cmd_info[icmd].command == '\n')
  501.     {  
  502.         ch->ChatPacket(CHAT_TYPE_INFO, "[LS;410]");
  503.         return;
  504.     }
  505.  
  506.     if (cmd_info[icmd].gm_level && cmd_info[icmd].gm_level > ch->GetGMLevel())
  507.     {
  508.         ch->ChatPacket(CHAT_TYPE_INFO, "[LS;410]");
  509.         return;
  510.     }
  511.  
  512.     if (strncmp("phase", cmd_info[icmd].command, 5) != 0) // 히든 명령어 처리
  513.         sys_log(0, "COMMAND: %s: %s", ch->GetName(), cmd_info[icmd].command);
  514.  
  515.     ((*cmd_info[icmd].command_pointer) (ch, line, icmd, cmd_info[icmd].subcmd));
  516.  
  517.     if (ch->GetGMLevel() >= GM_LOW_WIZARD)
  518.     {
  519.         if (cmd_info[icmd].gm_level >= GM_LOW_WIZARD)
  520.         {
  521.             if (LC_IsEurope() == true || /*LC_IsNewCIBN() == true || */LC_IsCanada() == true || LC_IsBrazil() == true || LC_IsSingapore() == true )
  522.             {
  523.                 char buf[1024];
  524.                 snprintf( buf, sizeof(buf), "%s", argument );
  525.  
  526.                 LogManager::instance().GMCommandLog(ch->GetPlayerID(), ch->GetName(), ch->GetDesc()->GetHostName(), g_bChannel, buf);
  527.             }
  528.         }
  529.     }
  530. }
  531.  
  532. std::vector<std::string> ParseArguments(std::string arguments) {
  533.     std::vector<std::string> args;
  534.  
  535.     boost::escaped_list_separator<char> seps("", " ", "\"\'");
  536.     boost::tokenizer<boost::escaped_list_separator<char>> tokens(arguments,
  537.                                                                  seps);
  538.     for (const auto& token : tokens)
  539.         args.emplace_back(token);
  540.  
  541.     // Erase first argument (empty).
  542.     if (args.size() > 0)
  543.         args.erase(args.begin());
  544.  
  545.     return std::move(args);
  546. }
Advertisement
Add Comment
Please, Sign In to add comment