Skip to content

Commit

Permalink
Implemented official mute system. Thanks to:
Browse files Browse the repository at this point in the history
Ai4rei/Mirei for the code;
kyeme for suggesting it;
Napster for updating the patch.

Signed-off-by: Matheus Macabu <mkbu95@gmail.com>
  • Loading branch information
macabu committed Jul 4, 2013
1 parent e8adea6 commit da064c0
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 7 deletions.
6 changes: 6 additions & 0 deletions conf/battle/client.conf
Expand Up @@ -112,3 +112,9 @@ client_reshuffle_dice: yes
// Official servers do not sort storage. (Note 1)
// NOTE: Enabling this option degrades performance.
client_sort_storage: no

// Duration of client's self mute in minutes.
// Note: Do not enable this, if you enabled commands for players,
// because the client sees multiple commands in succession as spam.
// Default: 0 (means disabled)
client_accept_chatdori: 1

This comment has been minimized.

Copy link
@EPuncker

EPuncker Jul 8, 2013

Contributor

if the comment says that the default is 0 why it is set to 1?

1 change: 1 addition & 0 deletions src/map/battle.c
Expand Up @@ -6461,6 +6461,7 @@ static const struct _battle_data {
{ "item_enabled_npc", &battle_config.item_enabled_npc, 1, 0, 1, },
{ "gm_ignore_warpable_area", &battle_config.gm_ignore_warpable_area, 0, 2, 100, },
{ "packet_obfuscation", &battle_config.packet_obfuscation, 1, 0, 3, },
{ "client_accept_chatdori", &battle_config.client_accept_chatdori, 0, 0, 1, },
};
#ifndef STATS_OPT_OUT
/**
Expand Down
2 changes: 2 additions & 0 deletions src/map/battle.h
Expand Up @@ -452,6 +452,8 @@ struct Battle_Config {

int gm_ignore_warpable_area;

int client_accept_chatdori; // [Ai4rei/Mirei]

} battle_config;


Expand Down
42 changes: 35 additions & 7 deletions src/map/clif.c
Expand Up @@ -13412,14 +13412,42 @@ void clif_parse_GMReqNoChat(int fd,struct map_session_data *sd)
if( type == 0 )
value = -value;

//If type is 2 and the ids don't match, this is a crafted hacked packet!
//Disabled because clients keep self-muting when you give players public @ commands... [Skotlex]
if (type == 2 /* && (pc->get_group_level(sd) > 0 || sd->bl.id != id)*/)
return;
if (type == 2)
{
if (!battle_config.client_accept_chatdori)
return;
if (pc->get_group_level(sd) > 0 || sd->bl.id != id)
return;

dstsd = iMap->id2sd(id);
if( dstsd == NULL )
return;
dstsd = sd;
}
else
{
dstsd = iMap->id2sd(id);
if( dstsd == NULL )
return;
}

if (type == 2 || ( (pc->get_group_level(sd)) > pc->get_group_level(dstsd) && !pc->can_use_command(sd, "@mute")))
{
clif->manner_message(sd, 0);
clif->manner_message(dstsd, 5);

if (dstsd->status.manner < value)
{
dstsd->status.manner -= value;
sc_start(&dstsd->bl,SC_NOCHAT,100,0,0);

}
else
{
dstsd->status.manner = 0;
status_change_end(&dstsd->bl, SC_NOCHAT, INVALID_TIMER);
}

if( type != 2 )
clif->GM_silence(sd, dstsd, type);
}

sprintf(command, "%cmute %d %s", atcommand->at_symbol, value, dstsd->status.name);
atcommand->parse(fd, sd, command, 1);
Expand Down

0 comments on commit da064c0

Please sign in to comment.