summaryrefslogtreecommitdiff
path: root/src/map/mercenary.h
blob: 3245606cf1a0993695035e4f3a27c1bcfc2b4dcd (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
// Copyright (c) Hercules Dev Team, licensed under GNU GPL.
// See the LICENSE file
// Portions Copyright (c) Athena Dev Teams
#ifndef _MERCENARY_H_
#define _MERCENARY_H_

#include "status.h" // struct status_data, struct status_change
#include "unit.h" // struct unit_data

// number of cells that a mercenary can walk to from it's master before being warped
#define MAX_MER_DISTANCE 15

enum {
	ARCH_MERC_GUILD,
	SPEAR_MERC_GUILD,
	SWORD_MERC_GUILD,
};

struct s_mercenary_db {
	int class_;
	char sprite[NAME_LENGTH], name[NAME_LENGTH];
	unsigned short lv;
	short range2, range3;
	struct status_data status;
	struct view_data vd;
	struct {
		unsigned short id, lv;
	} skill[MAX_MERCSKILL];
};

struct mercenary_data {
	struct block_list bl;
	struct unit_data ud;
	struct view_data *vd;
	struct status_data base_status, battle_status;
	struct status_change sc;
	struct regen_data regen;
	struct s_mercenary_db *db;
	struct s_mercenary mercenary;
	char blockskill[MAX_SKILL];

	struct map_session_data *master;
	int contract_timer;
	
	unsigned devotion_flag : 1;
	int64 masterteleport_timer;
};

/*=====================================
* Interface : mercenary.h 
* Generated by HerculesInterfaceMaker
* created by Susu
*-------------------------------------*/
struct mercenary_interface {

	/* vars */
	
	struct s_mercenary_db db[MAX_MERCENARY_CLASS];

	/* funcs */

	void (*init) (void);
	
	bool (*class) (int class_);
	struct view_data * (*get_viewdata) (int class_);
	
	int (*create) (struct map_session_data *sd, int class_, unsigned int lifetime);
	int (*data_received) (struct s_mercenary *merc, bool flag);
	int (*save) (struct mercenary_data *md);
	
	void (*heal) (struct mercenary_data *md, int hp, int sp);
	int (*dead) (struct mercenary_data *md);
	
	int (*delete) (struct mercenary_data *md, int reply);
	void (*contract_stop) (struct mercenary_data *md);
	
	int (*get_lifetime) (struct mercenary_data *md);
	int (*get_guild) (struct mercenary_data *md);
	int (*get_faith) (struct mercenary_data *md);
	int (*set_faith) (struct mercenary_data *md, int value);
	int (*get_calls) (struct mercenary_data *md);
	int (*set_calls) (struct mercenary_data *md, int value);
	int (*kills) (struct mercenary_data *md);
	
	int (*checkskill) (struct mercenary_data *md, uint16 skill_id);
	int (*read_db) (void);
	int (*read_skilldb) (void);
	
	int (*killbonus) (struct mercenary_data *md);
	int (*search_index) (int class_);
	
	int (*contract_end_timer) (int tid, int64 tick, int id, intptr_t data);
	bool (*read_db_sub) (char* str[], int columns, int current);
	bool (*read_skill_db_sub) (char* str[], int columns, int current);
};

struct mercenary_interface *mercenary;

void mercenary_defaults(void);

#endif /* _MERCENARY_H_ */