Bläddra i källkod

* Final fix on Juperos NPC.
* Fix on initnpctimer not attaching rid.
* Fix on OnTouch ignoring -1 NPCs.
* Fix on @reloadscript crashing due to passing non BL_SKILL bl to a function that accepts only BL_SKILL bl.
* Added area NPC detection in clif_parseLoadEndAck.

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@5638 54d463be-8e91-2dee-dedb-b68131a5f0ec

Lance 19 år sedan
förälder
incheckning
ceea8fde6c
6 ändrade filer med 24 tillägg och 12 borttagningar
  1. 6 0
      Changelog-Trunk.txt
  2. 7 10
      npc/warps/dungeons/juperos.txt
  3. 6 0
      src/map/clif.c
  4. 1 1
      src/map/map.c
  5. 3 1
      src/map/npc.c
  6. 1 0
      src/map/script.c

+ 6 - 0
Changelog-Trunk.txt

@@ -5,6 +5,12 @@ 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/17
+	* Final fix on Juperos NPC. [Lance]
+	* Fix on initnpctimer not attaching rid. [Lance]
+	* Fix on OnTouch ignoring -1 NPCs. [Lance]
+	* Fix on @reloadscript crashing due to passing non BL_SKILL bl to a function that accepts only BL_SKILL bl. 
+	  [Lance]
+	* Added area NPC detection in clif_parseLoadEndAck. [Lance]
 	* Fixed compiler warning in script.c get_mob_data. [Lance]
 	* Temperory resolved issues on Juperos until I get the exact description on the behaviour
 	  in retail servers. [Lance]

+ 7 - 10
npc/warps/dungeons/juperos.txt

@@ -55,21 +55,19 @@ juperos_02.gat,129,150,0	script	Juperos	111,{
 	mes "Are you sure you want to enter?";
 	next;
 	if(select("Yes","No") == 1){
-		close2;
-		set jupe_destination$, "jupe_ele.gat";
+		set jupe_destination$, "jupe_ele_r.gat";
 		set jupe_destination_x, 50;
 		set jupe_destination_y, 94;
+		close2;
 		warp "jupe_ele.gat",41,45;
 		end;
 	}
 	close;
 }
 
-jupe_ele.gat,41,45,0	script	detectionUnit	-1,10,10{
-	if(jupe_ele_timer == 0){
-		set jupe_ele_timer, 1;
-		initnpctimer;
-	}
+jupe_ele.gat,41,45,0	script	detectionUnit	-1,20,20{
+OnTouch:
+	initnpctimer;	
 	end;
 
 OnTimer1000:
@@ -80,11 +78,10 @@ OnTimer1000:
 OnTimer15000:
 	stopnpctimer;
 	setnpctimer 0;
-	set jupe_ele_timer, 0;
+	warp jupe_destination$,jupe_destination_x,jupe_destination_y;
 	set jupe_destination$, "";
 	set jupe_destination_x, 0;
 	set jupe_destination_y, 0;
-	warp jupe_destination$,jupe_destination_x,jupe_destination_y;
 	end;
 }
 
@@ -92,10 +89,10 @@ jupe_ele_r.gat,50,98,0	script	Juperos Elevator	111,{
 	mes "Are you sure you want to go up?";
 	next;
 	if(select("Yes","No") == 1){
-		close2;
 		set jupe_destination$, "juperos_02.gat";
 		set jupe_destination_x, 129;
 		set jupe_destination_y, 147;
+		close2;
 		warp "jupe_ele.gat",41,45;
 	}
 	close;

+ 6 - 0
src/map/clif.c

@@ -8846,6 +8846,12 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd)
 		clif_status_load(&sd->bl, SI_DEVIL, 1);  //blindness [Komurka]
 	
 	map_foreachinarea(clif_getareachar,sd->bl.m,sd->bl.x-AREA_SIZE,sd->bl.y-AREA_SIZE,sd->bl.x+AREA_SIZE,sd->bl.y+AREA_SIZE,BL_ALL,sd);
+	
+	// For automatic triggering of NPCs after map loading (so you don't need to walk 1 step first)
+	if (map_getcell(sd->bl.m,sd->bl.x,sd->bl.y,CELL_CHKNPC))
+		npc_touch_areanpc(sd,sd->bl.m,sd->bl.x,sd->bl.y);
+	else
+		sd->areanpc_id = 0;
 }
 
 /*==========================================

+ 1 - 1
src/map/map.c

@@ -1279,7 +1279,7 @@ void map_foreachobject(int (*func)(struct block_list*,va_list),int type,...) {
 
 	for(i=2;i<=last_object_id;i++){
 		if(objects[i]){
-			if(!(objects[i]->type&type))
+			if(!(objects[i]->type==type)) // Fixed [Lance]
 				continue;
 			if(bl_list_count>=BL_LIST_MAX) {
 				if(battle_config.error_log)

+ 3 - 1
src/map/npc.c

@@ -777,6 +777,7 @@ int npc_settimerevent_tick(struct npc_data *nd,int newtimer)
 		flag= sd->npc_timer_id != -1 ;
 	} else
 		flag= nd->u.scr.timerid != -1 ;
+
 	if(flag)
 		npc_timerevent_stop(nd);
 	nd->u.scr.timer=newtimer;
@@ -1556,6 +1557,7 @@ int npc_unload (struct npc_data *nd)
 			}
 		}
 	}
+
 	aFree(nd);
 
 	return 0;
@@ -2033,7 +2035,7 @@ static int npc_parse_script (char *w1,char *w2,char *w3,char *w4,char *first_lin
 		if (xs >= 0) xs = xs * 2 + 1;
 		if (ys >= 0) ys = ys * 2 + 1;
 
-		if (class_ >= 0) {
+		if (class_ >= -1) { // -1 NPCs use OnTouch [Lance]
 			for (i = 0; i < ys; i++) {
 				for (j = 0; j < xs; j++) {
 					if (map_getcell(m, x - xs/2 + j, y - ys/2 + i, CELL_CHKNOPASS))

+ 1 - 0
src/map/script.c

@@ -5659,6 +5659,7 @@ int buildin_initnpctimer(struct script_state *st)
 	else
 		nd=(struct npc_data *)map_id2bl(st->oid);
 
+	nd->u.scr.rid = st->rid;
 	npc_settimerevent_tick(nd,0);
 	npc_timerevent_start(nd, st->rid);
 	return 0;