summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-09-15 16:40:01 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-09-15 16:40:01 +0000
commit7c8a7292d264ef51ded3f7a8adbba2b196fc9904 (patch)
tree52acb75cb960719ade7004d585042bab22c3a8e6 /src
parenta8fd492a51a94552b4972dfb6d36c3d62deb4e25 (diff)
downloadhercules-7c8a7292d264ef51ded3f7a8adbba2b196fc9904.tar.gz
hercules-7c8a7292d264ef51ded3f7a8adbba2b196fc9904.tar.bz2
hercules-7c8a7292d264ef51ded3f7a8adbba2b196fc9904.tar.xz
hercules-7c8a7292d264ef51ded3f7a8adbba2b196fc9904.zip
- 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://rathena.svn.sourceforge.net/svnroot/rathena/trunk@8769 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src')
-rw-r--r--src/map/battle.c2
-rw-r--r--src/map/battle.h1
-rw-r--r--src/map/clif.c19
3 files changed, 21 insertions, 1 deletions
diff --git a/src/map/battle.c b/src/map/battle.c
index badf117ed..f44493cb3 100644
--- a/src/map/battle.c
+++ b/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;
diff --git a/src/map/battle.h b/src/map/battle.h
index 2d851176a..130ec2d4d 100644
--- a/src/map/battle.h
+++ b/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;
diff --git a/src/map/clif.c b/src/map/clif.c
index ac76dd9f2..366da63df 100644
--- a/src/map/clif.c
+++ b/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;