pet.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. // Copyright (c) Athena Dev Teams - Licensed under GNU GPL
  2. // For more information, see LICENCE in the main folder
  3. #ifndef _PET_H_
  4. #define _PET_H_
  5. #define MAX_PET_DB 300
  6. #define MAX_PETLOOT_SIZE 30
  7. struct s_pet_db {
  8. short class_;
  9. char name[NAME_LENGTH],jname[NAME_LENGTH];
  10. short itemID;
  11. short EggID;
  12. short AcceID;
  13. short FoodID;
  14. int fullness;
  15. int hungry_delay;
  16. int r_hungry;
  17. int r_full;
  18. int intimate;
  19. int die;
  20. int capture;
  21. int speed;
  22. char s_perfor;
  23. int talk_convert_class;
  24. int attack_rate;
  25. int defence_attack_rate;
  26. int change_target_rate;
  27. struct script_code *equip_script;
  28. struct script_code *pet_script;
  29. };
  30. extern struct s_pet_db pet_db[MAX_PET_DB];
  31. enum { PET_CLASS,PET_CATCH,PET_EGG,PET_EQUIP,PET_FOOD };
  32. struct pet_recovery { //Stat recovery
  33. enum sc_type type; //Status Change id
  34. unsigned short delay; //How long before curing (secs).
  35. int timer;
  36. };
  37. struct pet_bonus {
  38. unsigned short type; //bStr, bVit?
  39. unsigned short val; //Qty
  40. unsigned short duration; //in secs
  41. unsigned short delay; //Time before RENEWAL_CAST (secs)
  42. int timer;
  43. };
  44. struct pet_skill_attack { //Attack Skill
  45. unsigned short id;
  46. unsigned short lv;
  47. unsigned short div_; //0 = Normal skill. >0 = Fixed damage (lv), fixed div_.
  48. unsigned short rate; //Base chance of skill ocurrance (10 = 10% of attacks)
  49. unsigned short bonusrate; //How being 100% loyal affects cast rate (10 = At 1000 intimacy->rate+10%
  50. };
  51. struct pet_skill_support { //Support Skill
  52. unsigned short id;
  53. unsigned short lv;
  54. unsigned short hp; //Max HP% for skill to trigger (50 -> 50% for Magnificat)
  55. unsigned short sp; //Max SP% for skill to trigger (100 = no check)
  56. unsigned short delay; //Time (secs) between being able to recast.
  57. int timer;
  58. };
  59. struct pet_loot {
  60. struct item *item;
  61. unsigned short count;
  62. unsigned short weight;
  63. unsigned short max;
  64. };
  65. struct pet_data {
  66. struct block_list bl;
  67. struct unit_data ud;
  68. struct view_data vd;
  69. struct s_pet pet;
  70. struct status_data status;
  71. struct mob_db *db;
  72. struct s_pet_db *petDB;
  73. int pet_hungry_timer;
  74. int target_id;
  75. struct {
  76. unsigned skillbonus : 1;
  77. } state;
  78. int move_fail_count;
  79. unsigned int next_walktime,last_thinktime;
  80. short rate_fix; //Support rate as modified by intimacy (1000 = 100%) [Skotlex]
  81. struct pet_recovery* recovery;
  82. struct pet_bonus* bonus;
  83. struct pet_skill_attack* a_skill;
  84. struct pet_skill_support* s_skill;
  85. struct pet_loot* loot;
  86. int masterteleport_timer;
  87. struct map_session_data *master;
  88. };
  89. int pet_create_egg(struct map_session_data *sd, int item_id);
  90. int pet_hungry_val(struct pet_data *pd);
  91. void pet_set_intimate(struct pet_data *pd, int value);
  92. int pet_target_check(struct map_session_data *sd,struct block_list *bl,int type);
  93. int pet_unlocktarget(struct pet_data *pd);
  94. int pet_sc_check(struct map_session_data *sd, int type); //Skotlex
  95. int search_petDB_index(int key,int type);
  96. int pet_hungry_timer_delete(struct pet_data *pd);
  97. int pet_data_init(struct map_session_data *sd, struct s_pet *pet);
  98. int pet_birth_process(struct map_session_data *sd, struct s_pet *pet);
  99. int pet_recv_petdata(int account_id,struct s_pet *p,int flag);
  100. int pet_select_egg(struct map_session_data *sd,short egg_index);
  101. int pet_catch_process1(struct map_session_data *sd,int target_class);
  102. int pet_catch_process2(struct map_session_data *sd,int target_id);
  103. int pet_get_egg(int account_id,int pet_id,int flag);
  104. int pet_menu(struct map_session_data *sd,int menunum);
  105. int pet_change_name(struct map_session_data *sd,char *name);
  106. int pet_change_name_ack(struct map_session_data *sd, char* name, int flag);
  107. int pet_equipitem(struct map_session_data *sd,int index);
  108. int pet_lootitem_drop(struct pet_data *pd,struct map_session_data *sd);
  109. int pet_attackskill(struct pet_data *pd, int target_id);
  110. int pet_skill_support_timer(int tid, unsigned int tick, int id, intptr_t data); // [Skotlex]
  111. int pet_skill_bonus_timer(int tid, unsigned int tick, int id, intptr_t data); // [Valaris]
  112. int pet_recovery_timer(int tid, unsigned int tick, int id, intptr_t data); // [Valaris]
  113. int pet_heal_timer(int tid, unsigned int tick, int id, intptr_t data); // [Valaris]
  114. #define pet_stop_walking(pd, type) unit_stop_walking(&(pd)->bl, type)
  115. #define pet_stop_attack(pd) unit_stop_attack(&(pd)->bl)
  116. int read_petdb(void);
  117. int do_init_pet(void);
  118. int do_final_pet(void);
  119. #endif /* _PET_H_ */