rathena/src/map/mercenary.h
Cydh Ramdh 9d3d34205f Skill DB clean ups
* Changed skill_db array to better memory allocation.
* Reduced MAX_SKILL_LEVEL from 100 to 10 (part of Hercules 0f4a50d135), also has changes on skill_get checks for skill level that more than 10.
* Reduced MAX_SKILL from 5020 to 1200 (actually only 1109 skills are used).
* Added macros for checking Homunculus, Guild, Mercenary, & Elemental skill ranges.
* Added skill check & index validation when player logged in and when @reloadskilldb.
* Corrected `enum e_skill_flag` order for SKILL_FLAG_REPLACED_LV_0's sake.
* Merged 'addtoskill' script command just as alias of 'skill' script command.
* Fixed #277
* Changed 'skill' script command flag to constant value

Signed-off-by: Cydh Ramdh <house.bad@gmail.com>

NOTE:
* Decreased memory usage by map-server reduced up to 50 MB.
* Decreased memory for each player because of mmo_charstatus::skill[] only has 1200 array, before is 5020.
* Please use skill_get_index() for accessing sd->status.skill[] or skill_db[], don't reckless use skill_id as array index.
* Please import upgrade_20150211_skillset.sql

Signed-off-by: Cydh Ramdh <house.bad@gmail.com>
2015-02-12 15:50:50 +07:00

86 lines
2.3 KiB
C

// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
// For more information, see LICENCE in the main folder
#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];
};
extern struct s_mercenary_db mercenary_db[MAX_MERCENARY_CLASS];
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];
int masterteleport_timer;
struct map_session_data *master;
int contract_timer;
unsigned devotion_flag : 1;
};
bool mercenary_class(int class_);
struct view_data * mercenary_get_viewdata(int class_);
bool mercenary_create(struct map_session_data *sd, int class_, unsigned int lifetime);
bool mercenary_recv_data(struct s_mercenary *merc, bool flag);
void mercenary_save(struct mercenary_data *md);
void mercenary_heal(struct mercenary_data *md, int hp, int sp);
bool mercenary_dead(struct mercenary_data *md);
int mercenary_delete(struct mercenary_data *md, int reply);
void mercenary_contract_stop(struct mercenary_data *md);
int mercenary_get_lifetime(struct mercenary_data *md);
int mercenary_get_guild(struct mercenary_data *md);
int mercenary_get_faith(struct mercenary_data *md);
void mercenary_set_faith(struct mercenary_data *md, int value);
int mercenary_get_calls(struct mercenary_data *md);
void mercenary_set_calls(struct mercenary_data *md, int value);
void mercenary_kills(struct mercenary_data *md);
int mercenary_checkskill(struct mercenary_data *md, uint16 skill_id);
short mercenary_skill_get_index(uint16 skill_id);
/**
* atcommand.c required
**/
void mercenary_readdb(void);
void mercenary_read_skilldb(void);
void do_init_mercenary(void);
void do_final_mercenary(void);
#endif /* _MERCENARY_H_ */