From 59e98faf7bfc79b13cf1f2d006d19e1c08e8d5d1 Mon Sep 17 00:00:00 2001 From: zephyrus Date: Sat, 6 Sep 2008 15:21:25 +0000 Subject: - Renamed createmercenary to mercenary_create. - Added other required mercenary script commands for official script. - New Constants entries for this script. - Update to missing configuration on mercenary skills. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@13195 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/mercenary.c | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) (limited to 'src/map/mercenary.c') diff --git a/src/map/mercenary.c b/src/map/mercenary.c index 4775f9beb..84974e906 100644 --- a/src/map/mercenary.c +++ b/src/map/mercenary.c @@ -94,6 +94,25 @@ int mercenary_get_lifetime(struct mercenary_data *md) return (td != NULL) ? DIFF_TICK(td->tick, gettick()) : 0; } +int mercenary_get_guild(struct mercenary_data *md) +{ + int class_; + + if( md == NULL || md->db == NULL ) + return -1; + + class_ = md->db->class_; + + if( class_ >= 6017 && class_ <= 6026 ) + return ARCH_MERC_GUILD; + if( class_ >= 6027 && class_ <= 6036 ) + return SPEAR_MERC_GUILD; + if( class_ >= 6037 && class_ <= 6046 ) + return SWORD_MERC_GUILD; + + return -1; +} + int mercenary_get_faith(struct mercenary_data *md) { struct map_session_data *sd; @@ -110,8 +129,6 @@ int mercenary_get_faith(struct mercenary_data *md) return sd->status.spear_faith; if( class_ >= 6037 && class_ <= 6046 ) return sd->status.sword_faith; - else - return 0; return 0; } @@ -158,8 +175,6 @@ int mercenary_get_calls(struct mercenary_data *md) return sd->status.spear_calls; if( class_ >= 6037 && class_ <= 6046 ) return sd->status.sword_calls; - else - return 0; return 0; } @@ -231,6 +246,12 @@ int merc_delete(struct mercenary_data *md, int reply) if( !sd ) return unit_free(&md->bl, 0); + if( md->devotion_flag ) + { + md->devotion_flag = 0; + status_change_end(&sd->bl, SC_DEVOTION, -1); + } + switch( reply ) { case 0: mercenary_set_faith(md, 1); break; // +1 Loyalty on Contract ends. @@ -278,6 +299,7 @@ int merc_data_received(struct s_mercenary *merc, bool flag) sd->md = md = (struct mercenary_data*)aCalloc(1,sizeof(struct mercenary_data)); md->bl.type = BL_MER; md->bl.id = npc_get_new_npc_id(); + md->devotion_flag = 0; md->master = sd; md->db = db; -- cgit v1.2.3-60-g2f50