npc.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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"
  6. struct block_list;
  7. struct npc_data;
  8. struct view_data;
  9. #define START_NPC_NUM 110000000
  10. #define WARP_CLASS 45
  11. #define WARP_DEBUG_CLASS 722
  12. #define FLAG_CLASS 722
  13. #define INVISIBLE_CLASS 32767
  14. #define MAX_NPC_CLASS 1000
  15. //Checks if a given id is a valid npc id. [Skotlex]
  16. //Since new npcs are added all the time, the max valid value is the one before the first mob (Scorpion = 1001)
  17. #define npcdb_checkid(id) ((id >= 46 && id <= 125) || id == 139 || (id >= 700 && id <= MAX_NPC_CLASS) || id == INVISIBLE_CLASS)
  18. #ifdef PCRE_SUPPORT
  19. void npc_chat_finalize(struct npc_data* nd);
  20. int mob_chat_sub(struct block_list* bl, va_list ap);
  21. #endif
  22. //Script NPC events.
  23. enum {
  24. NPCE_LOGIN,
  25. NPCE_LOGOUT,
  26. NPCE_LOADMAP,
  27. NPCE_BASELVUP,
  28. NPCE_JOBLVUP,
  29. NPCE_DIE,
  30. NPCE_KILLPC,
  31. NPCE_KILLNPC,
  32. NPCE_MAX
  33. };
  34. struct view_data* npc_get_viewdata(int class_);
  35. int npc_chat_sub(struct block_list* bl, va_list ap);
  36. int npc_event_dequeue(struct map_session_data* sd);
  37. int npc_event(struct map_session_data* sd, const char* eventname, int mob_kill);
  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. struct npc_data* 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_mob2(struct spawn_data* mob, int index); // [Wizputer]
  49. const char* npc_parse_warp(char* w1, char* w2, char* w3, char* w4, const char* start, const char* buffer, const char* filepath);
  50. int npc_globalmessage(const char* name,const char* mes);
  51. void npc_setcells(struct npc_data* nd);
  52. void npc_movenpc(struct npc_data* nd, int x, int y);
  53. int npc_enable(const char* name, int flag);
  54. int npc_changename(const char* name, const char* newname, short look); // [Lance]
  55. struct npc_data* npc_name2id(const char* name);
  56. int npc_get_new_npc_id(void);
  57. void npc_addsrcfile(const char* name);
  58. void npc_delsrcfile(const char* name);
  59. void npc_parsesrcfile(const char* filepath);
  60. int do_final_npc(void);
  61. int do_init_npc(void);
  62. void npc_event_do_oninit(void);
  63. int npc_do_ontimer(int npc_id, int option);
  64. int npc_event_doall(const char* name);
  65. int npc_event_do(const char* name);
  66. int npc_event_doall_id(const char* name, int id);
  67. int npc_timerevent_start(struct npc_data* nd, int rid);
  68. int npc_timerevent_stop(struct npc_data* nd);
  69. void npc_timerevent_quit(struct map_session_data* sd);
  70. int npc_gettimerevent_tick(struct npc_data* nd);
  71. int npc_settimerevent_tick(struct npc_data* nd, int newtimer);
  72. int npc_remove_map(struct npc_data* nd);
  73. void npc_unload_duplicates (struct npc_data* nd);
  74. int npc_unload(struct npc_data* nd);
  75. int npc_reload(void);
  76. void npc_read_event_script(void);
  77. int npc_script_event(struct map_session_data* sd, int type);
  78. struct npc_data *fake_nd;
  79. #endif /* _NPC_H_ */