- Moving all content of Homunculus code to a proper file Homunculus.c/h

- Update of all project files.

NOTE: All functions on homunculus.c should be renamed i think, to remove all the merc_*.

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@13122 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
zephyrus 2008-08-24 15:00:26 +00:00
parent d650043597
commit c5cc2257d3
26 changed files with 1363 additions and 1234 deletions

View File

@ -17,7 +17,7 @@ MAP_OBJ = map.o chrif.o clif.o pc.o status.o npc.o \
npc_chat.o chat.o path.o itemdb.o mob.o script.o \
storage.o skill.o atcommand.o charcommand.o battle.o \
intif.o trade.o party.o vending.o guild.o pet.o \
log.o mail.o date.o unit.o mercenary.o quest.o
log.o mail.o date.o unit.o homunculus.o mercenary.o quest.o
MAP_TXT_OBJ = $(MAP_OBJ:%=obj_txt/%) \
obj_txt/mapreg_txt.o
MAP_SQL_OBJ = $(MAP_OBJ:%=obj_sql/%) \
@ -26,7 +26,7 @@ MAP_H = map.h chrif.h clif.h pc.h status.h npc.h \
chat.h itemdb.h mob.h script.h path.h \
storage.h skill.h atcommand.h charcommand.h battle.h \
intif.h trade.h party.h vending.h guild.h pet.h \
log.h mail.h date.h unit.h mercenary.h quest.h mapreg.h
log.h mail.h date.h unit.h homunculus.h mercenary.h quest.h mapreg.h
HAVE_MYSQL=@HAVE_MYSQL@
ifeq ($(HAVE_MYSQL),yes)

View File

