summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenpachi Developer <Kenpachi.Developer@gmx.de>2020-06-22 03:11:24 +0200
committerKenpachi Developer <Kenpachi.Developer@gmx.de>2020-06-22 03:11:24 +0200
commitfa14df7e5ba9f18c74f149fb3bcaee32dfd87f80 (patch)
tree3f5277e2438396cc946f51b47fc07faed67e7336
parenta0fb73f998832db72c627d11bc3b0f04c392569a (diff)
downloadhercules-fa14df7e5ba9f18c74f149fb3bcaee32dfd87f80.tar.gz
hercules-fa14df7e5ba9f18c74f149fb3bcaee32dfd87f80.tar.bz2
hercules-fa14df7e5ba9f18c74f149fb3bcaee32dfd87f80.tar.xz
hercules-fa14df7e5ba9f18c74f149fb3bcaee32dfd87f80.zip
Add battle flag for sending party options
-rw-r--r--conf/map/battle/party.conf27
-rw-r--r--src/map/battle.c1
-rw-r--r--src/map/battle.h1
-rw-r--r--src/map/clif.c70
4 files changed, 85 insertions, 14 deletions
diff --git a/conf/map/battle/party.conf b/conf/map/battle/party.conf
index e27a709fd..7713d5376 100644
--- a/conf/map/battle/party.conf
+++ b/conf/map/battle/party.conf
@@ -80,3 +80,30 @@ party_even_share_bonus: 0
// Display party name regardless if player is in a guild.
// Official servers do not display party name unless the user is in a guild. (Note 1)
display_party_name: false
+
+// When and how to send the party options? (Note 3)
+//
+// Flags for when to display the party options:
+// 0x00000 - Never send party options.
+// 0x00001 - Send party options upon login. (Default. Should always be set.)
+// 0x00002 - Send party options upon map change.
+// 0x00004 - Send party options upon teleporting (regardless of changing maps).
+// 0x00008 - Send party options upon successfully changing options manually. (Default. Should always be set.)
+// 0x00010 - Send party options upon unsuccessfully changing options manually. (Tried to enable EXP sharing if not allowed.) (Default.)
+// 0x00020 - Send party options upon changing options automatically. (Default. Should always be set.)
+// 0x00040 - Send party options upon joining party. (Default. Should always be set.)
+// 0x00080 - Send party options upon leaving party. (Default.)
+//
+// Flags for how to send the party options:
+// 0x00100 - Send party options to all party members upon unsuccessfully changing options manually. (Tried to enable EXP sharing if not allowed.) (Default.)
+// 0x00200 - Send all party options upon login.
+// 0x00400 - Send all party options upon map change.
+// 0x00800 - Send all party options upon teleporting (regardless of changing maps).
+// 0x01000 - Send all party options upon successfully changing options manually. (Default.)
+// 0x02000 - Send all party options upon unsuccessfully changing options manually. (Tried to enable EXP sharing if not allowed.) (Default.)
+// 0x04000 - Send all party options upon changing options automatically.
+// 0x08000 - Send all party options upon joining party.
+// 0x10000 - Send all party options upon leaving party.
+//
+// Default: 0x31F9 (Official behavior.)
+send_party_options: 0x31F9
diff --git a/src/map/battle.c b/src/map/battle.c
index ed5aa4cb9..e8d8e581f 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -7345,6 +7345,7 @@ static const struct battle_data {
{ "searchstore_querydelay", &battle_config.searchstore_querydelay, 10, 0, INT_MAX, },
{ "searchstore_maxresults", &battle_config.searchstore_maxresults, 30, 1, INT_MAX, },
{ "display_party_name", &battle_config.display_party_name, 0, 0, 1, },
+ { "send_party_options", &battle_config.send_party_options, 0x31F9, 0, 0x1FFFF, },
{ "cashshop_show_points", &battle_config.cashshop_show_points, 0, 0, 1, },
{ "mail_show_status", &battle_config.mail_show_status, 0, 0, 2, },
{ "client_limit_unit_lv", &battle_config.client_limit_unit_lv, 0, 0, BL_ALL, },
diff --git a/src/map/battle.h b/src/map/battle.h
index 5a039a8ed..ceb94321e 100644
--- a/src/map/battle.h
+++ b/src/map/battle.h
@@ -471,6 +471,7 @@ struct Battle_Config {
int searchstore_querydelay;
int searchstore_maxresults;
int display_party_name;
+ int send_party_options;
int cashshop_show_points;
int mail_show_status;
int client_limit_unit_lv;
diff --git a/src/map/clif.c b/src/map/clif.c
index 8634925f0..a75fc0dc3 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -7307,13 +7307,48 @@ static void clif_party_inviteack(struct map_session_data *sd, const char *nick,
/// 0x08 = Member added.
/// 0x10 = Member removed.
/// 0x20 = Character logged in.
+/// 0x40 = Character changed map.
+/// 0x80 = Character teleported.
static void clif_party_option(struct party_data *p, struct map_session_data *sd, int flag)
{
+ int conf = battle_config.send_party_options;
+
+ if (((flag & 0x01) != 0 && (conf & 0x10) == 0)
+ || ((flag & 0x02) != 0 && (conf & 0x08) == 0)
+ || ((flag & 0x04) != 0 && (conf & 0x20) == 0)
+ || ((flag & 0x08) != 0 && (conf & 0x40) == 0)
+ || ((flag & 0x10) != 0 && (conf & 0x80) == 0)
+ || ((flag & 0x20) != 0 && (conf & 0x01) == 0)
+ || ((flag & 0x40) != 0 && (conf & 0x02) == 0)
+ || ((flag & 0x80) != 0 && (conf & 0x04) == 0)) {
+ return;
+ }
+
+ enum send_target target = SELF;
+
+ if (((flag & 0x01) != 0 && (conf & 0x100) != 0)
+ || ((flag & 0x01) == 0 && (flag & 0x02) != 0)
+ || (flag & 0x04) != 0) {
+ target = PARTY;
+ }
+
+ int cmd = 0x101;
+
+ if (((flag & 0x01) != 0 && (conf & 0x02000) != 0)
+ || ((flag & 0x02) != 0 && (conf & 0x01000) != 0)
+ || ((flag & 0x04) != 0 && (conf & 0x04000) != 0)
+ || ((flag & 0x08) != 0 && (conf & 0x08000) != 0)
+ || ((flag & 0x10) != 0 && (conf & 0x10000) != 0)
+ || ((flag & 0x20) != 0 && (conf & 0x00200) != 0)
+ || ((flag & 0x40) != 0 && (conf & 0x00400) != 0)
+ || ((flag & 0x80) != 0 && (conf & 0x00800) != 0)) {
+ cmd = 0x7d8;
+ }
+
unsigned char buf[16];
#if PACKETVER < 20090603
- const int cmd = 0x101;
-#else
- const int cmd = 0x7d8;
+ if (cmd == 0x7d8)
+ cmd = 0x101;
#endif
nullpo_retv(p);
@@ -7328,14 +7363,13 @@ static void clif_party_option(struct party_data *p, struct map_session_data *sd,
if(!sd) return;
WBUFW(buf,0)=cmd;
WBUFL(buf, 2) = ((flag & 0x10) != 0) ? 0 : (((flag & 0x01) != 0) ? 2 : p->party.exp);
-#if PACKETVER >= 20090603
- WBUFB(buf, 6) = ((flag & 0x10) != 0) ? 0 : (((p->party.item & 1) != 0) ? 1 : 0);
- WBUFB(buf, 7) = ((flag & 0x10) != 0) ? 0 : (((p->party.item & 2) != 0) ? 1 : 0);
-#endif
- if ((flag & 0x01) == 0 && ((flag & 0x04) != 0 || (flag & 0x02) != 0))
- clif->send(buf,packet_len(cmd),&sd->bl,PARTY);
- else
- clif->send(buf,packet_len(cmd),&sd->bl,SELF);
+
+ if (cmd == 0x7d8) {
+ WBUFB(buf, 6) = ((flag & 0x10) != 0) ? 0 : (((p->party.item & 1) != 0) ? 1 : 0);
+ WBUFB(buf, 7) = ((flag & 0x10) != 0) ? 0 : (((p->party.item & 2) != 0) ? 1 : 0);
+ }
+
+ clif->send(buf, packet_len(cmd), &sd->bl, target);
if ((flag & 0x04) != 0)
p->state.option_auto_changed = 0;
@@ -11036,11 +11070,19 @@ static void clif_parse_LoadEndAck(int fd, struct map_session_data *sd)
#endif
}
- if (p != NULL && first_time) {
+ if (p != NULL) {
+ int flag;
+
if (p->state.option_auto_changed != 0)
- clif->party_option(p, sd, 0x04);
+ flag = 0x04;
+ else if (first_time)
+ flag = 0x20;
+ else if (change_map)
+ flag = 0x40;
else
- clif->party_option(p, sd, 0x20);
+ flag = 0x80;
+
+ clif->party_option(p, sd, flag);
}
if (((battle_config.display_rate_messages & 0x1) != 0 && first_time)