ソースを参照

- Something i forget to commit mmo.h.
- Preparatives for Faith/Calls/Kills for mercenaries.

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@13167 54d463be-8e91-2dee-dedb-b68131a5f0ec

zephyrus 16 年 前
コミット
3fd4ec074a
5 ファイル変更104 行追加6 行削除
  1. 3 3
      src/common/mmo.h
  2. 8 2
      src/map/clif.c
  3. 3 0
      src/map/map.h
  4. 80 0
      src/map/mercenary.c
  5. 10 1
      src/map/mercenary.h

+ 3 - 3
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

+ 8 - 2
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);

+ 3 - 0
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

+ 80 - 0
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;

+ 10 - 1
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_ */