瀏覽代碼

- 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://svn.code.sf.net/p/rathena/svn/trunk@7423 54d463be-8e91-2dee-dedb-b68131a5f0ec

skotlex 19 年之前
父節點
當前提交
33bbefb989
共有 7 個文件被更改,包括 29 次插入5 次删除
  1. 4 0
      Changelog-Trunk.txt
  2. 1 0
      conf-tmpl/msg_athena.conf
  3. 1 0
      db/const.txt
  4. 6 0
      src/map/chat.c
  5. 1 0
      src/map/map.h
  6. 3 0
      src/map/npc.c
  7. 13 5
      src/map/script.c

+ 4 - 0
Changelog-Trunk.txt

@@ -4,6 +4,10 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK.  ALL UNTESTED BUGFIXES/FEATURES GO
 IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
 
 2006/05/30
+	* Added mapflag "nochat" to prevent chatting rooms from being created.
+	  [Skotlex]
+	* Corrected some of the sleep checks when the char id does not matches with
+	  the char-id expected by the script engine. [Skotlex]
 	* Cleanup in itemheal related code, fixed the item heal group bonus not
 	  working on Groups beyond 7. [Skotlex]
 	* Fixed pet's loot not being moved to your inventory on logout. [Skotlex]

+ 1 - 0
conf-tmpl/msg_athena.conf

@@ -290,6 +290,7 @@
 278: (@request): %s
 279: @request sent.
 280: Invalid pet name.
+281: You can't create chat rooms on this map
 // Guild Castles Number
 // --------------------
 299: ?? Castles

+ 1 - 0
db/const.txt

@@ -132,6 +132,7 @@ mf_jexp		39
 mf_bexp		40
 mf_novending	41
 mf_loadevent 42
+mf_nochat	43
 
 cell_wall	1
 cell_water	3

+ 6 - 0
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));
 

+ 1 - 0
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];

+ 3 - 0
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;
 }

+ 13 - 5
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;