summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorshennetsind <shennetsind@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-01-18 08:43:28 +0000
committershennetsind <shennetsind@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-01-18 08:43:28 +0000
commit72305739e4c89c8c95175fb700c59756c4a1631c (patch)
tree2185483a8c0b57efc25e6829c6358183bfd70eec /src/map
parent7bdb98374ade0b0d2aad8e2f85b0c799112c170d (diff)
downloadhercules-72305739e4c89c8c95175fb700c59756c4a1631c.tar.gz
hercules-72305739e4c89c8c95175fb700c59756c4a1631c.tar.bz2
hercules-72305739e4c89c8c95175fb700c59756c4a1631c.tar.xz
hercules-72305739e4c89c8c95175fb700c59756c4a1631c.zip
Added official behavior to chat room kicking, when you're kicked out of the chat room you're 'blacklisted', making you unable to rejoin that same chat room instance again.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@15487 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map')
-rw-r--r--src/map/chat.c16
-rw-r--r--src/map/chat.h1
2 files changed, 13 insertions, 4 deletions
diff --git a/src/map/chat.c b/src/map/chat.c
index 933674db8..e2e5077e6 100644
--- a/src/map/chat.c
+++ b/src/map/chat.c
@@ -58,6 +58,8 @@ static struct chat_data* chat_createchat(struct block_list* bl, const char* titl
map_addiddb(&cd->bl);
+ cd->kick_list = idb_alloc(DB_OPT_BASE);
+
return cd;
}
@@ -128,8 +130,7 @@ int chat_joinchat(struct map_session_data* sd, int chatid, const char* pass)
return 0;
}
- if( sd->status.base_level < cd->minLvl || sd->status.base_level > cd->maxLvl )
- {
+ if( sd->status.base_level < cd->minLvl || sd->status.base_level > cd->maxLvl ) {
if(sd->status.base_level < cd->minLvl)
clif_joinchatfail(sd,5);
else
@@ -138,12 +139,16 @@ int chat_joinchat(struct map_session_data* sd, int chatid, const char* pass)
return 0;
}
- if( sd->status.zeny < cd->zeny )
- {
+ if( sd->status.zeny < cd->zeny ) {
clif_joinchatfail(sd,4);
return 0;
}
+ if( idb_exists(cd->kick_list,sd->status.char_id) ) {
+ clif_joinchatfail(sd,2);//You have been kicked out of the room.
+ return 0;
+ }
+
pc_stop_walking(sd,1);
cd->usersd[cd->users] = sd;
cd->users++;
@@ -198,6 +203,7 @@ int chat_leavechat(struct map_session_data* sd, bool kicked)
if( cd->users == 0 && cd->owner->type == BL_PC )
{ // Delete empty chatroom
clif_clearchat(cd, 0);
+ cd->kick_list->destroy(cd->kick_list, NULL);
map_deliddb(&cd->bl);
map_delblock(&cd->bl);
map_freeblock(&cd->bl);
@@ -312,6 +318,8 @@ int chat_kickchat(struct map_session_data* sd, const char* kickusername)
if( battle_config.gm_kick_chat && pc_isGM(cd->usersd[i]) >= battle_config.gm_kick_chat )
return 0; //gm kick protection [Valaris]
+
+ idb_put(cd->kick_list,cd->usersd[i]->status.char_id,(void*)1);
chat_leavechat(cd->usersd[i],1);
return 0;
diff --git a/src/map/chat.h b/src/map/chat.h
index b80832d3d..cb2e6ecd9 100644
--- a/src/map/chat.h
+++ b/src/map/chat.h
@@ -23,6 +23,7 @@ struct chat_data {
struct map_session_data* usersd[20];
struct block_list* owner;
char npc_event[EVENT_NAME_LENGTH];
+ DBMap* kick_list; //DBMap of users who were kicked from this chat
};