Advertisement
EyesOfAHawk

refresh.c

Jan 31st, 2018
322
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.71 KB | None | 0 0
  1. //===== Hercules Plugin ======================================
  2. //= @refresh NPC fix
  3. //===== By ===================================================
  4. //= Wolfie of BlackoutRO (https://blackout-ro.net)
  5. //===== Description ==========================================
  6. //= Fixes issue of client getting stuck when using the
  7. //  @refresh command.
  8. //= npc_rr_secure_timeout_timer is where this code comes from.
  9. //============================================================
  10.  
  11. #include "common/hercules.h"
  12.  
  13. #include <stdio.h>
  14. #include <string.h>
  15. #include <stdlib.h>
  16.  
  17. #include "map/atcommand.h"
  18. #include "map/clif.h"
  19. #include "map/npc.h"
  20. #include "map/pc.h"
  21.  
  22. #include "common/HPMDataCheck.h"
  23.  
  24. HPExport struct hplugin_info pinfo = {
  25.     "@refresh NPC Fix", // Plugin name
  26.     SERVER_TYPE_MAP, // Which server types this plugin works with?
  27.     "1.0", // Plugin version
  28.     HPM_VERSION, // HPM Version (don't change, macro is automatically updated)
  29. };
  30.  
  31. ACMD(refresh)
  32. {
  33.     if (sd->npc_id) {
  34.         /**
  35.          * If we still have the NPC script attached, tell it to stop.
  36.          **/
  37.         if (sd->st)
  38.             sd->st->state = END;
  39.         sd->state.menu_or_input = 0;
  40.         sd->npc_menu = 0;
  41.         clif->scriptclose(sd, sd->npc_id);
  42.         /**
  43.         * We will end the script ourselves, client will request to end it again if it have dialog,
  44.         * however it will be ignored, workaround for client stuck if NPC have no dialog. [hemagx]
  45.         **/
  46.         sd->state.dialog = 0;
  47.         npc->scriptcont(sd, sd->npc_id, true);
  48.     }
  49.  
  50.     clif->refresh(sd);
  51.     return true;
  52. }
  53.  
  54. /* Server Startup */
  55. HPExport void plugin_init(void)
  56. {
  57.     addAtcommand("refresh", refresh);
  58. }
  59.  
  60. HPExport void server_online(void)
  61. {
  62.     ShowInfo("'%s' Plugin by Wolfie/blackout-ro.net. Version '%s'\n", pinfo.name, pinfo.version);
  63. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement