diff options
Diffstat (limited to 'src/map/pet.h')
-rw-r--r-- | src/map/pet.h | 109 |
1 files changed, 67 insertions, 42 deletions
diff --git a/src/map/pet.h b/src/map/pet.h index b46f55229..5c890ef85 100644 --- a/src/map/pet.h +++ b/src/map/pet.h @@ -1,11 +1,18 @@ -// Copyright (c) Athena Dev Teams - Licensed under GNU GPL -// For more information, see LICENCE in the main folder +// Copyright (c) Hercules Dev Team, licensed under GNU GPL. +// See the LICENSE file +// Portions Copyright (c) Athena Dev Teams -#ifndef _PET_H_ -#define _PET_H_ +#ifndef MAP_PET_H +#define MAP_PET_H -#define MAX_PET_DB 300 -#define MAX_PETLOOT_SIZE 30 +#include "map.h" // struct block_list +#include "status.h" // enum sc_type +#include "unit.h" // struct unit_data +#include "../common/cbasetypes.h" +#include "../common/mmo.h" // NAME_LENGTH, struct s_pet + +#define MAX_PET_DB 300 +#define MAX_PETLOOT_SIZE 30 struct s_pet_db { short class_; @@ -30,7 +37,6 @@ struct s_pet_db { struct script_code *equip_script; struct script_code *pet_script; }; -extern struct s_pet_db pet_db[MAX_PET_DB]; enum { PET_CLASS,PET_CATCH,PET_EGG,PET_EQUIP,PET_FOOD }; @@ -86,7 +92,7 @@ struct pet_data { unsigned skillbonus : 1; } state; int move_fail_count; - unsigned int next_walktime,last_thinktime; + int64 next_walktime, last_thinktime; short rate_fix; //Support rate as modified by intimacy (1000 = 100%) [Skotlex] struct pet_recovery* recovery; @@ -98,39 +104,58 @@ struct pet_data { struct map_session_data *msd; }; +#define pet_stop_walking(pd, type) (unit->stop_walking(&(pd)->bl, (type))) +#define pet_stop_attack(pd) (unit->stop_attack(&(pd)->bl)) + +struct pet_interface { + struct s_pet_db db[MAX_PET_DB]; + struct eri *item_drop_ers; //For loot drops delay structures. + struct eri *item_drop_list_ers; + /* */ + int (*init) (bool minimal); + int (*final) (void); + /* */ + int (*hungry_val) (struct pet_data *pd); + void (*set_intimate) (struct pet_data *pd, int value); + int (*create_egg) (struct map_session_data *sd, int item_id); + int (*unlocktarget) (struct pet_data *pd); + int (*attackskill) (struct pet_data *pd, int target_id); + int (*target_check) (struct map_session_data *sd, struct block_list *bl, int type); + int (*sc_check) (struct map_session_data *sd, int type); + int (*hungry) (int tid, int64 tick, int id, intptr_t data); + int (*search_petDB_index) (int key, int type); + int (*hungry_timer_delete) (struct pet_data *pd); + int (*performance) (struct map_session_data *sd, struct pet_data *pd); + int (*return_egg) (struct map_session_data *sd, struct pet_data *pd); + int (*data_init) (struct map_session_data *sd, struct s_pet *petinfo); + int (*birth_process) (struct map_session_data *sd, struct s_pet *petinfo); + int (*recv_petdata) (int account_id, struct s_pet *p, int flag); + int (*select_egg) (struct map_session_data *sd, short egg_index); + int (*catch_process1) (struct map_session_data *sd, int target_class); + int (*catch_process2) (struct map_session_data *sd, int target_id); + bool (*get_egg) (int account_id, short pet_class, int pet_id ); + int (*unequipitem) (struct map_session_data *sd, struct pet_data *pd); + int (*food) (struct map_session_data *sd, struct pet_data *pd); + int (*ai_sub_hard_lootsearch) (struct block_list *bl, va_list ap); + int (*menu) (struct map_session_data *sd, int menunum); + int (*change_name) (struct map_session_data *sd, char *name); + int (*change_name_ack) (struct map_session_data *sd, char *name, int flag); + int (*equipitem) (struct map_session_data *sd, int index); + int (*randomwalk) (struct pet_data *pd, int64 tick); + int (*ai_sub_hard) (struct pet_data *pd, struct map_session_data *sd, int64 tick); + int (*ai_sub_foreachclient) (struct map_session_data *sd, va_list ap); + int (*ai_hard) (int tid, int64 tick, int id, intptr_t data); + int (*delay_item_drop) (int tid, int64 tick, int id, intptr_t data); + int (*lootitem_drop) (struct pet_data *pd, struct map_session_data *sd); + int (*skill_bonus_timer) (int tid, int64 tick, int id, intptr_t data); + int (*recovery_timer) (int tid, int64 tick, int id, intptr_t data); + int (*heal_timer) (int tid, int64 tick, int id, intptr_t data); + int (*skill_support_timer) (int tid, int64 tick, int id, intptr_t data); + int (*read_db) (); +}; + +struct pet_interface *pet; +void pet_defaults(void); -int pet_create_egg(struct map_session_data *sd, int item_id); -int pet_hungry_val(struct pet_data *pd); -void pet_set_intimate(struct pet_data *pd, int value); -int pet_target_check(struct map_session_data *sd,struct block_list *bl,int type); -int pet_unlocktarget(struct pet_data *pd); -int pet_sc_check(struct map_session_data *sd, int type); //Skotlex -int search_petDB_index(int key,int type); -int pet_hungry_timer_delete(struct pet_data *pd); -int pet_data_init(struct map_session_data *sd, struct s_pet *pet); -int pet_birth_process(struct map_session_data *sd, struct s_pet *pet); -int pet_recv_petdata(int account_id,struct s_pet *p,int flag); -int pet_select_egg(struct map_session_data *sd,short egg_index); -int pet_catch_process1(struct map_session_data *sd,int target_class); -int pet_catch_process2(struct map_session_data *sd,int target_id); -int pet_get_egg(int account_id,int pet_id,int flag); -int pet_menu(struct map_session_data *sd,int menunum); -int pet_change_name(struct map_session_data *sd,char *name); -int pet_change_name_ack(struct map_session_data *sd, char* name, int flag); -int pet_equipitem(struct map_session_data *sd,int index); -int pet_lootitem_drop(struct pet_data *pd,struct map_session_data *sd); -int pet_attackskill(struct pet_data *pd, int target_id); -int pet_skill_support_timer(int tid, unsigned int tick, int id, intptr_t data); // [Skotlex] -int pet_skill_bonus_timer(int tid, unsigned int tick, int id, intptr_t data); // [Valaris] -int pet_recovery_timer(int tid, unsigned int tick, int id, intptr_t data); // [Valaris] -int pet_heal_timer(int tid, unsigned int tick, int id, intptr_t data); // [Valaris] - -#define pet_stop_walking(pd, type) unit_stop_walking(&(pd)->bl, type) -#define pet_stop_attack(pd) unit_stop_attack(&(pd)->bl) - -int read_petdb(void); -int do_init_pet(void); -int do_final_pet(void); - -#endif /* _PET_H_ */ +#endif /* MAP_PET_H */ |