Jelajahi Sumber

- Added config setting "friend_auto_add" (battle/player.conf), if set, when you accept someone as your friend, both characters will show up on each other's friend list.

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@8769 54d463be-8e91-2dee-dedb-b68131a5f0ec
skotlex 18 tahun lalu
induk
melakukan
abec02f1fe
5 mengubah file dengan 30 tambahan dan 1 penghapusan
  1. 4 0
      Changelog-Trunk.txt
  2. 5 0
      conf-tmpl/battle/player.conf
  3. 2 0
      src/map/battle.c
  4. 1 0
      src/map/battle.h
  5. 18 1
      src/map/clif.c

+ 4 - 0
Changelog-Trunk.txt

@@ -3,6 +3,10 @@ Date	Added
 AS OF SVN REV. 5091, WE ARE NOW USING TRUNK.  ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK.
 IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
 
+2006/09/15
+	* Added config setting "friend_auto_add" (battle/player.conf), if set, when
+	  you accept someone as your friend, both characters will show up on each
+	  other's friend list. [Skotlex]
 2006/09/14
 	* Changed Extremity Fist's code to make you actually walk past your target,
 	  which displays a much more correct "animation" for the skill. Thanks to

+ 5 - 0
conf-tmpl/battle/player.conf

@@ -123,6 +123,11 @@ show_hp_sp_drain: no
 // Display the gained hp/sp values from killing mobs? (Ie: Sky Deleter Card)
 show_hp_sp_gain: yes
 
+
+// If set, when A accepts B as a friend, B will also be added to A's friend 
+// list, otherwise, only A appears in B's friend list.
+friend_auto_add: no
+
 // Are other requests accepted during [various things[party,guild]] a request or not?
 // It does not accept by no accepted by yes.
 invite_request_check: yes

+ 2 - 0
src/map/battle.c

@@ -3769,6 +3769,7 @@ static const struct battle_data_short {
 	{ "autospell_stacking", 				&battle_config.autospell_stacking },
 	{ "override_mob_names", 				&battle_config.override_mob_names },
 	{ "min_chat_delay",						&battle_config.min_chat_delay },
+	{ "friend_auto_add",						&battle_config.friend_auto_add },
 	{ "homunculus_show_growth",					&battle_config.homunculus_show_growth },	//[orn]
 	{ "homunculus_friendly_rate",				&battle_config.homunculus_friendly_rate },
 };
@@ -4208,6 +4209,7 @@ void battle_set_defaults() {
 	battle_config.autospell_stacking = 0;
 	battle_config.override_mob_names = 0;
 	battle_config.min_chat_delay = 0;
+	battle_config.friend_auto_add = 0;
 	battle_config.hvan_explosion_intimate = 45000;	//[orn]
 	battle_config.homunculus_show_growth = 0;	//[orn]
 	battle_config.homunculus_friendly_rate = 100;

+ 1 - 0
src/map/battle.h

@@ -439,6 +439,7 @@ extern struct Battle_Config {
 	unsigned short autospell_stacking; //Enables autospell cards to stack. [Skotlex]
 	unsigned short override_mob_names; //Enables overriding spawn mob names with the mob_db names. [Skotlex]
 	unsigned short min_chat_delay; //Minimum time between client messages. [Skotlex]
+	unsigned short friend_auto_add; //When accepting friends, both get friended. [Skotlex]
 	unsigned int hvan_explosion_intimate ;	// fix [albator]
 	unsigned short homunculus_show_growth ;	//[orn]
 	unsigned short homunculus_friendly_rate;

+ 18 - 1
src/map/clif.c

@@ -11281,7 +11281,24 @@ void clif_parse_FriendsListReply(int fd, struct map_session_data *sd) {
 		memcpy(f_sd->status.friends[i].name, sd->status.name, NAME_LENGTH);
 		clif_friendslist_reqack(f_sd, sd, 0);
 
-//		clif_friendslist_send(sd); //This is not needed anymore.
+		if (battle_config.friend_auto_add) {
+			// Also add f_sd to sd's friendlist.
+			for (i = 0; i < MAX_FRIENDS; i++) {
+				if (sd->status.friends[i].char_id == f_sd->status.char_id)
+					return; //No need to add anything.
+				if (sd->status.friends[i].char_id == 0)
+					break;
+			}
+			if (i == MAX_FRIENDS) {
+				clif_friendslist_reqack(sd, f_sd, 2);
+				return;
+			}
+
+			sd->status.friends[i].account_id = f_sd->status.account_id;
+			sd->status.friends[i].char_id = f_sd->status.char_id;
+			memcpy(sd->status.friends[i].name, f_sd->status.name, NAME_LENGTH);
+			clif_friendslist_reqack(sd, f_sd, 0);
+		}
 	}
 
 	return;