@ -27,6 +27,7 @@
#include "mob.h"
#include "npc.h"
#include "pet.h"
#include "homunculus.h"
#include "mercenary.h"
#include "party.h"
#include "guild.h"
@ -6592,15 +6593,15 @@ int atcommand_adjcmdlvl(const int fd, struct map_session_data* sd, const char* c
*------------------------------------------*/
int atcommand_adjgmlvl(const int fd, struct map_session_data* sd, const char* command, const char* message)
{
int newlev;
char user[NAME_LENGTH];
struct map_session_data *pl_sd;
int newlev;
char user[NAME_LENGTH];
struct map_session_data *pl_sd;
nullpo_retr(-1, sd);
if (!message || !*message || sscanf(message, "%d %23[^\r\n]", &newlev, user) != 2) {
clif_displaymessage(fd, "Usage: @adjgmlvl <lvl> <user>.");
return -1;
}
if (!message || !*message || sscanf(message, "%d %23[^\r\n]", &newlev, user) != 2) {
clif_displaymessage(fd, "Usage: @adjgmlvl <lvl> <user>.");
return -1;
}
if ( (pl_sd = map_nick2sd(user)) == NULL )
{

View File

@ -15,7 +15,7 @@
#include "pc.h"
#include "status.h"
#include "skill.h"
#include "mercenary.h"
#include "homunculus.h"
#include "mob.h"
#include "itemdb.h"
#include "clif.h"

View File

@ -24,7 +24,7 @@
#include "mob.h"
#include "npc.h"
#include "pet.h"
#include "mercenary.h"
#include "homunculus.h"
#include "party.h"
#include "guild.h"
#include "script.h"

View File

@ -19,6 +19,7 @@
#include "pet.h"
#include "skill.h"
#include "status.h"
#include "homunculus.h"
#include "mercenary.h"
#include "chrif.h"
#include "quest.h"

View File

@ -32,7 +32,8 @@
#include "guild.h"
#include "vending.h"
#include "pet.h"
#include "mercenary.h" //[orn]
#include "homunculus.h"
#include "mercenary.h"
#include "log.h"
#include "clif.h"
#include "mail.h"

1177
src/map/homunculus.c Normal file

File diff suppressed because it is too large Load Diff

89
src/map/homunculus.h Normal file
View File

@ -0,0 +1,89 @@
// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
// For more information, see LICENCE in the main folder
#ifndef _HOMUNCULUS_H_
#define _HOMUNCULUS_H_
#include "status.h" // struct status_data, struct status_change
#include "unit.h" // struct unit_data
struct h_stats {
unsigned int HP, SP;
unsigned short str, agi, vit, int_, dex, luk;
};
struct s_homunculus_db {
int base_class, evo_class;
char name[NAME_LENGTH];
struct h_stats base, gmin, gmax, emin, emax;
int foodID ;
int baseASPD ;
long hungryDelay ;
unsigned char element, race, base_size, evo_size;
};
extern struct s_homunculus_db homuncumlus_db[MAX_HOMUNCULUS_CLASS];
enum { HOMUNCULUS_CLASS, HOMUNCULUS_FOOD };
enum {
SP_ACK = 0x00,
SP_INTIMATE = 0x100,
SP_HUNGRY = 0x200
};
struct homun_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_homunculus_db *homunculusDB; //[orn]
struct s_homunculus homunculus; //[orn]
struct map_session_data *master; //pointer back to its master
int hungry_timer; //[orn]
unsigned int exp_next;
char blockskill[MAX_SKILL]; // [orn]
};
#define homdb_checkid(id) (id >= HM_CLASS_BASE && id <= HM_CLASS_MAX)
// merc_is_hom_alive(struct homun_data *)
#define merc_is_hom_active(x) (x && x->homunculus.vaporize != 1 && x->battle_status.hp > 0)
int do_init_merc(void);
int merc_hom_recv_data(int account_id, struct s_homunculus *sh, int flag); //albator
struct view_data* merc_get_hom_viewdata(int class_);
void merc_damage(struct homun_data *hd,struct block_list *src,int hp,int sp);
int merc_hom_dead(struct homun_data *hd, struct block_list *src);
void merc_hom_skillup(struct homun_data *hd,int skillnum);
int merc_hom_calc_skilltree(struct homun_data *hd) ;
int merc_hom_checkskill(struct homun_data *hd,int skill_id) ;
int merc_hom_gainexp(struct homun_data *hd,int exp) ;
int merc_hom_levelup(struct homun_data *hd) ;
int merc_hom_evolution(struct homun_data *hd) ;
void merc_hom_heal(struct homun_data *hd,int hp,int sp);
int merc_hom_vaporize(struct map_session_data *sd, int flag);
int merc_resurrect_homunculus(struct map_session_data *sd, unsigned char per, short x, short y);
void merc_hom_revive(struct homun_data *hd, unsigned int hp, unsigned int sp);
void merc_reset_stats(struct homun_data *hd);
int merc_hom_shuffle(struct homun_data *hd); // [Zephyrus]
void merc_save(struct homun_data *hd);
int merc_call_homunculus(struct map_session_data *sd);
int merc_create_homunculus_request(struct map_session_data *sd, int class_);
int search_homunculusDB_index(int key,int type);
int merc_menu(struct map_session_data *sd,int menunum);
int merc_hom_food(struct map_session_data *sd, struct homun_data *hd);
int merc_hom_hungry_timer_delete(struct homun_data *hd);
int merc_hom_change_name(struct map_session_data *sd,char *name);
int merc_hom_change_name_ack(struct map_session_data *sd, char* name, int flag);
#define merc_stop_walking(hd, type) unit_stop_walking(&(hd)->bl, type)
#define merc_stop_attack(hd) unit_stop_attack(&(hd)->bl)
int merc_hom_increase_intimacy(struct homun_data * hd, unsigned int value);
int merc_hom_decrease_intimacy(struct homun_data * hd, unsigned int value);
int merc_skill_tree_get_max(int id, int b_class);
void merc_hom_init_timers(struct homun_data * hd);
void merc_skill_reload(void);
void merc_reload(void);
#endif /* _HOMUNCULUS_H_ */

View File

@ -18,7 +18,8 @@
#include "guild.h"
#include "pet.h"
#include "atcommand.h"
#include "mercenary.h" //albator
#include "mercenary.h"
#include "homunculus.h"
#include "mail.h"
#include "quest.h"

View File

@ -35,6 +35,7 @@
#include "mapreg.h"
#include "guild.h"
#include "pet.h"
#include "homunculus.h"
#include "mercenary.h"
#include "atcommand.h"
#include "charcommand.h"
@ -3544,7 +3545,8 @@ int do_init(int argc, char *argv[])
do_init_guild();
do_init_storage();
do_init_pet();
do_init_merc(); //[orn]
do_init_merc();
do_init_mercenary();
do_init_npc();
do_init_unit();
#ifndef TXT_ONLY /* mail system [Valaris] */

File diff suppressed because it is too large Load Diff

View File

@ -7,9 +7,6 @@
#include "status.h" // struct status_data, struct status_change
#include "unit.h" // struct unit_data
// Mercenary DB Structures
// ===================================
struct s_mercenary_db {
int class_;
char sprite[NAME_LENGTH], name[NAME_LENGTH];
@ -43,88 +40,6 @@ struct view_data * merc_get_viewdata(int class_);
int merc_create(struct map_session_data *sd, int class_, unsigned int lifetime);
int merc_data_received(struct s_mercenary *merc, bool flag);
int mercenary_save(struct mercenary_data *md);
// Homunculus DB Structures
// ===================================
struct h_stats {
unsigned int HP, SP;
unsigned short str, agi, vit, int_, dex, luk;
};
struct s_homunculus_db {
int base_class, evo_class;
char name[NAME_LENGTH];
struct h_stats base, gmin, gmax, emin, emax;
int foodID ;
int baseASPD ;
long hungryDelay ;
unsigned char element, race, base_size, evo_size;
};
extern struct s_homunculus_db homuncumlus_db[MAX_HOMUNCULUS_CLASS];
enum { HOMUNCULUS_CLASS, HOMUNCULUS_FOOD };
enum {
SP_ACK = 0x00,
SP_INTIMATE = 0x100,
SP_HUNGRY = 0x200
};
struct homun_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_homunculus_db *homunculusDB; //[orn]
struct s_homunculus homunculus; //[orn]
struct map_session_data *master; //pointer back to its master
int hungry_timer; //[orn]
unsigned int exp_next;
char blockskill[MAX_SKILL]; // [orn]
};
#define homdb_checkid(id) (id >= HM_CLASS_BASE && id <= HM_CLASS_MAX)
// merc_is_hom_alive(struct homun_data *)
#define merc_is_hom_active(x) (x && x->homunculus.vaporize != 1 && x->battle_status.hp > 0)
int do_init_merc(void);
int merc_hom_recv_data(int account_id, struct s_homunculus *sh, int flag); //albator
struct view_data* merc_get_hom_viewdata(int class_);
void merc_damage(struct homun_data *hd,struct block_list *src,int hp,int sp);
int merc_hom_dead(struct homun_data *hd, struct block_list *src);
void merc_hom_skillup(struct homun_data *hd,int skillnum);
int merc_hom_calc_skilltree(struct homun_data *hd) ;
int merc_hom_checkskill(struct homun_data *hd,int skill_id) ;
int merc_hom_gainexp(struct homun_data *hd,int exp) ;
int merc_hom_levelup(struct homun_data *hd) ;
int merc_hom_evolution(struct homun_data *hd) ;
void merc_hom_heal(struct homun_data *hd,int hp,int sp);
int merc_hom_vaporize(struct map_session_data *sd, int flag);
int merc_resurrect_homunculus(struct map_session_data *sd, unsigned char per, short x, short y);
void merc_hom_revive(struct homun_data *hd, unsigned int hp, unsigned int sp);
void merc_reset_stats(struct homun_data *hd);
int merc_hom_shuffle(struct homun_data *hd); // [Zephyrus]
void merc_save(struct homun_data *hd);
int merc_call_homunculus(struct map_session_data *sd);
int merc_create_homunculus_request(struct map_session_data *sd, int class_);
int search_homunculusDB_index(int key,int type);
int merc_menu(struct map_session_data *sd,int menunum);
int merc_hom_food(struct map_session_data *sd, struct homun_data *hd);
int merc_hom_hungry_timer_delete(struct homun_data *hd);
int merc_hom_change_name(struct map_session_data *sd,char *name);
int merc_hom_change_name_ack(struct map_session_data *sd, char* name, int flag);
#define merc_stop_walking(hd, type) unit_stop_walking(&(hd)->bl, type)
#define merc_stop_attack(hd) unit_stop_attack(&(hd)->bl)
int merc_hom_increase_intimacy(struct homun_data * hd, unsigned int value);
int merc_hom_decrease_intimacy(struct homun_data * hd, unsigned int value);
int merc_skill_tree_get_max(int id, int b_class);
void merc_hom_init_timers(struct homun_data * hd);
void merc_skill_reload(void);
void merc_reload(void);
int do_init_mercenary(void);
#endif /* _MERCENARY_H_ */

View File

@ -20,7 +20,7 @@
#include "pet.h"
#include "status.h"
#include "mob.h"
#include "mercenary.h" //[orn]
#include "homunculus.h"
#include "guild.h"
#include "itemdb.h"
#include "skill.h"

View File

@ -22,7 +22,8 @@
#include "mail.h"
#include "map.h"
#include "path.h"
#include "mercenary.h" // merc_is_hom_active()
#include "homunculus.h"
#include "mercenary.h"
#include "mob.h" // MAX_MOB_RACE_DB
#include "npc.h" // fake_nd
#include "pet.h" // pet_unlocktarget()

View File

@ -27,7 +27,7 @@
#include "npc.h"
#include "pet.h"
#include "mapreg.h"
#include "mercenary.h" //[orn]
#include "homunculus.h"
#include "intif.h"
#include "skill.h"
#include "status.h"

View File

@ -17,7 +17,7 @@
#include "pc.h"
#include "status.h"
#include "pet.h"
#include "mercenary.h"
#include "homunculus.h"
#include "mob.h"
#include "npc.h"
#include "battle.h"

View File

@ -25,6 +25,7 @@
#include "status.h"
#include "script.h"
#include "unit.h"
#include "homunculus.h"
#include "mercenary.h"
#include "vending.h"

View File

@ -12,6 +12,7 @@
#include "pc.h"
#include "mob.h"
#include "pet.h"
#include "homunculus.h"
#include "mercenary.h"
#include "skill.h"
#include "clif.h"

View File

@ -311,6 +311,14 @@ SOURCE=..\src\map\mapreg_sql.c
# End Source File
# Begin Source File
SOURCE=..\src\map\homunculus.c
# End Source File
# Begin Source File
SOURCE=..\src\map\homunculus.h
# End Source File
# Begin Source File
SOURCE=..\src\map\mercenary.c
# End Source File
# Begin Source File

View File

@ -243,6 +243,10 @@ SOURCE=..\src\map\map.c
# End Source File
# Begin Source File
SOURCE=..\src\map\homunculus.c
# End Source File
# Begin Source File
SOURCE=..\src\map\mercenary.c
# End Source File
# Begin Source File
@ -367,6 +371,10 @@ SOURCE=..\src\map\mapreg_txt.c
# End Source File
# Begin Source File
SOURCE=..\src\map\homunculus.h
# End Source File
# Begin Source File
SOURCE=..\src\map\mercenary.h
# End Source File
# Begin Source File

View File

@ -232,6 +232,12 @@
<File
RelativePath="..\src\map\mapreg_sql.c">
</File>
<File
RelativePath="..\src\map\homunculus.c">
</File>
<File
RelativePath="..\src\map\homunculus.h">
</File>
<File
RelativePath="..\src\map\mercenary.c">
</File>

View File

@ -232,6 +232,12 @@
<File
RelativePath="..\src\map\mapreg_txt.c">
</File>
<File
RelativePath="..\src\map\homunculus.c">
</File>
<File
RelativePath="..\src\map\homunculus.h">
</File>
<File
RelativePath="..\src\map\mercenary.c">
</File>

View File

@ -401,6 +401,14 @@
RelativePath="..\src\map\guild.h"
>
</File>
<File
RelativePath="..\src\map\homunculus.c"
>
</File>
<File
RelativePath="..\src\map\homunculus.h"
>
</File>
<File
RelativePath="..\src\map\intif.c"
>

View File

@ -95,6 +95,9 @@
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
@ -185,6 +188,9 @@
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
@ -260,6 +266,14 @@
RelativePath="..\src\map\guild.h"
>
</File>
<File
RelativePath="..\src\map\homunculus.c"
>
</File>
<File
RelativePath="..\src\map\homunculus.h"
>
</File>
<File
RelativePath="..\src\map\intif.c"
>

View File

@ -454,6 +454,14 @@
RelativePath="..\src\map\mapreg_sql.c"
>
</File>
<File
RelativePath="..\src\map\homunculus.c"
>
</File>
<File
RelativePath="..\src\map\homunculus.h"
>
</File>
<File
RelativePath="..\src\map\mercenary.c"
>

View File

@ -313,6 +313,14 @@
RelativePath="..\src\map\mapreg_txt.c"
>
</File>
<File
RelativePath="..\src\map\homunculus.c"
>
</File>
<File
RelativePath="..\src\map\homunculus.h"
>
</File>
<File
RelativePath="..\src\map\mercenary.c"
>