diff options
Diffstat (limited to 'src/map/chat.c')
-rw-r--r-- | src/map/chat.c | 40 |
1 files changed, 21 insertions, 19 deletions
diff --git a/src/map/chat.c b/src/map/chat.c index d60b9bece..763d98f7a 100644 --- a/src/map/chat.c +++ b/src/map/chat.c @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify @@ -44,7 +44,7 @@ struct chat_interface *chat; /// Initializes a chatroom object (common functionality for both pc and npc chatrooms). /// Returns a chatroom object on success, or NULL on failure. -struct chat_data* chat_createchat(struct block_list* bl, const char* title, const char* pass, int limit, bool pub, int trigger, const char* ev, int zeny, int minLvl, int maxLvl) +struct chat_data* chat_createchat(struct block_list* bl, const char* title, const char* pass, int limit, bool pub, int trigger, const char* ev, int zeny, int min_level, int max_level) { struct chat_data* cd; nullpo_retr(NULL, bl); @@ -62,8 +62,8 @@ struct chat_data* chat_createchat(struct block_list* bl, const char* title, cons cd->limit = min(limit, ARRAYLENGTH(cd->usersd)); cd->trigger = trigger; cd->zeny = zeny; - cd->minLvl = minLvl; - cd->maxLvl = maxLvl; + cd->min_level = min_level; + cd->max_level = max_level; memset(cd->usersd, 0, sizeof(cd->usersd)); cd->owner = bl; safestrncpy(cd->npc_event, ev, sizeof(cd->npc_event)); @@ -97,7 +97,7 @@ bool chat_createpcchat(struct map_session_data* sd, const char* title, const cha nullpo_ret(title); nullpo_ret(pass); - if( sd->chatID ) + if (sd->chat_id != 0) return false; //Prevent people abusing the chat system by creating multiple chats, as pointed out by End of Exam. [Skotlex] if( sd->state.vending || sd->state.buyingstore ) @@ -106,8 +106,8 @@ bool chat_createpcchat(struct map_session_data* sd, const char* title, const cha } if( map->list[sd->bl.m].flag.nochat ) { - clif->message(sd->fd, msg_sd(sd,281)); - return false; //Can't create chatrooms on this map. + clif->message(sd->fd, msg_sd(sd,281)); // You can't create chat rooms in this map + return false; } if (map->getcell(sd->bl.m, &sd->bl, sd->bl.x, sd->bl.y, CELL_CHKNOCHAT) ) { @@ -142,8 +142,10 @@ bool chat_joinchat(struct map_session_data* sd, int chatid, const char* pass) { nullpo_ret(pass); cd = map->id2cd(chatid); - if( cd == NULL || cd->bl.type != BL_CHAT || cd->bl.m != sd->bl.m || sd->state.vending || sd->state.buyingstore || sd->chatID || ((cd->owner->type == BL_NPC) ? cd->users+1 : cd->users) >= cd->limit ) - { + if (cd == NULL || cd->bl.type != BL_CHAT || cd->bl.m != sd->bl.m + || sd->state.vending || sd->state.buyingstore || sd->chat_id != 0 + || ((cd->owner->type == BL_NPC) ? cd->users+1 : cd->users) >= cd->limit + ) { clif->joinchatfail(sd,0); // room full return false; } @@ -154,8 +156,8 @@ bool chat_joinchat(struct map_session_data* sd, int chatid, const char* pass) { return false; } - if( sd->status.base_level < cd->minLvl || sd->status.base_level > cd->maxLvl ) { - if(sd->status.base_level < cd->minLvl) + if (sd->status.base_level < cd->min_level || sd->status.base_level > cd->max_level) { + if(sd->status.base_level < cd->min_level) clif->joinchatfail(sd,5); // too low level else clif->joinchatfail(sd,6); // too high level @@ -204,8 +206,8 @@ int chat_leavechat(struct map_session_data* sd, bool kicked) { nullpo_retr(0, sd); - cd = map->id2cd(sd->chatID); - if( cd == NULL ) { + cd = map->id2cd(sd->chat_id); + if (cd == NULL) { pc_setchatid(sd, 0); return 0; } @@ -279,7 +281,7 @@ bool chat_changechatowner(struct map_session_data* sd, const char* nextownername nullpo_ret(sd); nullpo_ret(nextownername); - cd = map->id2cd(sd->chatID); + cd = map->id2cd(sd->chat_id); if (cd == NULL || &sd->bl != cd->owner) return false; @@ -324,7 +326,7 @@ bool chat_changechatstatus(struct map_session_data* sd, const char* title, const nullpo_ret(title); nullpo_ret(pass); - cd = map->id2cd(sd->chatID); + cd = map->id2cd(sd->chat_id); if (cd == NULL || &sd->bl != cd->owner) return false; @@ -352,7 +354,7 @@ bool chat_kickchat(struct map_session_data* sd, const char* kickusername) { nullpo_ret(sd); nullpo_ret(kickusername); - cd = map->id2cd(sd->chatID); + cd = map->id2cd(sd->chat_id); if (cd == NULL || &sd->bl != cd->owner) return false; @@ -373,7 +375,7 @@ bool chat_kickchat(struct map_session_data* sd, const char* kickusername) { /*========================================== * Creates a chat room for the npc *------------------------------------------*/ -bool chat_createnpcchat(struct npc_data* nd, const char* title, int limit, bool pub, int trigger, const char* ev, int zeny, int minLvl, int maxLvl) +bool chat_createnpcchat(struct npc_data* nd, const char* title, int limit, bool pub, int trigger, const char* ev, int zeny, int min_level, int max_level) { struct chat_data* cd; nullpo_ret(nd); @@ -383,12 +385,12 @@ bool chat_createnpcchat(struct npc_data* nd, const char* title, int limit, bool return false; } - if( zeny > MAX_ZENY || maxLvl > MAX_LEVEL ) { + if (zeny > MAX_ZENY || max_level > MAX_LEVEL) { ShowError("chat_createnpcchat: npc '%s' has a required lvl or amount of zeny over the max limit!\n", nd->exname); return false; } - cd = chat->create(&nd->bl, title, "", limit, pub, trigger, ev, zeny, minLvl, maxLvl); + cd = chat->create(&nd->bl, title, "", limit, pub, trigger, ev, zeny, min_level, max_level); if( cd ) { nd->chat_id = cd->bl.id; |