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