summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--conf/messages.conf34
-rw-r--r--src/map/atcommand.c323
-rw-r--r--src/map/clif.c47
-rw-r--r--src/map/clif.h16
-rw-r--r--src/map/guild.c9
-rw-r--r--src/map/pc.c3
-rw-r--r--src/map/pc.h3
-rw-r--r--src/map/skill.c4
8 files changed, 397 insertions, 42 deletions
diff --git a/conf/messages.conf b/conf/messages.conf
index e21c41176..e1a122fc6 100644
--- a/conf/messages.conf
+++ b/conf/messages.conf
@@ -1452,6 +1452,40 @@
1431: Your global chat is now binded to the '%s' channel
1432: Your global chat is not binded to any channel
1433: Your global chat is now unbinded from the '#%s' channel
+1434: Player '%s' was not found
+1437: Player '%s' has now been banned from '%s' channel
+1438: You cannot join the '%s' channel because you've been banned from it
+1439: Channel '%s' has no banned players
+1440: Player '%s' is not banned from this channel
+1441: Player '%s' has now been unbanned from the '%s' channel
+1442: Removed all bans from '%s' channel
+1443: -- '%s' ban list
+1444: - %s
+1445: - %s (%d)
+1446: You need to input a option
+1447: '%s' is not a known channel option
+1448: -- Available options
+1449: option '%s' is already enabled, if you'd like to disable it type '@channel opt %s 0'
+1450: option '%s' is now enabled for channel '%s'
+1451: value '%d' for option '%s' is out of range (limit is 0-10)
+1452: option '%s' is now enabled for channel '%s' with %d seconds
+1453: option '%s' is now disabled for channel '%s'
+1454: option '%s' is not enabled on channel '%s'
+1455: You're talking too fast!
+1456: -- %s ban <channel name> <character name>
+1457: - bans <character name> from <channel name> channel
+1458: -- %s banlist <channel name>
+1459: - lists all banned characters from <channel name> channel
+1460: -- %s unban <channel name> <character name>
+1461: - unbans <character name> from <channel name> channel
+1462: -- %s setopt <channel name> <option name> <option value>
+1463: - adds or removes <option name> with <option value> to <channel name> channel
+1464: Ban failed, not possible to ban this user.
+1465: Player '%s' is already banned from this channel
+1466: For '%s' you need the amount of seconds (from 0 to 10)
+1467: -- %s unbanall <channel name>
+1468: - unbans everyone from <channel name>
+
//Custom translations
import: conf/import/msg_conf.txt
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index 1c0542066..f3e69ffb7 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -5669,7 +5669,6 @@ ACMD_FUNC(changelook)
* Turns on/off Autotrade for a specific player
*------------------------------------------*/
ACMD_FUNC(autotrade) {
- int i;
nullpo_retr(-1, sd);
if( map[sd->bl.m].flag.autotrade != battle_config.autotrade_mapflag ) {
@@ -5692,22 +5691,7 @@ ACMD_FUNC(autotrade) {
int timeout = atoi(message);
status_change_start(&sd->bl, SC_AUTOTRADE, 10000, 0, 0, 0, 0, ((timeout > 0) ? min(timeout,battle_config.at_timeout) : battle_config.at_timeout) * 60000, 0);
}
-
- if( hChSys.ally && sd->status.guild_id ) {
- struct guild *g = sd->guild, *sg;
- if( g ) {
- if( idb_exists(((struct hChSysCh *)g->channel)->users, sd->status.char_id) )
- clif->chsys_left((struct hChSysCh *)g->channel,sd);
- for (i = 0; i < MAX_GUILDALLIANCE; i++) {
- if( g->alliance[i].guild_id && (sg = guild_search(g->alliance[i].guild_id) ) ) {
- if( idb_exists(((struct hChSysCh *)sg->channel)->users, sd->status.char_id) )
- clif->chsys_left((struct hChSysCh *)sg->channel,sd);
- break;
- }
- }
- }
- }
-
+
clif->chsys_quit(sd);
clif->authfail_fd(sd->fd, 15);
@@ -8883,6 +8867,12 @@ ACMD_FUNC(join) {
}
}
+ if( channel->banned && idb_exists(channel->banned, sd->status.account_id) ) {
+ sprintf(atcmd_output, msg_txt(1438),name); // You cannot join the '%s' channel because you've been banned from it
+ clif->message(fd, atcmd_output);
+ return -1;
+ }
+
if( !( channel->opt & hChSys_OPT_ANNOUNCE_JOIN ) ) {
sprintf(atcmd_output, msg_txt(1403),name); // You're now in the '%s' channel
clif->message(fd, atcmd_output);
@@ -8922,6 +8912,25 @@ static inline void atcmd_channel_help(int fd, const char *command, bool can_crea
sprintf(atcmd_output, msg_txt(1429),command);// -- %s unbind
clif->message(fd, atcmd_output);
clif->message(fd, msg_txt(1430));// - unbinds your global chat from its attached channel (if binded)
+ sprintf(atcmd_output, msg_txt(1429),command);// -- %s unbind
+ clif->message(fd, atcmd_output);
+ if( can_create ) {
+ sprintf(atcmd_output, msg_txt(1456),command);// -- %s ban <channel name> <character name>
+ clif->message(fd, atcmd_output);
+ clif->message(fd, msg_txt(1457));// - bans <character name> from <channel name> channel
+ sprintf(atcmd_output, msg_txt(1458),command);// -- %s banlist <channel name>
+ clif->message(fd, atcmd_output);
+ clif->message(fd, msg_txt(1459));// - lists all banned characters from <channel name> channel
+ sprintf(atcmd_output, msg_txt(1460),command);// -- %s unban <channel name> <character name>
+ clif->message(fd, atcmd_output);
+ clif->message(fd, msg_txt(1461));// - unbans <character name> from <channel name> channel
+ sprintf(atcmd_output, msg_txt(1467),command);// -- %s unbanall <channel name>
+ clif->message(fd, atcmd_output);
+ clif->message(fd, msg_txt(1468));// - unbans everyone from <channel name>
+ sprintf(atcmd_output, msg_txt(1462),command);// -- %s setopt <channel name> <option name> <option value>
+ clif->message(fd, atcmd_output);
+ clif->message(fd, msg_txt(1463));// - adds or removes <option name> with <option value> to <channel name> channel
+ }
}
/* [Ind/Hercules] */
@@ -9086,6 +9095,286 @@ ACMD_FUNC(channel) {
clif->message(fd, atcmd_output);
sd->gcbind = NULL;
+ } else if ( strcmpi(key,"ban") == 0 ) {
+ struct map_session_data *pl_sd = NULL;
+ struct hChSysBanEntry *entry = NULL;
+
+ if( sub1[0] != '#' ) {
+ clif->message(fd, msg_txt(1405));// Channel name must start with a '#'
+ return -1;
+ }
+
+ if( !(channel = strdb_get(clif->channel_db, sub1 + 1)) ) {
+ sprintf(atcmd_output, msg_txt(1407), sub1);// Channel '%s' is not available
+ clif->message(fd, atcmd_output);
+ return -1;
+ }
+
+ if( channel->owner != sd->status.char_id && !pc_has_permission(sd, PC_PERM_HCHSYS_ADMIN) ) {
+ sprintf(atcmd_output, msg_txt(1412), sub1);// You're not the owner of channel '%s'
+ clif->message(fd, atcmd_output);
+ return -1;
+ }
+
+ if( sub2[0] == '\0' || ( pl_sd = map_nick2sd(sub2) ) == NULL ) {
+ sprintf(atcmd_output, msg_txt(1434), sub2);// Player '%s' was not found
+ clif->message(fd, atcmd_output);
+ return -1;
+ }
+
+ if( pc_has_permission(pl_sd, PC_PERM_HCHSYS_ADMIN) ) {
+ clif->message(fd, msg_txt(1464)); // Ban failed, not possible to ban this user.
+ return -1;
+ }
+
+ if( channel->banned && idb_exists(channel->banned,pl_sd->status.account_id) ) {
+ sprintf(atcmd_output, msg_txt(1465), pl_sd->status.name);// Player '%s' is already banned from this channel
+ clif->message(fd, atcmd_output);
+ return -1;
+ }
+
+ if( !channel->banned )
+ channel->banned = idb_alloc(DB_OPT_BASE|DB_OPT_ALLOW_NULL_DATA|DB_OPT_RELEASE_DATA);
+
+ CREATE(entry, struct hChSysBanEntry, 1);
+
+ safestrncpy(entry->name, pl_sd->status.name, NAME_LENGTH);
+
+ idb_put(channel->banned, pl_sd->status.account_id, entry);
+
+ clif->chsys_left(channel,pl_sd);
+
+ sprintf(atcmd_output, msg_txt(1437),pl_sd->status.name,sub1); // Player '%s' has now been banned from '%s' channel
+ clif->message(fd, atcmd_output);
+ } else if ( strcmpi(key,"unban") == 0 ) {
+ struct map_session_data *pl_sd = NULL;
+
+ if( sub1[0] != '#' ) {
+ clif->message(fd, msg_txt(1405));// Channel name must start with a '#'
+ return -1;
+ }
+
+ if( !(channel = strdb_get(clif->channel_db, sub1 + 1)) ) {
+ sprintf(atcmd_output, msg_txt(1407), sub1);// Channel '%s' is not available
+ clif->message(fd, atcmd_output);
+ return -1;
+ }
+
+ if( channel->owner != sd->status.char_id && !pc_has_permission(sd, PC_PERM_HCHSYS_ADMIN) ) {
+ sprintf(atcmd_output, msg_txt(1412), sub1);// You're not the owner of channel '%s'
+ clif->message(fd, atcmd_output);
+ return -1;
+ }
+
+ if( !channel->banned ) {
+ sprintf(atcmd_output, msg_txt(1439), sub1);// Channel '%s' has no banned players
+ clif->message(fd, atcmd_output);
+ return -1;
+ }
+
+ if( sub2[0] == '\0' || ( pl_sd = map_nick2sd(sub2) ) == NULL ) {
+ sprintf(atcmd_output, msg_txt(1434), sub2);// Player '%s' was not found
+ clif->message(fd, atcmd_output);
+ return -1;
+ }
+
+ if( !idb_exists(channel->banned,pl_sd->status.account_id) ) {
+ sprintf(atcmd_output, msg_txt(1440), pl_sd->status.name);// Player '%s' is not banned from this channel
+ clif->message(fd, atcmd_output);
+ return -1;
+ }
+
+ idb_remove(channel->banned, pl_sd->status.account_id);
+
+ if( !db_size(channel->banned) ) {
+ db_destroy(channel->banned);
+ channel->banned = NULL;
+ }
+
+ sprintf(atcmd_output, msg_txt(1441),pl_sd->status.name,sub1); // Player '%s' has now been unbanned from the '%s' channel
+ clif->message(fd, atcmd_output);
+ } else if ( strcmpi(key,"unbanall") == 0 ) {
+ if( sub1[0] != '#' ) {
+ clif->message(fd, msg_txt(1405));// Channel name must start with a '#'
+ return -1;
+ }
+
+ if( !(channel = strdb_get(clif->channel_db, sub1 + 1)) ) {
+ sprintf(atcmd_output, msg_txt(1407), sub1);// Channel '%s' is not available
+ clif->message(fd, atcmd_output);
+ return -1;
+ }
+
+ if( channel->owner != sd->status.char_id && !pc_has_permission(sd, PC_PERM_HCHSYS_ADMIN) ) {
+ sprintf(atcmd_output, msg_txt(1412), sub1);// You're not the owner of channel '%s'
+ clif->message(fd, atcmd_output);
+ return -1;
+ }
+
+ if( !channel->banned ) {
+ sprintf(atcmd_output, msg_txt(1439), sub1);// Channel '%s' has no banned players
+ clif->message(fd, atcmd_output);
+ return -1;
+ }
+
+ db_destroy(channel->banned);
+ channel->banned = NULL;
+
+ sprintf(atcmd_output, msg_txt(1442),sub1); // Removed all bans from '%s' channel
+ clif->message(fd, atcmd_output);
+ } else if ( strcmpi(key,"banlist") == 0 ) {
+ DBIterator *iter = NULL;
+ DBKey key;
+ DBData *data;
+ bool isA = pc_has_permission(sd, PC_PERM_HCHSYS_ADMIN)?true:false;
+ if( sub1[0] != '#' ) {
+ clif->message(fd, msg_txt(1405));// Channel name must start with a '#'
+ return -1;
+ }
+
+ if( !(channel = strdb_get(clif->channel_db, sub1 + 1)) ) {
+ sprintf(atcmd_output, msg_txt(1407), sub1);// Channel '%s' is not available
+ clif->message(fd, atcmd_output);
+ return -1;
+ }
+
+ if( channel->owner != sd->status.char_id && !isA ) {
+ sprintf(atcmd_output, msg_txt(1412), sub1);// You're not the owner of channel '%s'
+ clif->message(fd, atcmd_output);
+ return -1;
+ }
+
+ if( !channel->banned ) {
+ sprintf(atcmd_output, msg_txt(1439), sub1);// Channel '%s' has no banned players
+ clif->message(fd, atcmd_output);
+ return -1;
+ }
+ sprintf(atcmd_output, msg_txt(1443), channel->name);// -- '%s' ban list
+ clif->message(fd, atcmd_output);
+
+ iter = db_iterator(channel->banned);
+
+ for( data = iter->first(iter,&key); iter->exists(iter); data = iter->next(iter,&key) ) {
+ struct hChSysBanEntry * entry = db_data2ptr(data);
+
+ if( !isA )
+ sprintf(atcmd_output, msg_txt(1444), entry->name);// - %s %s
+ else
+ sprintf(atcmd_output, msg_txt(1445), entry->name, key.i);// - %s (%d)
+
+ clif->message(fd, atcmd_output);
+ }
+
+ dbi_destroy(iter);
+
+ } else if ( strcmpi(key,"setopt") == 0 ) {
+ const char* opt_str[3] = {
+ "None",
+ "JoinAnnounce",
+ "MessageDelay",
+ };
+
+ if( sub1[0] != '#' ) {
+ clif->message(fd, msg_txt(1405));// Channel name must start with a '#'
+ return -1;
+ }
+
+ if( !(channel = strdb_get(clif->channel_db, sub1 + 1)) ) {
+ sprintf(atcmd_output, msg_txt(1407), sub1);// Channel '%s' is not available
+ clif->message(fd, atcmd_output);
+ return -1;
+ }
+
+ if( channel->owner != sd->status.char_id && !pc_has_permission(sd, PC_PERM_HCHSYS_ADMIN) ) {
+ sprintf(atcmd_output, msg_txt(1412), sub1);// You're not the owner of channel '%s'
+ clif->message(fd, atcmd_output);
+ return -1;
+ }
+
+ if( sub2[0] == '\0' ) {
+ clif->message(fd, msg_txt(1446));// You need to input a option
+ return -1;
+ }
+
+ for( k = 1; k < 3; k++ ) {
+ if( strcmpi(sub2,opt_str[k]) == 0 )
+ break;
+ }
+
+ if( k == 3 ) {
+ sprintf(atcmd_output, msg_txt(1447), sub2);// '%s' is not a known channel option
+ clif->message(fd, atcmd_output);
+ clif->message(fd, msg_txt(1448)); // -- Available options
+ for( k = 1; k < 3; k++ ) {
+ sprintf(atcmd_output, msg_txt(1444), opt_str[k]);// - '%s'
+ clif->message(fd, atcmd_output);
+ }
+ return -1;
+ }
+
+ if( sub3[0] == '\0' ) {
+ if ( k == hChSys_OPT_MSG_DELAY ) {
+ sprintf(atcmd_output, msg_txt(1466), opt_str[k]);// For '%s' you need the amount of seconds (from 0 to 10)
+ clif->message(fd, atcmd_output);
+ return -1;
+ } else if( channel->opt & k ) {
+ sprintf(atcmd_output, msg_txt(1449), opt_str[k],opt_str[k]); // option '%s' is already enabled, if you'd like to disable it type '@channel setopt %s 0'
+ clif->message(fd, atcmd_output);
+ return -1;
+ } else {
+ channel->opt |= k;
+ sprintf(atcmd_output, msg_txt(1450), opt_str[k],channel->name);//option '%s' is now enabled for channel '%s'
+ clif->message(fd, atcmd_output);
+ return 0;
+ }
+ } else {
+ int v = atoi(sub3);
+ if( k == hChSys_OPT_MSG_DELAY ) {
+ if( v < 0 || v > 10 ) {
+ sprintf(atcmd_output, msg_txt(1451), v, opt_str[k]);// value '%d' for option '%s' is out of range (limit is 0-10)
+ clif->message(fd, atcmd_output);
+ return -1;
+ }
+ if( v == 0 ) {
+ channel->opt &=~ k;
+ channel->msg_delay = 0;
+ sprintf(atcmd_output, msg_txt(1453), opt_str[k],channel->name,v);// option '%s' is now disabled for channel '%s'
+ clif->message(fd, atcmd_output);
+ return 0;
+ } else {
+ channel->opt |= k;
+ channel->msg_delay = v;
+ sprintf(atcmd_output, msg_txt(1452), opt_str[k],channel->name,v);// option '%s' is now enabled for channel '%s' with %d seconds
+ clif->message(fd, atcmd_output);
+ return 0;
+ }
+ } else {
+ if( v ) {
+ if( channel->opt & k ) {
+ sprintf(atcmd_output, msg_txt(1449), opt_str[k],opt_str[k]); // option '%s' is already enabled, if you'd like to disable it type '@channel opt %s 0'
+ clif->message(fd, atcmd_output);
+ return -1;
+ } else {
+ channel->opt |= k;
+ sprintf(atcmd_output, msg_txt(1454), opt_str[k],channel->name);//option '%s' is now enabled for channel '%s'
+ clif->message(fd, atcmd_output);
+ }
+ } else {
+ if( !(channel->opt & k) ) {
+ sprintf(atcmd_output, msg_txt(1454), opt_str[k],channel->name); // option '%s' is not enabled on channel '%s'
+ clif->message(fd, atcmd_output);
+ return -1;
+ } else {
+ channel->opt &=~ k;
+ sprintf(atcmd_output, msg_txt(1453), opt_str[k],channel->name);// option '%s' is now disabled for channel '%s'
+ clif->message(fd, atcmd_output);
+ return 0;
+ }
+ }
+ }
+
+ }
+
} else {
atcmd_channel_help(fd,command,( hChSys.allow_user_channel_creation || pc_has_permission(sd, PC_PERM_HCHSYS_ADMIN) ));
}
diff --git a/src/map/clif.c b/src/map/clif.c
index 109ce7b9e..27223a76e 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -1694,6 +1694,9 @@ void clif_hercules_chsys_create(struct hChSysCh *channel, char *name, char *pass
safestrncpy(channel->pass, pass, HCHSYS_NAME_LENGTH);
channel->opt = hChSys_OPT_BASE;
+ channel->banned = NULL;
+
+ channel->msg_delay = 0;
if( channel->type != hChSys_MAP && channel->type != hChSys_ALLY )
strdb_put(clif->channel_db, channel->name, channel);
@@ -3534,9 +3537,16 @@ void clif_useitemack(struct map_session_data *sd,int index,int amount,bool ok)
}
void clif_hercules_chsys_send(struct hChSysCh *channel, struct map_session_data *sd, char *msg) {
- char message[150];
- snprintf(message, 150, "[ #%s ] %s : %s",channel->name,sd->status.name, msg);
- clif->chsys_msg(channel,sd,message);
+ if( channel->msg_delay != 0 && DIFF_TICK(sd->hchsysch_tick + ( channel->msg_delay * 1000 ), gettick()) > 0 && !pc_has_permission(sd, PC_PERM_HCHSYS_ADMIN) ) {
+ clif->colormes(sd->fd,COLOR_RED,msg_txt(1455));
+ return;
+ } else {
+ char message[150];
+ snprintf(message, 150, "[ #%s ] %s : %s",channel->name,sd->status.name, msg);
+ clif->chsys_msg(channel,sd,message);
+ if( channel->msg_delay != 0 )
+ sd->hchsysch_tick = gettick();
+ }
}
/// Inform client whether chatroom creation was successful or not (ZC_ACK_CREATE_CHATROOM).
@@ -8181,16 +8191,16 @@ void clif_specialeffect_value(struct block_list* bl, int effect_id, int num, sen
}
// Modification of clif_messagecolor to send colored messages to players to chat log only (doesn't display overhead)
/// 02c1 <packet len>.W <id>.L <color>.L <message>.?B
-int clif_colormes(struct map_session_data * sd, enum clif_colors color, const char* msg) {
+int clif_colormes(int fd, enum clif_colors color, const char* msg) {
unsigned short msg_len = strlen(msg) + 1;
- WFIFOHEAD(sd->fd,msg_len + 12);
- WFIFOW(sd->fd,0) = 0x2C1;
- WFIFOW(sd->fd,2) = msg_len + 12;
- WFIFOL(sd->fd,4) = 0;
- WFIFOL(sd->fd,8) = color_table[color];
- safestrncpy((char*)WFIFOP(sd->fd,12), msg, msg_len);
- WFIFOSET(sd->fd, msg_len + 12);
+ WFIFOHEAD(fd,msg_len + 12);
+ WFIFOW(fd,0) = 0x2C1;
+ WFIFOW(fd,2) = msg_len + 12;
+ WFIFOL(fd,4) = 0;
+ WFIFOL(fd,8) = color_table[color];
+ safestrncpy((char*)WFIFOP(fd,12), msg, msg_len);
+ WFIFOSET(fd, msg_len + 12);
return 0;
}
@@ -9037,12 +9047,17 @@ void clif_hercules_chsys_mjoin(struct map_session_data *sd) {
clif->chsys_create(map[sd->bl.m].channel,NULL,NULL,hChSys.local_color);
}
+
+ if( map[sd->bl.m].channel->banned && idb_exists(map[sd->bl.m].channel->banned, sd->status.account_id) ) {
+ return;
+ }
+
clif->chsys_join(map[sd->bl.m].channel,sd);
if( !( map[sd->bl.m].channel->opt & hChSys_OPT_ANNOUNCE_JOIN ) ) {
char mout[60];
sprintf(mout, msg_txt(1435),hChSys.local_name,map[sd->bl.m].name); // You're now in the '#%s' channel for '%s'
- clif->message(sd->fd, mout);
+ clif->colormes(sd->fd, COLOR_DEFAULT, mout);
}
}
@@ -10106,7 +10121,7 @@ void clif_parse_WisMessage(int fd, struct map_session_data* sd)
}
if( k < sd->channel_count ) {
clif->chsys_send(channel,sd,message);
- } else if( channel->pass[0] == '\0' ) {
+ } else if( channel->pass[0] == '\0' && !(channel->banned && idb_exists(channel->banned, sd->status.account_id)) ) {
clif->chsys_join(channel,sd);
clif->chsys_send(channel,sd,message);
} else {
@@ -10356,6 +10371,10 @@ void clif_hercules_chsys_delete(struct hChSysCh *channel) {
}
dbi_destroy(iter);
}
+ if( channel->banned ) {
+ db_destroy(channel->banned);
+ channel->banned = NULL;
+ }
db_destroy(channel->users);
if( channel->m ) {
map[channel->m].channel = NULL;
@@ -16727,7 +16746,7 @@ void packetdb_loaddb(void) {
*
*------------------------------------------*/
int do_init_clif(void) {
- const char* colors[COLOR_MAX] = { "0xFF0000" };
+ const char* colors[COLOR_MAX] = { "0xFF0000", "0x00ff00" };
int i;
/**
* Setup Color Table (saves unnecessary load of strtoul on every call)
diff --git a/src/map/clif.h b/src/map/clif.h
index ecdf17429..616af8d7e 100644
--- a/src/map/clif.h
+++ b/src/map/clif.h
@@ -7,6 +7,7 @@
#include "../common/cbasetypes.h"
#include "../common/db.h"
+#include "../common/mmo.h"
#include <stdarg.h>
/**
@@ -322,13 +323,14 @@ enum clif_messages {
**/
enum clif_colors {
COLOR_RED,
-
+ COLOR_DEFAULT,
COLOR_MAX
};
enum hChSysChOpt {
- hChSys_OPT_BASE = 0,
- hChSys_OPT_ANNOUNCE_JOIN = 1,
+ hChSys_OPT_BASE = 0x0,
+ hChSys_OPT_ANNOUNCE_JOIN = 0x1,
+ hChSys_OPT_MSG_DELAY = 0x2,
};
enum hChSysChType {
@@ -383,15 +385,21 @@ struct {
bool allow_user_channel_creation;
} hChSys;
+struct hChSysBanEntry {
+ char name[NAME_LENGTH];
+};
+
struct hChSysCh {
char name[HCHSYS_NAME_LENGTH];
char pass[HCHSYS_NAME_LENGTH];
unsigned char color;
DBMap *users;
+ DBMap *banned;
unsigned int opt;
unsigned int owner;
enum hChSysChType type;
uint16 m;
+ unsigned char msg_delay;
};
struct hCSData {
@@ -662,7 +670,7 @@ struct clif_interface {
void (*msgtable) (int fd, int line);
void (*msgtable_num) (int fd, int line, int num);
void (*message) (const int fd, const char* mes);
- int (*colormes) (struct map_session_data * sd, enum clif_colors color, const char* msg);
+ int (*colormes) (int fd, enum clif_colors color, const char* msg);
bool (*process_message) (struct map_session_data* sd, int format, char** name_, int* namelen_, char** message_, int* messagelen_);
void (*wisexin) (struct map_session_data *sd,int type,int flag);
void (*wisall) (struct map_session_data *sd,int type,int flag);
diff --git a/src/map/guild.c b/src/map/guild.c
index 321560420..2948d19c6 100644
--- a/src/map/guild.c
+++ b/src/map/guild.c
@@ -754,12 +754,15 @@ void guild_member_joined(struct map_session_data *sd)
if( hChSys.ally && hChSys.ally_autojoin ) {
struct guild* sg = NULL;
- clif->chsys_join((struct hChSysCh*)g->channel,sd);
+ struct hChSysCh *channel = (struct hChSysCh*)g->channel;
+
+ if( !(channel->banned && idb_exists(channel->banned, sd->status.account_id) ) )
+ clif->chsys_join(channel,sd);
for (i = 0; i < MAX_GUILDALLIANCE; i++) {
if( g->alliance[i].guild_id && (sg = guild_search(g->alliance[i].guild_id) ) ) {
- clif->chsys_join((struct hChSysCh*)sg->channel,sd);
- break;
+ if( !(((struct hChSysCh*)sg->channel)->banned && idb_exists(((struct hChSysCh*)sg->channel)->banned, sd->status.account_id)))
+ clif->chsys_join((struct hChSysCh*)sg->channel,sd);
}
}
}
diff --git a/src/map/pc.c b/src/map/pc.c
index 796280308..a6c953c36 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -982,6 +982,7 @@ bool pc_authok(struct map_session_data *sd, int login_id2, time_t expiration_tim
sd->cantalk_tick = tick;
sd->canskill_tick = tick;
sd->cansendmail_tick = tick;
+ sd->hchsysch_tick = tick;
for(i = 0; i < MAX_SKILL_LEVEL; i++)
sd->spirit_timer[i] = INVALID_TIMER;
@@ -4302,7 +4303,7 @@ int pc_useitem(struct map_session_data *sd,int n)
sprintf(e_msg,"Item Failed. [%s] is cooling down. wait %d seconds.",
itemdb_jname(sd->status.inventory[n].nameid),
e_tick+1);
- clif->colormes(sd,COLOR_RED,e_msg);
+ clif->colormes(sd->fd,COLOR_RED,e_msg);
return 0; // Delay has not expired yet
}
} else {// not yet used item (all slots are initially empty)
diff --git a/src/map/pc.h b/src/map/pc.h
index 2ebd5ad22..5ccfdaee8 100644
--- a/src/map/pc.h
+++ b/src/map/pc.h
@@ -501,7 +501,8 @@ struct map_session_data {
unsigned char channel_count;
struct hChSysCh *gcbind;
bool stealth;
- unsigned char fontcolor; /* debug-only */
+ unsigned char fontcolor;
+ unsigned int hchsysch_tick;
// temporary debugging of bug #3504
const char* delunit_prevfile;
diff --git a/src/map/skill.c b/src/map/skill.c
index 2c255ffb7..1d3481453 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -12858,7 +12858,7 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id
MOBID_EMPERIUM, MOBID_GUARIDAN_STONE1, MOBID_GUARIDAN_STONE2)) {
char output[128];
sprintf(output, "You're too close to a stone or emperium to do this skill");
- clif->colormes(sd, COLOR_RED, output);
+ clif->colormes(sd->fd, COLOR_RED, output);
return 0;
}
}
@@ -13239,7 +13239,7 @@ int skill_check_condition_castend(struct map_session_data* sd, uint16 skill_id,
skill->get_desc(skill_id),
require.ammo_qty,
itemdb_jname(sd->status.inventory[i].nameid));
- clif->colormes(sd,COLOR_RED,e_msg);
+ clif->colormes(sd->fd,COLOR_RED,e_msg);
return 0;
}
if (!(require.ammo&1<<sd->inventory_data[i]->look)) { //Ammo type check. Send the "wrong weapon type" message