summaryrefslogtreecommitdiff
path: root/src/map/pet.h
blob: 3ac849111bd5c2895360d600f3aac043deb1c78a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
// For more information, see LICENCE in the main folder

#ifndef _PET_H_
#define _PET_H_

#define MAX_PET_DB  300
#define MAX_PETLOOT_SIZE    30

struct s_pet_db {
    short class_;
    char name[NAME_LENGTH],jname[NAME_LENGTH];
    short itemID;
    short EggID;
    short AcceID;
    short FoodID;
    int fullness;
    int hungry_delay;
    int r_hungry;
    int r_full;
    int intimate;
    int die;
    int capture;
    int speed;
    char s_perfor;
    int talk_convert_class;
    int attack_rate;
    int defence_attack_rate;
    int change_target_rate;
    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 };

struct pet_recovery { //Stat recovery
    enum sc_type type;  //Status Change id
    unsigned short delay; //How long before curing (secs).
    int timer;
};

struct pet_bonus {
    unsigned short type; //bStr, bVit?
    unsigned short val; //Qty
    unsigned short duration; //in secs
    unsigned short delay;   //Time before RENEWAL_CAST (secs)
    int timer;
};

struct pet_skill_attack { //Attack Skill
    unsigned short id;
    unsigned short lv;
    unsigned short div_; //0 = Normal skill. >0 = Fixed damage (lv), fixed div_.
    unsigned short rate; //Base chance of skill ocurrance (10 = 10% of attacks)
    unsigned short bonusrate; //How being 100% loyal affects cast rate (10 = At 1000 intimacy->rate+10%
};

struct pet_skill_support { //Support Skill
    unsigned short id;
    unsigned short lv;
    unsigned short hp; //Max HP% for skill to trigger (50 -> 50% for Magnificat)
    unsigned short sp; //Max SP% for skill to trigger (100 = no check)
    unsigned short delay; //Time (secs) between being able to recast.
    int timer;
};

struct pet_loot {
    struct item *item;
    unsigned short count;
    unsigned short weight;
    unsigned short max;
};

struct pet_data {
    struct block_list bl;
    struct unit_data ud;
    struct view_data vd;
    struct s_pet pet;
    struct status_data status;
    struct mob_db *db;
    struct s_pet_db *petDB;
    int pet_hungry_timer;
    int target_id;
    struct {
        unsigned skillbonus : 1;
    } state;
    int move_fail_count;
    unsigned int next_walktime,last_thinktime;
    short rate_fix; //Support rate as modified by intimacy (1000 = 100%) [Skotlex]

    struct pet_recovery *recovery;
    struct pet_bonus *bonus;
    struct pet_skill_attack *a_skill;
    struct pet_skill_support *s_skill;
    struct pet_loot *loot;

    struct map_session_data *msd;
};



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_ */