summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2019-08-26 01:38:26 +0200
committerGitHub <noreply@github.com>2019-08-26 01:38:26 +0200
commit29e6bbef1b7d4c2434cc6bc8e7a0226227ec6281 (patch)
tree2a87caab4d2a26e279af63dd02871f6553021449 /src/map
parentdae5933998758c4fcf8a7dde452d34a3b8fd052c (diff)
parent0f5da8e9f5ef70c9d2e845c1e69e2b2024094ee9 (diff)
downloadhercules-29e6bbef1b7d4c2434cc6bc8e7a0226227ec6281.tar.gz
hercules-29e6bbef1b7d4c2434cc6bc8e7a0226227ec6281.tar.bz2
hercules-29e6bbef1b7d4c2434cc6bc8e7a0226227ec6281.tar.xz
hercules-29e6bbef1b7d4c2434cc6bc8e7a0226227ec6281.zip
Merge pull request #2522 from MishimaHaruna/remove-inter-roundtrips
Remove some round-trips to the inter-server
Diffstat (limited to 'src/map')
-rw-r--r--src/map/atcommand.c10
-rw-r--r--src/map/clif.c12
-rw-r--r--src/map/guild.c22
-rw-r--r--src/map/guild.h1
-rw-r--r--src/map/intif.c329
-rw-r--r--src/map/intif.h13
-rw-r--r--src/map/party.c25
-rw-r--r--src/map/party.h1
-rw-r--r--src/map/pc.c54
-rw-r--r--src/map/pc.h2
-rw-r--r--src/map/script.c20
-rw-r--r--src/map/trade.c6
12 files changed, 92 insertions, 403 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index 2fac5b4a4..22969606d 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -1107,8 +1107,10 @@ ACMD(kami)
sscanf(message, "%199[^\n]", atcmd_output);
if (stristr(info->command, "l") != NULL)
clif->broadcast(&sd->bl, atcmd_output, (int)strlen(atcmd_output) + 1, BC_DEFAULT, ALL_SAMEMAP);
+ else if (info->command[4] == 'b' || info->command[4] == 'B')
+ clif->broadcast(NULL, atcmd_output, (int)strlen(atcmd_output) + 1, BC_BLUE, ALL_CLIENT);
else
- intif->broadcast(atcmd_output, (int)strlen(atcmd_output) + 1, (*(info->command + 4) == 'b' || *(info->command + 4) == 'B') ? BC_BLUE : BC_YELLOW);
+ clif->broadcast(NULL, atcmd_output, (int)strlen(atcmd_output) + 1, BC_YELLOW, ALL_CLIENT);
} else {
if(!*message || (sscanf(message, "%10u %199[^\n]", &color, atcmd_output) < 2)) {
clif->message(fd, msg_fd(fd,981)); // Please enter color and message (usage: @kamic <color> <message>).
@@ -1119,7 +1121,7 @@ ACMD(kami)
clif->message(fd, msg_fd(fd,982)); // Invalid color.
return false;
}
- intif->broadcast2(atcmd_output, (int)strlen(atcmd_output) + 1, color, 0x190, 12, 0, 0);
+ clif->broadcast2(NULL, atcmd_output, (int)strlen(atcmd_output) + 1, color, 0x190, 12, 0, 0, ALL_CLIENT);
}
return true;
}
@@ -5125,7 +5127,7 @@ ACMD(broadcast)
}
safesnprintf(atcmd_output, sizeof(atcmd_output), "%s: %s", sd->status.name, message);
- intif->broadcast(atcmd_output, (int)strlen(atcmd_output) + 1, BC_DEFAULT);
+ clif->broadcast(NULL, atcmd_output, (int)strlen(atcmd_output) + 1, BC_DEFAULT, ALL_CLIENT);
return true;
}
@@ -8263,7 +8265,7 @@ ACMD(request)
}
safesnprintf(atcmd_output, sizeof(atcmd_output), msg_fd(fd,278), message); // (@request): %s
- intif->wis_message_to_gm(sd->status.name, PC_PERM_RECEIVE_REQUESTS, atcmd_output);
+ pc->wis_message_to_gm(sd->status.name, PC_PERM_RECEIVE_REQUESTS, atcmd_output);
clif_disp_onlyself(sd, atcmd_output);
clif->message(sd->fd,msg_fd(fd,279)); // @request sent.
return true;
diff --git a/src/map/clif.c b/src/map/clif.c
index 421274b0f..1c245ed43 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -11096,13 +11096,13 @@ static void clif_parse_GetCharNameRequest(int fd, struct map_session_data *sd)
sc = status->get_sc(bl);
if (sc && sc->option&OPTION_INVISIBLE && !clif->isdisguised(bl) &&
bl->type != BL_NPC && //Skip hidden NPCs which can be seen using Maya Purple
- pc_get_group_level(sd) < battle_config.hack_info_GM_level
+ !pc_has_permission(sd, PC_PERM_RECEIVE_HACK_INFO)
) {
char gm_msg[256];
sprintf(gm_msg, "Hack on NameRequest: character '%s' (account: %d) requested the name of an invisible target (id: %d).\n", sd->status.name, sd->status.account_id, id);
ShowWarning(gm_msg);
// information is sent to all online GMs
- intif->wis_message_to_gm(map->wisp_server_name, battle_config.hack_info_GM_level, gm_msg);
+ pc->wis_message_to_gm(map->wisp_server_name, PC_PERM_RECEIVE_HACK_INFO, gm_msg);
return;
}
#endif // 0
@@ -11593,12 +11593,8 @@ static void clif_parse_WisMessage(int fd, struct map_session_data *sd)
dstsd = map->nick2sd(target);
if (dstsd == NULL || strcmp(dstsd->status.name, target) != 0) {
- // player is not on this map-server
- // At this point, don't send wisp/page if it's not exactly the same name, because (example)
- // if there are 'Test' player on an other map-server and 'test' player on this map-server,
- // and if we ask for 'Test', we must not contact 'test' player
- // so, we send information to inter-server, which is the only one which decide (and copy correct name).
- intif->wis_message(sd, target, message, (int)strlen(message));
+ // Character not found (or found through partial match).
+ clif->wis_end(sd->fd, 1);
return;
}
diff --git a/src/map/guild.c b/src/map/guild.c
index aadb55c78..415a46db5 100644
--- a/src/map/guild.c
+++ b/src/map/guild.c
@@ -1137,13 +1137,14 @@ static int guild_recv_memberinfoshort(int guild_id, int account_id, int char_id,
*---------------------------------------------------*/
static int guild_send_message(struct map_session_data *sd, const char *mes)
{
- int len = (int)strlen(mes);
nullpo_ret(sd);
- if (sd->status.guild_id == 0)
+ if (sd->status.guild_id == 0 || sd->guild == NULL)
return 0;
- intif->guild_message(sd->status.guild_id, sd->status.account_id, mes, len);
- guild->recv_message(sd->status.guild_id, sd->status.account_id, mes, len);
+
+ int len = (int)strlen(mes);
+
+ clif->guild_message(sd->guild, sd->status.account_id, mes, len);
// Chat logging type 'G' / Guild Chat
logs->chat(LOG_CHAT_GUILD, sd->status.guild_id, sd->status.char_id, sd->status.account_id, mapindex_id2name(sd->mapindex), sd->bl.x, sd->bl.y, NULL, mes);
@@ -1152,18 +1153,6 @@ static int guild_send_message(struct map_session_data *sd, const char *mes)
}
/*====================================================
- * Guild receive a message, will be displayed to whole member
- *---------------------------------------------------*/
-static int guild_recv_message(int guild_id, int account_id, const char *mes, int len)
-{
- struct guild *g;
- if( (g=guild->search(guild_id))==NULL)
- return 0;
- clif->guild_message(g,account_id,mes,len);
- return 0;
-}
-
-/*====================================================
* Member changing position in guild
*---------------------------------------------------*/
static int guild_change_memberposition(int guild_id, int account_id, int char_id, short idx)
@@ -2480,7 +2469,6 @@ void guild_defaults(void)
guild->change_emblem = guild_change_emblem;
guild->emblem_changed = guild_emblem_changed;
guild->send_message = guild_send_message;
- guild->recv_message = guild_recv_message;
guild->send_dot_remove = guild_send_dot_remove;
guild->skillupack = guild_skillupack;
guild->dobreak = guild_break;
diff --git a/src/map/guild.h b/src/map/guild.h
index 40209b988..d0374103f 100644
--- a/src/map/guild.h
+++ b/src/map/guild.h
@@ -136,7 +136,6 @@ struct guild_interface {
int (*change_emblem) (struct map_session_data *sd,int len,const char *data);
int (*emblem_changed) (int len,int guild_id,int emblem_id,const char *data);
int (*send_message) (struct map_session_data *sd, const char *mes);
- int (*recv_message) (int guild_id,int account_id,const char *mes,int len);
int (*send_dot_remove) (struct map_session_data *sd);
int (*skillupack) (int guild_id,uint16 skill_id,int account_id);
int (*dobreak) (struct map_session_data *sd, const char *name);
diff --git a/src/map/intif.c b/src/map/intif.c
index e25f56b63..5a62f9644 100644
--- a/src/map/intif.c
+++ b/src/map/intif.c
@@ -153,158 +153,6 @@ static int intif_rename(struct map_session_data *sd, int type, const char *name)
return 0;
}
-// GM Send a message
-static int intif_broadcast(const char *mes, int len, int type)
-{
- int lp = (type&BC_COLOR_MASK) ? 4 : 0;
-
- nullpo_ret(mes);
- Assert_ret(len < 32000);
- // Send to the local players
- clif->broadcast(NULL, mes, len, type, ALL_CLIENT);
-
- if (intif->CheckForCharServer())
- return 0;
-
- if (chrif->other_mapserver_count < 1)
- return 0; //No need to send.
-
- WFIFOHEAD(inter_fd, 16 + lp + len);
- WFIFOW(inter_fd,0) = 0x3000;
- WFIFOW(inter_fd,2) = 16 + lp + len;
- WFIFOL(inter_fd,4) = 0xFF000000; // 0xFF000000 color signals standard broadcast
- WFIFOW(inter_fd,8) = 0; // fontType not used with standard broadcast
- WFIFOW(inter_fd,10) = 0; // fontSize not used with standard broadcast
- WFIFOW(inter_fd,12) = 0; // fontAlign not used with standard broadcast
- WFIFOW(inter_fd,14) = 0; // fontY not used with standard broadcast
- if (type&BC_BLUE)
- WFIFOL(inter_fd,16) = 0x65756c62; //If there's "blue" at the beginning of the message, game client will display it in blue instead of yellow.
- else if (type&BC_WOE)
- WFIFOL(inter_fd,16) = 0x73737373; //If there's "ssss", game client will recognize message as 'WoE broadcast'.
- memcpy(WFIFOP(inter_fd,16 + lp), mes, len);
- WFIFOSET(inter_fd, WFIFOW(inter_fd,2));
- return 0;
-}
-
-static int intif_broadcast2(const char *mes, int len, unsigned int fontColor, short fontType, short fontSize, short fontAlign, short fontY)
-{
- nullpo_ret(mes);
- Assert_ret(len < 32000);
- // Send to the local players
- clif->broadcast2(NULL, mes, len, fontColor, fontType, fontSize, fontAlign, fontY, ALL_CLIENT);
-
- if (intif->CheckForCharServer())
- return 0;
-
- if (chrif->other_mapserver_count < 1)
- return 0; //No need to send.
-
- WFIFOHEAD(inter_fd, 16 + len);
- WFIFOW(inter_fd,0) = 0x3000;
- WFIFOW(inter_fd,2) = 16 + len;
- WFIFOL(inter_fd,4) = fontColor;
- WFIFOW(inter_fd,8) = fontType;
- WFIFOW(inter_fd,10) = fontSize;
- WFIFOW(inter_fd,12) = fontAlign;
- WFIFOW(inter_fd,14) = fontY;
- memcpy(WFIFOP(inter_fd,16), mes, len);
- WFIFOSET(inter_fd, WFIFOW(inter_fd,2));
- return 0;
-}
-
-/// send a message using the main chat system
-/// <sd> the source of message
-/// <message> the message that was sent
-static int intif_main_message(struct map_session_data *sd, const char *message)
-{
- char output[256];
-
- nullpo_ret(sd);
- nullpo_ret(message);
-
- // format the message for main broadcasting
- snprintf( output, sizeof(output), msg_txt(386), sd->status.name, message );
-
- // send the message using the inter-server broadcast service
- intif->broadcast2(output, (int)strlen(output) + 1, 0xFE000000, 0, 0, 0, 0);
-
- // log the chat message
- logs->chat( LOG_CHAT_MAINCHAT, 0, sd->status.char_id, sd->status.account_id, mapindex_id2name(sd->mapindex), sd->bl.x, sd->bl.y, NULL, message );
-
- return 0;
-}
-
-// The transmission of Wisp/Page to inter-server (player not found on this server)
-static int intif_wis_message(struct map_session_data *sd, const char *nick, const char *mes, int mes_len)
-{
- if (intif->CheckForCharServer())
- return 0;
- nullpo_ret(sd);
- nullpo_ret(nick);
- nullpo_ret(mes);
-
- if (chrif->other_mapserver_count < 1) {
- //Character not found.
- clif->wis_end(sd->fd, 1);
- return 0;
- }
-
- WFIFOHEAD(inter_fd,mes_len + 52);
- WFIFOW(inter_fd,0) = 0x3001;
- WFIFOW(inter_fd,2) = mes_len + 52;
- memcpy(WFIFOP(inter_fd,4), sd->status.name, NAME_LENGTH);
- memcpy(WFIFOP(inter_fd,4+NAME_LENGTH), nick, NAME_LENGTH);
- memcpy(WFIFOP(inter_fd,4+2*NAME_LENGTH), mes, mes_len);
- WFIFOSET(inter_fd, WFIFOW(inter_fd,2));
-
- if (battle_config.etc_log)
- ShowInfo("intif_wis_message from %s to %s (message: '%s')\n", sd->status.name, nick, mes);
-
- return 0;
-}
-
-// The reply of Wisp/page
-static int intif_wis_replay(int id, int flag)
-{
- if (intif->CheckForCharServer())
- return 0;
- WFIFOHEAD(inter_fd,7);
- WFIFOW(inter_fd,0) = 0x3002;
- WFIFOL(inter_fd,2) = id;
- WFIFOB(inter_fd,6) = flag; // flag: 0: success to send whisper, 1: target character is not logged in?, 2: ignored by target
- WFIFOSET(inter_fd,7);
-
- if (battle_config.etc_log)
- ShowInfo("intif_wis_replay: id: %d, flag:%d\n", id, flag);
-
- return 0;
-}
-
-// The transmission of GM only Wisp/Page from server to inter-server
-static int intif_wis_message_to_gm(char *wisp_name, int permission, char *mes)
-{
- int mes_len;
- if (intif->CheckForCharServer())
- return 0;
- nullpo_ret(wisp_name);
- nullpo_ret(mes);
- mes_len = (int)strlen(mes) + 1; // + null
- Assert_ret(mes_len > 0 && mes_len <= INT16_MAX - 32);
-
- WFIFOHEAD(inter_fd, mes_len + 32);
- WFIFOW(inter_fd,0) = 0x3003;
- WFIFOW(inter_fd,2) = mes_len + 32;
- memcpy(WFIFOP(inter_fd,4), wisp_name, NAME_LENGTH);
- WFIFOL(inter_fd,4+NAME_LENGTH) = permission;
- memcpy(WFIFOP(inter_fd,8+NAME_LENGTH), mes, mes_len);
- WFIFOSET(inter_fd, WFIFOW(inter_fd,2));
-
- if (battle_config.etc_log)
- ShowNotice("intif_wis_message_to_gm: from: '%s', required permission: %d, message: '%s'.\n", wisp_name, permission, mes);
-
- return 0;
-}
-
//Request for saving registry values.
static int intif_saveregistry(struct map_session_data *sd)
{
@@ -714,27 +562,6 @@ static int intif_break_party(int party_id)
return 0;
}
-// Sending party chat
-static int intif_party_message(int party_id, int account_id, const char *mes, int len)
-{
- if (intif->CheckForCharServer())
- return 0;
-
- if (chrif->other_mapserver_count < 1)
- return 0; //No need to send.
-
- nullpo_ret(mes);
- Assert_ret(len > 0 && len < 32000);
- WFIFOHEAD(inter_fd,len + 12);
- WFIFOW(inter_fd,0)=0x3027;
- WFIFOW(inter_fd,2)=len+12;
- WFIFOL(inter_fd,4)=party_id;
- WFIFOL(inter_fd,8)=account_id;
- memcpy(WFIFOP(inter_fd,12),mes,len);
- WFIFOSET(inter_fd,len+12);
- return 0;
-}
-
// Request a new leader for party
static int intif_party_leaderchange(int party_id, int account_id, int char_id)
{
@@ -931,28 +758,6 @@ static int intif_guild_break(int guild_id)
return 0;
}
-// Send a guild message
-static int intif_guild_message(int guild_id, int account_id, const char *mes, int len)
-{
- if (intif->CheckForCharServer())
- return 0;
-
- if (chrif->other_mapserver_count < 1)
- return 0; //No need to send.
-
- nullpo_ret(mes);
- Assert_ret(len > 0 && len < 32000);
- WFIFOHEAD(inter_fd, len + 12);
- WFIFOW(inter_fd,0)=0x3037;
- WFIFOW(inter_fd,2)=len+12;
- WFIFOL(inter_fd,4)=guild_id;
- WFIFOL(inter_fd,8)=account_id;
- memcpy(WFIFOP(inter_fd,12),mes,len);
- WFIFOSET(inter_fd,len+12);
-
- return 0;
-}
-
/**
* Requests to change a basic guild information, it is parsed via mapif_parse_GuildBasicInfoChange
* To see the information types that can be changed see mmo.h::guild_basic_info
@@ -1166,98 +971,6 @@ static int intif_homunculus_requestdelete(int homun_id)
//-----------------------------------------------------------------
// Packets receive from inter server
-// Wisp/Page reception // rewritten by [Yor]
-static void intif_parse_WisMessage(int fd)
-{
- struct map_session_data* sd;
- const char *wisp_source;
- char name[NAME_LENGTH];
- int id, i;
-
- id=RFIFOL(fd,4);
-
- safestrncpy(name, RFIFOP(fd,32), NAME_LENGTH);
- sd = map->nick2sd(name);
- if(sd == NULL || strcmp(sd->status.name, name) != 0) {
- //Not found
- intif_wis_replay(id,1);
- return;
- }
- if(sd->state.ignoreAll) {
- intif_wis_replay(id, 2);
- return;
- }
- wisp_source = RFIFOP(fd,8); // speed up [Yor]
- for(i=0; i < MAX_IGNORE_LIST &&
- sd->ignore[i].name[0] != '\0' &&
- strcmp(sd->ignore[i].name, wisp_source) != 0
- ; i++);
-
- if (i < MAX_IGNORE_LIST && sd->ignore[i].name[0] != '\0') {
- //Ignored
- intif_wis_replay(id, 2);
- return;
- }
- //Success to send whisper.
- clif->wis_message(sd->fd, wisp_source, RFIFOP(fd,56),RFIFOW(fd,2)-57);
- intif_wis_replay(id,0); // success
-}
-
-// Wisp/page transmission result reception
-static void intif_parse_WisEnd(int fd)
-{
- struct map_session_data* sd;
- const char *playername = RFIFOP(fd, 2);
-
- if (battle_config.etc_log)
- ShowInfo("intif_parse_wisend: player: %s, flag: %d\n", playername, RFIFOB(fd,26)); // flag: 0: success to send whisper, 1: target character is not logged in?, 2: ignored by target
- sd = map->nick2sd(playername);
- if (sd != NULL)
- clif->wis_end(sd->fd, RFIFOB(fd,26));
-
- return;
-}
-
-static int intif_parse_WisToGM_sub(struct map_session_data *sd, va_list va)
-{
- int permission = va_arg(va, int);
- char *wisp_name;
- char *message;
- int len;
-
- nullpo_ret(sd);
- if (!pc_has_permission(sd, permission))
- return 0;
- wisp_name = va_arg(va, char*);
- message = va_arg(va, char*);
- len = va_arg(va, int);
- clif->wis_message(sd->fd, wisp_name, message, len);
- return 1;
-}
-
-// Received wisp message from map-server via char-server for ALL gm
-// 0x3003/0x3803 <packet_len>.w <wispname>.24B <permission>.l <message>.?B
-static void intif_parse_WisToGM(int fd)
-{
- int permission, mes_len;
- char Wisp_name[NAME_LENGTH];
- char mbuf[255] = { 0 };
- char *message;
-
- mes_len = RFIFOW(fd,2) - 33; // Length not including the NUL terminator
- Assert_retv(mes_len > 0 && mes_len < 32000);
- message = (mes_len >= 255 ? aMalloc(mes_len + 1) : mbuf);
-
- permission = RFIFOL(fd,28);
- safestrncpy(Wisp_name, RFIFOP(fd,4), NAME_LENGTH);
- safestrncpy(message, RFIFOP(fd,32), mes_len + 1);
- // information is sent to all online GM
- map->foreachpc(intif->pWisToGM_sub, permission, Wisp_name, message, mes_len);
-
- if (message != mbuf)
- aFree(message);
-}
-
// Request player registre
static void intif_parse_Registers(int fd)
{
@@ -1464,12 +1177,6 @@ static void intif_parse_PartyMove(int fd)
party->recv_movemap(RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10),RFIFOW(fd,14),RFIFOB(fd,16),RFIFOW(fd,17));
}
-// ACK party messages
-static void intif_parse_PartyMessage(int fd)
-{
- party->recv_message(RFIFOL(fd,4), RFIFOL(fd,8), RFIFOP(fd,12), RFIFOW(fd,2)-12);
-}
-
// ACK guild creation
static void intif_parse_GuildCreated(int fd)
{
@@ -1619,12 +1326,6 @@ static void intif_parse_GuildEmblem(int fd)
guild->emblem_changed(RFIFOW(fd,2)-12, RFIFOL(fd,4), RFIFOL(fd,8), RFIFOP(fd,12));
}
-// ACK guild message
-static void intif_parse_GuildMessage(int fd)
-{
- guild->recv_message(RFIFOL(fd,4), RFIFOL(fd,8), RFIFOP(fd,12), RFIFOW(fd,2)-12);
-}
-
// Reply guild castle data request
static void intif_parse_GuildCastleDataLoad(int fd)
{
@@ -2915,15 +2616,6 @@ static int intif_parse(int fd)
}
// Processing branch
switch(cmd){
- case 0x3800:
- if (RFIFOL(fd,4) == 0xFF000000) //Normal announce.
- clif->broadcast(NULL, RFIFOP(fd,16), packet_len-16, BC_DEFAULT, ALL_CLIENT);
- else //Color announce.
- clif->broadcast2(NULL, RFIFOP(fd,16), packet_len-16, RFIFOL(fd,4), RFIFOW(fd,8), RFIFOW(fd,10), RFIFOW(fd,12), RFIFOW(fd,14), ALL_CLIENT);
- break;
- case 0x3801: intif->pWisMessage(fd); break;
- case 0x3802: intif->pWisEnd(fd); break;
- case 0x3803: intif->pWisToGM(fd); break;
case 0x3804: intif->pRegisters(fd); break;
case 0x3805: intif->pAccountStorage(fd); break;
case 0x3806: intif->pChangeNameOk(fd); break;
@@ -2939,14 +2631,12 @@ static int intif_parse(int fd)
case 0x3824: intif->pPartyMemberWithdraw(fd); break;
case 0x3825: intif->pPartyMove(fd); break;
case 0x3826: intif->pPartyBroken(fd); break;
- case 0x3827: intif->pPartyMessage(fd); break;
case 0x3830: intif->pGuildCreated(fd); break;
case 0x3831: intif->pGuildInfo(fd); break;
case 0x3832: intif->pGuildMemberAdded(fd); break;
case 0x3834: intif->pGuildMemberWithdraw(fd); break;
case 0x3835: intif->pGuildMemberInfoShort(fd); break;
case 0x3836: intif->pGuildBroken(fd); break;
- case 0x3837: intif->pGuildMessage(fd); break;
case 0x3839: intif->pGuildBasicInfoChanged(fd); break;
case 0x383a: intif->pGuildMemberInfoChanged(fd); break;
case 0x383b: intif->pGuildPosition(fd); break;
@@ -3028,10 +2718,10 @@ static int intif_parse(int fd)
void intif_defaults(void)
{
const int packet_len_table [INTIF_PACKET_LEN_TABLE_SIZE] = {
- -1,-1,27,-1, -1,-1,37,-1, 7, 0, 0, 0, 0, 0, 0, 0, //0x3800-0x380f
+ 0, 0, 0, 0, -1,-1,37,-1, 7, 0, 0, 0, 0, 0, 0, 0, //0x3800-0x380f
-1, 0, 0, 0, 0, 0, 0, 0, -1,11, 0, 0, 0, 0, 0, 0, //0x3810 Achievements [Smokexyz/Hercules]
- 39,-1,15,15, 14,19, 7,-1, 0, 0, 0, 0, 0, 0, 0, 0, //0x3820
- 10,-1,15, 0, 79,25, 7,-1, 0,-1,-1,-1, 14,67,186,-1, //0x3830
+ 39,-1,15,15, 14,19, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, //0x3820
+ 10,-1,15, 0, 79,25, 7, 0, 0,-1,-1,-1, 14,67,186,-1, //0x3830
-1, 0, 0,14, 0, 0, 0, 0, -1,74,-1,11, 11,-1, 0, 0, //0x3840
-1,-1, 7, 7, 7,11, 8, 0, 10, 0, 0, 0, 0, 0, 0, 0, //0x3850 Auctions [Zephyrus] itembound[Akinari] Clan System[Murilo BiO]
-1, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //0x3860 Quests [Kevin] [Inkfish]
@@ -3048,11 +2738,6 @@ void intif_defaults(void)
/* funcs */
intif->parse = intif_parse;
intif->create_pet = intif_create_pet;
- intif->broadcast = intif_broadcast;
- intif->broadcast2 = intif_broadcast2;
- intif->main_message = intif_main_message;
- intif->wis_message = intif_wis_message;
- intif->wis_message_to_gm = intif_wis_message_to_gm;
intif->saveregistry = intif_saveregistry;
intif->request_registry = intif_request_registry;
intif->request_account_storage = intif_request_account_storage;
@@ -3066,7 +2751,6 @@ void intif_defaults(void)
intif->party_leave = intif_party_leave;
intif->party_changemap = intif_party_changemap;
intif->break_party = intif_break_party;
- intif->party_message = intif_party_message;
intif->party_leaderchange = intif_party_leaderchange;
intif->guild_create = intif_guild_create;
intif->guild_request_info = intif_guild_request_info;
@@ -3074,7 +2758,6 @@ void intif_defaults(void)
intif->guild_leave = intif_guild_leave;
intif->guild_memberinfoshort = intif_guild_memberinfoshort;
intif->guild_break = intif_guild_break;
- intif->guild_message = intif_guild_message;
intif->guild_change_gm = intif_guild_change_gm;
intif->guild_change_basicinfo = intif_guild_change_basicinfo;
intif->guild_change_memberinfo = intif_guild_change_memberinfo;
@@ -3138,10 +2821,6 @@ void intif_defaults(void)
intif->achievements_request = intif_achievements_request;
intif->achievements_save = intif_achievements_save;
/* parse functions */
- intif->pWisMessage = intif_parse_WisMessage;
- intif->pWisEnd = intif_parse_WisEnd;
- intif->pWisToGM_sub = intif_parse_WisToGM_sub;
- intif->pWisToGM = intif_parse_WisToGM;
intif->pRegisters = intif_parse_Registers;
intif->pChangeNameOk = intif_parse_ChangeNameOk;
intif->pMessageToFD = intif_parse_MessageToFD;
@@ -3156,14 +2835,12 @@ void intif_defaults(void)
intif->pPartyMemberWithdraw = intif_parse_PartyMemberWithdraw;
intif->pPartyMove = intif_parse_PartyMove;
intif->pPartyBroken = intif_parse_PartyBroken;
- intif->pPartyMessage = intif_parse_PartyMessage;
intif->pGuildCreated = intif_parse_GuildCreated;
intif->pGuildInfo = intif_parse_GuildInfo;
intif->pGuildMemberAdded = intif_parse_GuildMemberAdded;
intif->pGuildMemberWithdraw = intif_parse_GuildMemberWithdraw;
intif->pGuildMemberInfoShort = intif_parse_GuildMemberInfoShort;
intif->pGuildBroken = intif_parse_GuildBroken;
- intif->pGuildMessage = intif_parse_GuildMessage;
intif->pGuildBasicInfoChanged = intif_parse_GuildBasicInfoChanged;
intif->pGuildMemberInfoChanged = intif_parse_GuildMemberInfoChanged;
intif->pGuildPosition = intif_parse_GuildPosition;
diff --git a/src/map/intif.h b/src/map/intif.h
index 8df669217..ffac4a1c9 100644
--- a/src/map/intif.h
+++ b/src/map/intif.h
@@ -60,11 +60,6 @@ struct intif_interface {
int (*parse) (int fd);
int (*create_pet)(int account_id, int char_id, int pet_type, int pet_lv, int pet_egg_id,
int pet_equip, short intimate, short hungry, char rename_flag, char incubate, char *pet_name);
- int (*broadcast) (const char *mes, int len, int type);
- int (*broadcast2) (const char *mes, int len, unsigned int fontColor, short fontType, short fontSize, short fontAlign, short fontY);
- int (*main_message) (struct map_session_data* sd, const char* message);
- int (*wis_message) (struct map_session_data *sd, const char *nick, const char *mes, int mes_len);
- int (*wis_message_to_gm) (char *Wisp_name, int permission, char *mes);
int (*saveregistry) (struct map_session_data *sd);
int (*request_registry) (struct map_session_data *sd, int flag);
void (*request_account_storage) (const struct map_session_data *sd);
@@ -78,7 +73,6 @@ struct intif_interface {
int (*party_leave) (int party_id,int account_id, int char_id);
int (*party_changemap) (struct map_session_data *sd, int online);
int (*break_party) (int party_id);
- int (*party_message) (int party_id, int account_id, const char *mes,int len);
int (*party_leaderchange) (int party_id,int account_id,int char_id);
int (*guild_create) (const char *name, const struct guild_member *master);
int (*guild_request_info) (int guild_id);
@@ -86,7 +80,6 @@ struct intif_interface {
int (*guild_leave) (int guild_id, int account_id, int char_id, int flag, const char *mes);
int (*guild_memberinfoshort) (int guild_id, int account_id, int char_id, int online, int lv, int class);
int (*guild_break) (int guild_id);
- int (*guild_message) (int guild_id, int account_id, const char *mes, int len);
int (*guild_change_gm) (int guild_id, const char *name, int len);
int (*guild_change_basicinfo) (int guild_id, int type, const void *data, int len);
int (*guild_change_memberinfo) (int guild_id, int account_id, int char_id, int type, const void *data, int len);
@@ -151,10 +144,6 @@ struct intif_interface {
void(*achievements_request) (struct map_session_data *sd);
void(*achievements_save) (struct map_session_data *sd);
/* */
- void (*pWisMessage) (int fd);
- void (*pWisEnd) (int fd);
- int (*pWisToGM_sub) (struct map_session_data* sd,va_list va);
- void (*pWisToGM) (int fd);
void (*pRegisters) (int fd);
void (*pAccountStorage) (int fd);
void (*pChangeNameOk) (int fd);
@@ -169,14 +158,12 @@ struct intif_interface {
void (*pPartyMemberWithdraw) (int fd);
void (*pPartyMove) (int fd);
void (*pPartyBroken) (int fd);
- void (*pPartyMessage) (int fd);
void (*pGuildCreated) (int fd);
void (*pGuildInfo) (int fd);
void (*pGuildMemberAdded) (int fd);
void (*pGuildMemberWithdraw) (int fd);
void (*pGuildMemberInfoShort) (int fd);
void (*pGuildBroken) (int fd);
- void (*pGuildMessage) (int fd);
void (*pGuildBasicInfoChanged) (int fd);
void (*pGuildMemberInfoChanged) (int fd);
void (*pGuildPosition) (int fd);
diff --git a/src/map/party.c b/src/map/party.c
index dc330d92d..9fbe915f3 100644
--- a/src/map/party.c
+++ b/src/map/party.c
@@ -886,17 +886,20 @@ static int party_send_logout(struct map_session_data *sd)
static int party_send_message(struct map_session_data *sd, const char *mes)
{
- int len;
-
nullpo_ret(sd);
nullpo_ret(mes);
- len = (int)strlen(mes);
-
if (sd->status.party_id == 0)
return 0;
- intif->party_message(sd->status.party_id, sd->status.account_id, mes, len);
- party->recv_message(sd->status.party_id, sd->status.account_id, mes, len);
+
+ struct party_data *p = party->search(sd->status.party_id);
+
+ if (p == NULL)
+ return 0;
+
+ int len = (int)strlen(mes);
+
+ clif->party_message(p, sd->status.account_id, mes, len);
// Chat logging type 'P' / Party Chat
logs->chat(LOG_CHAT_PARTY, sd->status.party_id, sd->status.char_id, sd->status.account_id, mapindex_id2name(sd->mapindex), sd->bl.x, sd->bl.y, NULL, mes);
@@ -904,15 +907,6 @@ static int party_send_message(struct map_session_data *sd, const char *mes)
return 0;
}
-static int party_recv_message(int party_id, int account_id, const char *mes, int len)
-{
- struct party_data *p;
- if( (p=party->search(party_id))==NULL)
- return 0;
- clif->party_message(p,account_id,mes,len);
- return 0;
-}
-
static int party_skill_check(struct map_session_data *sd, int party_id, uint16 skill_id, uint16 skill_lv)
{
struct party_data *p;
@@ -1532,7 +1526,6 @@ void party_defaults(void)
party->send_levelup = party_send_levelup;
party->send_logout = party_send_logout;
party->send_message = party_send_message;
- party->recv_message = party_recv_message;
party->skill_check = party_skill_check;
party->send_xy_clear = party_send_xy_clear;
party->exp_share = party_exp_share;
diff --git a/src/map/party.h b/src/map/party.h
index 28e16dff7..1831da414 100644
--- a/src/map/party.h
+++ b/src/map/party.h
@@ -118,7 +118,6 @@ struct party_interface {
void (*send_levelup) (struct map_session_data *sd);
int (*send_logout) (struct map_session_data *sd);
int (*send_message) (struct map_session_data *sd, const char *mes);
- int (*recv_message) (int party_id,int account_id,const char *mes,int len);
int (*skill_check) (struct map_session_data *sd, int party_id, uint16 skill_id, uint16 skill_lv);
int (*send_xy_clear) (struct party_data *p);
int (*exp_share) (struct party_data *p,struct block_list *src,unsigned int base_exp,unsigned int job_exp,int zeny);
diff --git a/src/map/pc.c b/src/map/pc.c
index 1e7ac5817..24f71f47b 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -10990,7 +10990,7 @@ static int map_day_timer(int tid, int64 tick, int id, intptr_t data)
map->night_flag = 0; // 0=day, 1=night [Yor]
map->foreachpc(pc->daynight_timer_sub);
safestrncpy(tmp_soutput, (data == 0) ? msg_txt(502) : msg_txt(60), sizeof(tmp_soutput)); // The day has arrived!
- intif->broadcast(tmp_soutput, (int)strlen(tmp_soutput) + 1, BC_DEFAULT);
+ clif->broadcast(NULL, tmp_soutput, (int)strlen(tmp_soutput) + 1, BC_DEFAULT, ALL_CLIENT);
return 0;
}
@@ -11011,7 +11011,7 @@ static int map_night_timer(int tid, int64 tick, int id, intptr_t data)
map->night_flag = 1; // 0=day, 1=night [Yor]
map->foreachpc(pc->daynight_timer_sub);
safestrncpy(tmp_soutput, (data == 0) ? msg_txt(503) : msg_txt(59), sizeof(tmp_soutput)); // The night has fallen...
- intif->broadcast(tmp_soutput, (int)strlen(tmp_soutput) + 1, BC_DEFAULT);
+ clif->broadcast(NULL, tmp_soutput, (int)strlen(tmp_soutput) + 1, BC_DEFAULT, ALL_CLIENT);
return 0;
}
@@ -12311,6 +12311,54 @@ static void pc_check_supernovice_call(struct map_session_data *sd, const char *m
}
}
+/**
+ * Sends a message t all online GMs having the specified permission.
+ *
+ * @param sender_name Sender character name.
+ * @param permission The required permission to receive this message.
+ * @param message The message body.
+ *
+ * @return The amount of characters the message was delivered to.
+ */
+// The transmission of GM only Wisp/Page from server to inter-server
+static int pc_wis_message_to_gm(const char *sender_name, int permission, const char *message)
+{
+ nullpo_ret(sender_name);
+ nullpo_ret(message);
+ int mes_len = (int)strlen(message) + 1; // + null
+ int count = 0;
+
+ // information is sent to all online GM
+ map->foreachpc(pc->wis_message_to_gm_sub, permission, sender_name, message, mes_len, &count);
+
+ return count;
+}
+
+/**
+ * Helper function for pc_wis_message_to_gm().
+ */
+static int pc_wis_message_to_gm_sub(struct map_session_data *sd, va_list va)
+{
+ nullpo_ret(sd);
+
+ int permission = va_arg(va, int);
+ if (!pc_has_permission(sd, permission))
+ return 0;
+
+ const char *sender_name = va_arg(va, const char *);
+ const char *message = va_arg(va, const char *);
+ int len = va_arg(va, int);
+ int *count = va_arg(va, int *);
+
+ nullpo_ret(sender_name);
+ nullpo_ret(message);
+ nullpo_ret(count);
+
+ clif->wis_message(sd->fd, sender_name, message, len);
+ ++*count;
+ return 1;
+}
+
static void pc_update_job_and_level(struct map_session_data *sd)
{
nullpo_retv(sd);
@@ -12758,6 +12806,8 @@ void pc_defaults(void)
pc->check_supernovice_call = pc_check_supernovice_call;
pc->process_chat_message = pc_process_chat_message;
+ pc->wis_message_to_gm = pc_wis_message_to_gm;
+ pc->wis_message_to_gm_sub = pc_wis_message_to_gm_sub;
/**
* Autotrade persistency [Ind/Hercules <3]
diff --git a/src/map/pc.h b/src/map/pc.h
index 0770e13cb..8df02a891 100644
--- a/src/map/pc.h
+++ b/src/map/pc.h
@@ -1186,6 +1186,8 @@ END_ZEROED_BLOCK; /* End */
int (*have_magnifier) (struct map_session_data *sd);
bool (*process_chat_message) (struct map_session_data *sd, const char *message);
+ int (*wis_message_to_gm) (const char *sender_name, int permission, const char *message);
+ int (*wis_message_to_gm_sub) (struct map_session_data *sd, va_list va);
void (*check_supernovice_call) (struct map_session_data *sd, const char *message);
bool (*check_basicskill) (struct map_session_data *sd, int level);
bool (*isDeathPenaltyJob) (uint16 job);
diff --git a/src/map/script.c b/src/map/script.c
index c3e884bb4..4fc47e039 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -11914,12 +11914,12 @@ static BUILDIN(announce)
int fontAlign = script_hasdata(st,7) ? script_getnum(st,7) : 0; // default fontAlign
int fontY = script_hasdata(st,8) ? script_getnum(st,8) : 0; // default fontY
size_t len = strlen(mes);
+ send_target target = ALL_CLIENT;
+ struct block_list *bl = NULL;
Assert_retr(false, len < INT_MAX);
if( flag&(BC_TARGET_MASK|BC_SOURCE_MASK) ) {
// Broadcast source or broadcast region defined
- send_target target;
- struct block_list *bl = NULL;
if (flag&BC_NPC) {
// If bc_npc flag is set, use NPC as broadcast source
bl = map->id2bl(st->oid);
@@ -11937,17 +11937,13 @@ static BUILDIN(announce)
case BC_SELF: target = SELF; break;
default: target = ALL_CLIENT; break; // BC_ALL
}
-
- if (fontColor)
- clif->broadcast2(bl, mes, (int)len+1, (unsigned int)strtoul(fontColor, (char **)NULL, 0), fontType, fontSize, fontAlign, fontY, target);
- else
- clif->broadcast(bl, mes, (int)len+1, flag&BC_COLOR_MASK, target);
- } else {
- if (fontColor)
- intif->broadcast2(mes, (int)len+1, (unsigned int)strtoul(fontColor, (char **)NULL, 0), fontType, fontSize, fontAlign, fontY);
- else
- intif->broadcast(mes, (int)len+1, flag&BC_COLOR_MASK);
}
+
+ if (fontColor)
+ clif->broadcast2(bl, mes, (int)len+1, (unsigned int)strtoul(fontColor, (char **)NULL, 0), fontType, fontSize, fontAlign, fontY, target);
+ else
+ clif->broadcast(bl, mes, (int)len+1, flag&BC_COLOR_MASK, target);
+
return true;
}
/*==========================================
diff --git a/src/map/trade.c b/src/map/trade.c
index 7096d12e4..ff5c04fc3 100644
--- a/src/map/trade.c
+++ b/src/map/trade.c
@@ -226,9 +226,9 @@ static int impossible_trade_check(struct map_session_data *sd)
if (inventory[index].amount < sd->deal.item[i].amount) {
// if more than the player have -> hack
snprintf(message_to_gm, sizeof(message_to_gm), msg_txt(538), sd->status.name, sd->status.account_id); // Hack on trade: character '%s' (account: %d) try to trade more items that he has.
- intif->wis_message_to_gm(map->wisp_server_name, PC_PERM_RECEIVE_HACK_INFO, message_to_gm);
+ pc->wis_message_to_gm(map->wisp_server_name, PC_PERM_RECEIVE_HACK_INFO, message_to_gm);
snprintf(message_to_gm, sizeof(message_to_gm), msg_txt(539), inventory[index].amount, inventory[index].nameid, sd->deal.item[i].amount); // This player has %d of a kind of item (id: %d), and try to trade %d of them.
- intif->wis_message_to_gm(map->wisp_server_name, PC_PERM_RECEIVE_HACK_INFO, message_to_gm);
+ pc->wis_message_to_gm(map->wisp_server_name, PC_PERM_RECEIVE_HACK_INFO, message_to_gm);
// if we block people
if (battle_config.ban_hack_trade < 0) {
chrif->char_ask_name(-1, sd->status.name, CHAR_ASK_NAME_BLOCK, 0, 0, 0, 0, 0, 0);
@@ -245,7 +245,7 @@ static int impossible_trade_check(struct map_session_data *sd)
// message about the ban
safestrncpy(message_to_gm, msg_txt(508), sizeof(message_to_gm)); // This player hasn't been banned (Ban option is disabled).
- intif->wis_message_to_gm(map->wisp_server_name, PC_PERM_RECEIVE_HACK_INFO, message_to_gm);
+ pc->wis_message_to_gm(map->wisp_server_name, PC_PERM_RECEIVE_HACK_INFO, message_to_gm);
return 1;
}
inventory[index].amount -= sd->deal.item[i].amount; // remove item from inventory