npc.h 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. // Copyright (c) Athena Dev Teams - Licensed under GNU GPL
  2. // For more information, see LICENCE in the main folder
  3. #ifndef _NPC_H_
  4. #define _NPC_H_
  5. #include "map.h" // TBL_NPC
  6. #define START_NPC_NUM 110000000
  7. #define WARP_CLASS 45
  8. #define WARP_DEBUG_CLASS 722
  9. #define FLAG_CLASS 722
  10. #define INVISIBLE_CLASS 32767
  11. #define MAX_NPC_CLASS 1000
  12. //Checks if a given id is a valid npc id. [Skotlex]
  13. //Since new npcs are added all the time, the max valid value is the one before the first mob (Scorpion = 1001)
  14. #define npcdb_checkid(id) ((id >= 46 && id <= 125) || id == 139 || (id >= 700 && id <= MAX_NPC_CLASS) || id == INVISIBLE_CLASS)
  15. #ifdef PCRE_SUPPORT
  16. void npc_chat_finalize(struct npc_data* nd);
  17. int mob_chat_sub(struct block_list* bl, va_list ap);
  18. #endif
  19. //Script NPC events.
  20. enum {
  21. NPCE_LOGIN,
  22. NPCE_LOGOUT,
  23. NPCE_LOADMAP,
  24. NPCE_BASELVUP,
  25. NPCE_JOBLVUP,
  26. NPCE_DIE,
  27. NPCE_KILLPC,
  28. NPCE_KILLNPC,
  29. NPCE_MAX
  30. };
  31. struct view_data* npc_get_viewdata(int class_);
  32. int npc_chat_sub(struct block_list* bl, va_list ap);
  33. int npc_event_dequeue(struct map_session_data* sd);
  34. int npc_event_timer(int tid,unsigned int tick, int id, int data);
  35. int npc_event(struct map_session_data* sd, const char* eventname, int mob_kill);
  36. int npc_timer_event(const char* eventname); // Added by RoVeRT
  37. int npc_command(struct map_session_data* sd, const char* npcname, const char* command);
  38. int npc_touch_areanpc(struct map_session_data* sd, int m, int x, int y);
  39. int npc_touch_areanpc2(struct block_list* bl); // [Skotlex]
  40. int npc_check_areanpc(int flag, int m, int x, int y, int range);
  41. int npc_click(struct map_session_data* sd, struct npc_data* nd);
  42. int npc_scriptcont(struct map_session_data* sd, int id);
  43. TBL_NPC* npc_checknear(struct map_session_data* sd, struct block_list* bl);
  44. int npc_checknear2(struct map_session_data* sd, struct block_list* bl);
  45. int npc_buysellsel(struct map_session_data* sd, int id, int type);
  46. int npc_buylist(struct map_session_data* sd,int n, unsigned short* item_list);
  47. int npc_selllist(struct map_session_data* sd, int n, unsigned short* item_list);
  48. int npc_parse_mob(char* w1, char* w2, char* w3, char* w4);
  49. int npc_parse_mob2(struct spawn_data* mob, int index); // [Wizputer]
  50. int npc_parse_warp(char* w1,char* w2,char* w3,char* w4);
  51. int npc_globalmessage(const char* name,const char* mes);
  52. void npc_setcells(struct npc_data* nd);
  53. void npc_movenpc(struct npc_data* nd, int x, int y);
  54. int npc_enable(const char* name, int flag);
  55. int npc_changename(const char* name, const char* newname, short look); // [Lance]
  56. struct npc_data* npc_name2id(const char* name);
  57. int npc_get_new_npc_id(void);
  58. void npc_addsrcfile(const char* name);
  59. void npc_delsrcfile(const char* name);
  60. void npc_parsesrcfile(const char* name);
  61. int do_final_npc(void);
  62. int do_init_npc(void);
  63. int npc_event_do_oninit(void);
  64. int npc_do_ontimer(int npc_id, int option);
  65. int npc_event_doall(const char* name);
  66. int npc_event_do(const char* name);
  67. int npc_event_doall_id(const char* name, int id);
  68. int npc_timerevent_start(struct npc_data* nd, int rid);
  69. int npc_timerevent_stop(struct npc_data* nd);
  70. void npc_timerevent_quit(struct map_session_data* sd);
  71. int npc_gettimerevent_tick(struct npc_data* nd);
  72. int npc_settimerevent_tick(struct npc_data* nd, int newtimer);
  73. int npc_remove_map(struct npc_data* nd);
  74. void npc_unload_duplicates (struct npc_data* nd);
  75. int npc_unload(struct npc_data* nd);
  76. int npc_reload(void);
  77. void npc_read_event_script(void);
  78. int npc_script_event(TBL_PC* sd, int type);
  79. struct npc_data *fake_nd;
  80. #endif /* _NPC_H_ */