diff options
author | Kisuka <Kisuka@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2011-04-05 06:00:20 +0000 |
---|---|---|
committer | Kisuka <Kisuka@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2011-04-05 06:00:20 +0000 |
commit | d841fc529949f361e915b73a073d1fa9d4ec60f7 (patch) | |
tree | 6a9a34b176f00c6178700a46c01d1c752821d40e /src/map/chat.c | |
parent | 1bea10f578d4e8119659a0373c0a9213fdaab4d4 (diff) | |
download | hercules-d841fc529949f361e915b73a073d1fa9d4ec60f7.tar.gz hercules-d841fc529949f361e915b73a073d1fa9d4ec60f7.tar.bz2 hercules-d841fc529949f361e915b73a073d1fa9d4ec60f7.tar.xz hercules-d841fc529949f361e915b73a073d1fa9d4ec60f7.zip |
- Completed L0ne's 2007 request for 'waitingroom' to support required zeny and level.
- Updated NPC files which required the waitingroom update.
- Added Poring War script.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14765 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/chat.c')
-rw-r--r-- | src/map/chat.c | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/src/map/chat.c b/src/map/chat.c index 4c2a001ec..933674db8 100644 --- a/src/map/chat.c +++ b/src/map/chat.c @@ -23,7 +23,7 @@ int chat_triggerevent(struct chat_data *cd); // forward declaration /// Initializes a chatroom object (common functionality for both pc and npc chatrooms). /// Returns a chatroom object on success, or NULL on failure. -static struct chat_data* chat_createchat(struct block_list* bl, const char* title, const char* pass, int limit, bool pub, int trigger, const char* ev) +static 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* cd; nullpo_retr(NULL, bl); @@ -36,6 +36,9 @@ static struct chat_data* chat_createchat(struct block_list* bl, const char* titl cd->users = 0; cd->limit = min(limit, ARRAYLENGTH(cd->usersd)); cd->trigger = trigger; + cd->zeny = zeny; + cd->minLvl = minLvl; + cd->maxLvl = maxLvl; memset(cd->usersd, 0, sizeof(cd->usersd)); cd->owner = bl; safestrncpy(cd->npc_event, ev, sizeof(cd->npc_event)); @@ -88,7 +91,7 @@ int chat_createpcchat(struct map_session_data* sd, const char* title, const char pc_stop_walking(sd,1); - cd = chat_createchat(&sd->bl, title, pass, limit, pub, 0, ""); + cd = chat_createchat(&sd->bl, title, pass, limit, pub, 0, "", 0, 1, MAX_LEVEL); if( cd ) { cd->users = 1; @@ -125,6 +128,22 @@ 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) + clif_joinchatfail(sd,5); + else + clif_joinchatfail(sd,6); + + return 0; + } + + if( sd->status.zeny < cd->zeny ) + { + clif_joinchatfail(sd,4); + return 0; + } + pc_stop_walking(sd,1); cd->usersd[cd->users] = sd; cd->users++; @@ -299,7 +318,7 @@ int chat_kickchat(struct map_session_data* sd, const char* kickusername) } /// Creates a chat room for the npc. -int chat_createnpcchat(struct npc_data* nd, const char* title, int limit, bool pub, int trigger, const char* ev) +int chat_createnpcchat(struct npc_data* nd, const char* title, int limit, bool pub, int trigger, const char* ev, int zeny, int minLvl, int maxLvl) { struct chat_data* cd; nullpo_ret(nd); @@ -310,7 +329,14 @@ int chat_createnpcchat(struct npc_data* nd, const char* title, int limit, bool p return 0; } - cd = chat_createchat(&nd->bl, title, "", limit, pub, trigger, ev); + if( zeny > MAX_ZENY || maxLvl > MAX_LEVEL ) + { + ShowError("chat_createnpcchat: npc '%s' has a required lvl or amount of zeny over the max limit!\n", nd->exname); + return 0; + } + + cd = chat_createchat(&nd->bl, title, "", limit, pub, trigger, ev, zeny, minLvl, maxLvl); + if( cd ) { nd->chat_id = cd->bl.id; |