From a1ee9fdfc9e4be285a2c21fa2bcd309da89ffe43 Mon Sep 17 00:00:00 2001 From: zephyrus Date: Mon, 1 Sep 2008 00:45:56 +0000 Subject: - Something i forget to commit mmo.h. - Preparatives for Faith/Calls/Kills for mercenaries. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@13167 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/common/mmo.h | 6 ++-- src/map/clif.c | 10 +++++-- src/map/map.h | 3 ++ src/map/mercenary.c | 80 +++++++++++++++++++++++++++++++++++++++++++++++++++++ src/map/mercenary.h | 11 +++++++- 5 files changed, 104 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/common/mmo.h b/src/common/mmo.h index d94796723..fc48f3194 100644 --- a/src/common/mmo.h +++ b/src/common/mmo.h @@ -279,9 +279,9 @@ struct mmo_charstatus { int fame; // Mercenary Guilds Rank - int arch_loyalty, arch_count; - int spear_loyalty, spear_count; - int sword_loyalty, sword_count; + int arch_faith, arch_calls; + int spear_faith, spear_calls; + int sword_faith, sword_calls; short weapon; // enum weapon_type short shield; // view-id diff --git a/src/map/clif.c b/src/map/clif.c index 67ab85b39..b5c749531 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -12398,6 +12398,12 @@ void clif_mercenary_updatestatus(struct map_session_data *sd, int type) case SP_MAXSP: WFIFOL(fd,4) = md->battle_status.max_sp; break; + case SP_MERCKILLS: + WFIFOL(fd,4) = md->mercenary.kill_count; + break; + case SP_MERCFAITH: + WFIFOL(fd,4) = mercenary_get_faith(md); + break; } WFIFOSET(fd,8); } @@ -12435,8 +12441,8 @@ void clif_mercenary_info(struct map_session_data *sd) WFIFOL(fd,56) = status->sp; WFIFOL(fd,60) = status->max_sp; WFIFOL(fd,64) = (int)time(NULL) + (mercenary_get_lifetime(md) / 1000); - WFIFOW(fd,68) = 0; // Loyalty - WFIFOL(fd,70) = 0; // Summon Count + WFIFOW(fd,68) = mercenary_get_faith(md); + WFIFOL(fd,70) = mercenary_get_calls(md); WFIFOL(fd,74) = md->mercenary.kill_count; WFIFOW(fd,78) = md->battle_status.rhw.range; WFIFOSET(fd,80); diff --git a/src/map/map.h b/src/map/map.h index b880b8bf4..92011827b 100644 --- a/src/map/map.h +++ b/src/map/map.h @@ -274,6 +274,9 @@ enum _sp { SP_BASEJOB=119, // 100+19 - celest SP_BASECLASS=120, //Hmm.. why 100+19? I just use the next one... [Skotlex] + + // Mercenaries + SP_MERCFLEE=165, SP_MERCKILLS=189, SP_MERCFAITH=190, // original 1000- SP_ATTACKRANGE=1000, SP_ATKELE,SP_DEFELE, // 1000-1002 diff --git a/src/map/mercenary.c b/src/map/mercenary.c index bcbba3dd1..bcc5cda9b 100644 --- a/src/map/mercenary.c +++ b/src/map/mercenary.c @@ -94,6 +94,86 @@ int mercenary_get_lifetime(struct mercenary_data *md) return (td != NULL) ? DIFF_TICK(td->tick, gettick()) : 0; } +int mercenary_get_faith(struct mercenary_data *md) +{ + struct map_session_data *sd; + int class_; + + if( md == NULL || md->db == NULL || (sd = md->master) == NULL ) + return 0; + + class_ = md->db->class_; + + if( class_ >= 6017 && class_ <= 6026 ) + return sd->status.arch_faith; + if( class_ >= 6027 && class_ <= 6036 ) + return sd->status.spear_faith; + if( class_ >= 6037 && class_ <= 6046 ) + return sd->status.sword_faith; + + return 0; +} + +int mercenary_set_faith(struct mercenary_data *md, int value) +{ + struct map_session_data *sd; + int class_; + + if( md == NULL || md->db == NULL || (sd = md->master) == NULL ) + return 0; + + class_ = md->db->class_; + + if( class_ >= 6017 && class_ <= 6026 ) + sd->status.arch_faith += value; + else if( class_ >= 6027 && class_ <= 6036 ) + sd->status.spear_faith += value; + else if( class_ >= 6037 && class_ <= 6046 ) + sd->status.sword_faith += value; + + return 0; +} + +int mercenary_get_calls(struct mercenary_data *md) +{ + struct map_session_data *sd; + int class_; + + if( md == NULL || md->db == NULL || (sd = md->master) == NULL ) + return 0; + + class_ = md->db->class_; + + if( class_ >= 6017 && class_ <= 6026 ) + return sd->status.arch_calls; + if( class_ >= 6027 && class_ <= 6036 ) + return sd->status.spear_calls; + if( class_ >= 6037 && class_ <= 6046 ) + return sd->status.sword_calls; + + return 0; +} + +int mercenary_set_calls(struct mercenary_data *md, int value) +{ + struct map_session_data *sd; + int class_; + + if( md == NULL || md->db == NULL || (sd = md->master) == NULL ) + return 0; + + class_ = md->db->class_; + + if( class_ >= 6017 && class_ <= 6026 ) + sd->status.arch_calls += value; + else if( class_ >= 6027 && class_ <= 6036 ) + sd->status.spear_calls += value; + else if( class_ >= 6037 && class_ <= 6046 ) + sd->status.sword_calls += value; + + return 0; +} + int mercenary_save(struct mercenary_data *md) { md->mercenary.hp = md->battle_status.hp; diff --git a/src/map/mercenary.h b/src/map/mercenary.h index 9c65b19e7..2a2e17cfa 100644 --- a/src/map/mercenary.h +++ b/src/map/mercenary.h @@ -38,15 +38,24 @@ struct mercenary_data { bool merc_class(int class_); 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); + void mercenary_damage(struct mercenary_data *md, struct block_list *src, int hp, int sp); void mercenary_heal(struct mercenary_data *md, int hp, int sp); int mercenary_dead(struct mercenary_data *md, struct block_list *src); -int do_init_mercenary(void); + int merc_delete(struct mercenary_data *md, int reply); void merc_contract_stop(struct mercenary_data *md); + int mercenary_get_lifetime(struct mercenary_data *md); +int mercenary_get_faith(struct mercenary_data *md); +int mercenary_set_faith(struct mercenary_data *md, int value); +int mercenary_get_calls(struct mercenary_data *md); +int mercenary_set_calls(struct mercenary_data *md, int value); + +int do_init_mercenary(void); #endif /* _MERCENARY_H_ */ -- cgit v1.2.3-60-g2f50