script.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. // Copyright (c) Athena Dev Teams - Licensed under GNU GPL
  2. // For more information, see LICENCE in the main folder
  3. #ifndef _SCRIPT_H_
  4. #define _SCRIPT_H_
  5. extern int potion_flag; //For use on Alchemist improved potions/Potion Pitcher. [Skotlex]
  6. extern int potion_hp, potion_per_hp, potion_sp, potion_per_sp;
  7. extern int potion_target;
  8. extern struct Script_Config {
  9. unsigned verbose_mode : 1;
  10. unsigned warn_func_no_comma : 1;
  11. unsigned warn_cmd_no_comma : 1;
  12. unsigned warn_func_mismatch_paramnum : 1;
  13. unsigned warn_cmd_mismatch_paramnum : 1;
  14. int check_cmdcount;
  15. int check_gotocount;
  16. unsigned event_script_type : 1;
  17. unsigned event_requires_trigger : 1;
  18. char die_event_name[NAME_LENGTH];
  19. char kill_pc_event_name[NAME_LENGTH];
  20. char kill_mob_event_name[NAME_LENGTH];
  21. char login_event_name[NAME_LENGTH];
  22. char logout_event_name[NAME_LENGTH];
  23. char loadmap_event_name[NAME_LENGTH];
  24. char baselvup_event_name[NAME_LENGTH];
  25. char joblvup_event_name[NAME_LENGTH];
  26. } script_config;
  27. struct script_data {
  28. int type;
  29. union {
  30. int num;
  31. char *str;
  32. } u;
  33. };
  34. // Moved defsp from script_state to script_stack since
  35. // it must be saved when script state is RERUNLINE. [Eoe / jA 1094]
  36. struct script_stack {
  37. int sp,sp_max,defsp;
  38. struct script_data *stack_data;
  39. };
  40. struct script_state {
  41. struct script_stack *stack;
  42. int start,end;
  43. int pos,state;
  44. int rid,oid;
  45. unsigned char *script,*new_script;
  46. int new_pos,new_defsp;
  47. };
  48. unsigned char * parse_script(unsigned char *,int);
  49. int run_script(unsigned char *,int,int,int);
  50. int set_var(struct map_session_data *sd, char *name, void *val);
  51. int conv_num(struct script_state *st,struct script_data *data);
  52. char* conv_str(struct script_state *st,struct script_data *data);
  53. void setd_sub(struct map_session_data *sd, char *varname, int elem, void *value);
  54. struct dbt* script_get_label_db(void);
  55. struct dbt* script_get_userfunc_db(void);
  56. int script_config_read(char *cfgName);
  57. void script_free_stack(struct script_stack*);
  58. int do_init_script(void);
  59. int do_final_script(void);
  60. int script_reload(void);
  61. extern char mapreg_txt[];
  62. #endif