summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorzephyrus <zephyrus@54d463be-8e91-2dee-dedb-b68131a5f0ec>2008-09-01 00:45:56 +0000
committerzephyrus <zephyrus@54d463be-8e91-2dee-dedb-b68131a5f0ec>2008-09-01 00:45:56 +0000
commita1ee9fdfc9e4be285a2c21fa2bcd309da89ffe43 (patch)
tree266a5e008ae6a16ca9d4d644a9cee86e7271c7d8 /src
parentbb1a4e56b358c36a7996be8d34b84e7f118f63f5 (diff)
downloadhercules-a1ee9fdfc9e4be285a2c21fa2bcd309da89ffe43.tar.gz
hercules-a1ee9fdfc9e4be285a2c21fa2bcd309da89ffe43.tar.bz2
hercules-a1ee9fdfc9e4be285a2c21fa2bcd309da89ffe43.tar.xz
hercules-a1ee9fdfc9e4be285a2c21fa2bcd309da89ffe43.zip
- 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
Diffstat (limited to 'src')
-rw-r--r--src/common/mmo.h6
-rw-r--r--src/map/clif.c10
-rw-r--r--src/map/map.h3
-rw-r--r--src/map/mercenary.c80
-rw-r--r--src/map/mercenary.h11
5 files changed, 104 insertions, 6 deletions
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_ */