Переглянути джерело

* mob_chat_sub fix. Added buildin_pcblockmove.

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@5628 54d463be-8e91-2dee-dedb-b68131a5f0ec
Lance 19 роки тому
батько
коміт
d5cf7d95e0
6 змінених файлів з 38 додано та 18 видалено
  1. 1 0
      Changelog-Trunk.txt
  2. 6 2
      src/map/clif.c
  3. 1 0
      src/map/map.h
  4. 2 2
      src/map/mob.c
  5. 8 14
      src/map/npc_chat.c
  6. 20 0
      src/map/script.c

+ 1 - 0
Changelog-Trunk.txt

@@ -5,6 +5,7 @@ IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.  EV
 GOES INTO TRUNK AND WILL BE MERGED INTO STABLE BY VALARIS AND WIZPUTER. -- VALARIS
 
 2006/03/15
+	* mob_chat_sub fix. Added buildin_pcblockmove. [Lance]
 	* BL_PC and BL_MOB control script commands (experimental) [Lance]
 	* Made an adjustment to addspiritball() to allow Gunslingers to summon up to 10 spheres [reddozen]
 	* Fixed Tarot Card of Fate using time instead of time2 which is the one

+ 6 - 2
src/map/clif.c

@@ -8874,8 +8874,9 @@ void clif_parse_WalkToXY(int fd, struct map_session_data *sd) {
 		return;
 	}
 
-	if (pc_issit(sd)) //No walking when you are sit!
-		return;
+	// Redundancy, used in pc_can_move already
+	//if (pc_issit(sd)) //No walking when you are sit!
+	//	return;
 	
 	if (clif_cant_act(sd))
 		return;
@@ -8886,6 +8887,9 @@ void clif_parse_WalkToXY(int fd, struct map_session_data *sd) {
 	if (!pc_can_move(sd))
 		return;
 
+	if(sd->state.blockedmove)
+		return;
+
 	if(sd->sc.count && sd->sc.data[SC_RUN].timer != -1)
 		return;
 

+ 1 - 0
src/map/map.h

@@ -450,6 +450,7 @@ struct map_session_data {
 		unsigned size :2; // for tiny/large types
 		unsigned night :1; //Holds whether or not the player currently has the SI_NIGHT effect on. [Skotlex]
 		unsigned finalsave :1; //Signals whether the final save for the char was done or not yet. Meant to prevent exploits and the like. [Skotlex]
+		unsigned blockedmove :1;
 		unsigned short autoloot;
 		struct guild *gmaster_flag;
 	} state;

+ 2 - 2
src/map/mob.c

@@ -2291,9 +2291,9 @@ int mob_damage(struct block_list *src,struct mob_data *md,int damage,int type)
 	if(src){
 		if(md->nd){
 			sprintf(buffer, "$@%d_attacker", md->bl.id);
-			set_var(NULL, buffer, src->id);
+			set_var(NULL, buffer, (void *)src->id);
 			sprintf(buffer, "$@%d_attacktype", md->bl.id);
-			set_var(NULL, buffer, src->type);
+			set_var(NULL, buffer, (void *)src->type);
 			sprintf(buffer, "%s::OnDamage", md->nd->exname);
 			npc_event_do(buffer);
 			return 0;

+ 8 - 14
src/map/npc_chat.c

@@ -372,20 +372,6 @@ void npc_chat_finalize(struct npc_data *nd)
 	aFree(npcParse);
 }
 
-int mob_chat_sub(struct block_list *bl, va_list ap){
-	int len;
-	unsigned char *msg = NULL;
-	struct map_session_data *sd = NULL;
-	struct mob_data *md = (struct mob_data *)bl;
-	if(md->nd){
-		msg = va_arg(ap,unsigned char*);
-		len = va_arg(ap,int);
-		sd = va_arg(ap,struct map_session_data *);
-		npc_chat_sub(&md->nd->bl, msg, len, sd);
-	}
-	return 0;
-}
-
 /**
  * Handler called whenever a global message is spoken in a NPC's area
  */
@@ -491,6 +477,14 @@ int npc_chat_sub(struct block_list *bl, va_list ap)
     return 0;
 }
 
+int mob_chat_sub(struct block_list *bl, va_list ap){
+	struct mob_data *md = (struct mob_data *)bl;
+	if(md->nd){
+		npc_chat_sub(&md->nd->bl, ap);
+	}
+	return 0;
+}
+
 // Various script builtins used to support these functions
 
 int buildin_defpattern(struct script_state *st) {

+ 20 - 0
src/map/script.c

@@ -410,6 +410,7 @@ int buildin_pctalk(struct script_state *st);
 int buildin_pcemote(struct script_state *st);
 int buildin_pcfollow(struct script_state *st);
 int buildin_pcstopfollow(struct script_state *st);
+int buildin_pcblockmove(struct script_state *st);
 // <--- [zBuffer] List of player cont commands
 // [zBuffer] List of mob control commands --->
 int buildin_spawnmob(struct script_state *st);
@@ -737,6 +738,7 @@ struct {
 	{buildin_pcemote,"pcemote","ii"},
 	{buildin_pcfollow,"pcfollow","ii"},
 	{buildin_pcstopfollow,"pcstopfollow","i"},
+	{buildin_pcblockmove,"pcblockmove","ii"},
 	// <--- [zBuffer] List of player cont commands
 	// [zBuffer] List of mob control commands --->
 	{buildin_spawnmob,"spawnmob","*"},
@@ -9847,6 +9849,24 @@ int buildin_pcwalkxy(struct script_state *st){
 	return 0;
 }
 
+int buildin_pcblockmove(struct script_state *st){
+	int id, flag;
+	struct map_session_data *sd = NULL;
+
+	id = conv_num(st, & (st->stack->stack_data[st->start + 2]));
+	flag = conv_num(st, & (st->stack->stack_data[st->start + 3]));
+
+	if(id)
+		sd = map_id2sd(id);
+	else
+		sd = script_rid2sd(st);
+
+	if(sd)
+		sd->state.blockedmove = flag > 0;
+
+	return 0;
+}
+
 int buildin_pctalk(struct script_state *st){
 	int id;
 	char *str;