summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-06-30 16:53:56 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-06-30 16:53:56 +0000
commit9b4059fbdfc3ad77a1102dfdac0146797182d97a (patch)
tree8775a9776bcfabac4dbff7fc0096382618ab71c6 /src/map
parent55fee732fa5e5056268bee29a7b2d1d28ed6022c (diff)
downloadhercules-9b4059fbdfc3ad77a1102dfdac0146797182d97a.tar.gz
hercules-9b4059fbdfc3ad77a1102dfdac0146797182d97a.tar.bz2
hercules-9b4059fbdfc3ad77a1102dfdac0146797182d97a.tar.xz
hercules-9b4059fbdfc3ad77a1102dfdac0146797182d97a.zip
- Added mapflag "nochat" to prevent chatting rooms from being created.
- Corrected some of the sleep checks when the char id does not matches with the char-id expected by the script engine. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@7423 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map')
-rw-r--r--src/map/chat.c6
-rw-r--r--src/map/map.h1
-rw-r--r--src/map/npc.c3
-rw-r--r--src/map/script.c18
4 files changed, 23 insertions, 5 deletions
diff --git a/src/map/chat.c b/src/map/chat.c
index 311fe1d8e..8ebd54354 100644
--- a/src/map/chat.c
+++ b/src/map/chat.c
@@ -12,6 +12,7 @@
#include "clif.h"
#include "pc.h"
#include "npc.h"
+#include "atcommand.h"
int chat_triggerevent(struct chat_data *cd);
@@ -27,6 +28,11 @@ int chat_createchat(struct map_session_data *sd,int limit,int pub,char* pass,cha
if (sd->chatID)
return 0; //Prevent people abusing the chat system by creating multiple chats, as pointed out by End of Exam. [Skotlex]
+
+ if (map[sd->bl.m].flag.nochat) {
+ clif_displaymessage (sd->fd, msg_txt(281));
+ return 0; //Can't drop items in nodrop mapflag maps.
+ }
pc_stop_walking(sd,1);
cd = (struct chat_data *) aMalloc(sizeof(struct chat_data));
diff --git a/src/map/map.h b/src/map/map.h
index da8b1c715..20fe52b45 100644
--- a/src/map/map.h
+++ b/src/map/map.h
@@ -1084,6 +1084,7 @@ struct map_data {
unsigned nodrop : 1;
unsigned novending : 1;
unsigned loadevent : 1;
+ unsigned nochat :1;
} flag;
struct point save;
struct npc_data *npc[MAX_NPC_PER_MAP];
diff --git a/src/map/npc.c b/src/map/npc.c
index a81a63b23..372851ca6 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -2515,6 +2515,9 @@ static int npc_parse_mapflag (char *w1, char *w2, char *w3, char *w4)
else if (strcmpi(w3,"loadevent")==0) { // Skotlex
map[m].flag.loadevent=state;
}
+ else if (strcmpi(w3,"nochat")==0) { // Skotlex
+ map[m].flag.nochat=state;
+ }
return 0;
}
diff --git a/src/map/script.c b/src/map/script.c
index c442f210f..c666a7728 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -6875,7 +6875,7 @@ enum { MF_NOMEMO,MF_NOTELEPORT,MF_NOSAVE,MF_NOBRANCH,MF_NOPENALTY,MF_NOZENYPENA
MF_NOWARP,MF_FREE,MF_NOICEWALL,MF_SNOW,MF_FOG,MF_SAKURA,MF_LEAVES,MF_RAIN,
MF_INDOORS,MF_NOGO,MF_CLOUDS,MF_CLOUDS2,MF_FIREWORKS,MF_GVG_CASTLE,MF_GVG_DUNGEON,MF_NIGHTENABLED,
MF_NOBASEEXP, MF_NOJOBEXP, MF_NOMOBLOOT, MF_NOMVPLOOT, MF_NORETURN, MF_NOWARPTO, MF_NIGHTMAREDROP,
- MF_RESTRICTED, MF_NOCOMMAND, MF_NODROP, MF_JEXP, MF_BEXP, MF_NOVENDING, MF_LOADEVENT };
+ MF_RESTRICTED, MF_NOCOMMAND, MF_NODROP, MF_JEXP, MF_BEXP, MF_NOVENDING, MF_LOADEVENT, MF_NOCHAT };
int buildin_setmapflagnosave(struct script_state *st)
{
@@ -7037,6 +7037,8 @@ int buildin_setmapflag(struct script_state *st)
case MF_LOADEVENT:
map[m].flag.loadevent=1;
break;
+ case MF_NOCHAT:
+ map[m].flag.nochat=1;
}
}
@@ -7179,6 +7181,8 @@ int buildin_removemapflag(struct script_state *st)
case MF_LOADEVENT:
map[m].flag.loadevent=0;
break;
+ case MF_NOCHAT:
+ map[m].flag.nochat=0;
}
}
@@ -10962,8 +10966,11 @@ int buildin_awake(struct script_state *st)
node = node->next;
continue;
}
- if( sd && sd->char_id != tst->sleep.charid )
+ if((sd && sd->char_id != tst->sleep.charid) || (tst->rid && !sd))
+ { //Cancel Execution
+ tst->state=END;
tst->rid = 0;
+ }
delete_timer(tst->sleep.timer, run_script_timer);
node = script_erase_sleepdb(node);
@@ -11705,9 +11712,12 @@ int run_script_timer(int tid, unsigned int tick, int id, int data)
struct linkdb_node *node = (struct linkdb_node *)sleep_db;
struct map_session_data *sd = map_id2sd(st->rid);
- if( sd && sd->char_id != id ) {
+ if((sd && sd->char_id != id) || (st->rid && !sd))
+ { //Character mismatch. Cancel execution.
st->rid = 0;
+ st->state = END;
}
+
while( node && st->sleep.timer != -1 ) {
if( (int)node->key == st->oid && ((struct script_state *)node->data)->sleep.timer == st->sleep.timer ) {
script_erase_sleepdb(node);
@@ -11716,8 +11726,6 @@ int run_script_timer(int tid, unsigned int tick, int id, int data)
}
node = node->next;
}
- if(st->rid && !sd)
- st->state = END;
run_script_main(st);
return 0;