Jelajahi Sumber

Fixed cell_basilica which gave nothing. Only works only for player

Signed-off-by: Cydh Ramdh <house.bad@gmail.com>
Cydh Ramdh 11 tahun lalu
induk
melakukan
c88b77f5fd
5 mengubah file dengan 37 tambahan dan 12 penghapusan
  1. 5 0
      db/const.txt
  2. 1 2
      doc/script_commands.txt
  3. 17 0
      src/map/pc.c
  4. 2 0
      src/map/pc.h
  5. 12 10
      src/map/unit.c

+ 5 - 0
db/const.txt

@@ -380,6 +380,7 @@ mf_nolockon	58
 mf_notomb	59
 mf_skill_damage	60
 
+//'setcell' types
 cell_walkable	0
 cell_shootable	1
 cell_water	2
@@ -388,6 +389,8 @@ cell_basilica	4
 cell_landprotector	5
 cell_novending	6
 cell_nochat	7
+cell_malestrom	8
+cell_icewall	9
 
 //cell_gettype	0
 cell_chkwall	1
@@ -403,6 +406,8 @@ cell_chkbasilica	10
 cell_chklandprotector	11
 cell_chknovending	12
 cell_chknochat	13
+cell_chkmaelstrom	14
+cell_chkicewall	15
 
 StatusPoint	9	1
 BaseLevel	11	1

+ 1 - 2
doc/script_commands.txt

@@ -7230,8 +7230,7 @@ Each of these can be 'on' or 'off'. Together they define a cell's behavior.
 
 This command lets you alter these flags for all map cells in the specified
 (x1,y1)-(x2,y2) rectangle. The 'flag' can be 0 or 1 (0:clear flag, 1:set flag).
-The 'type' defines which flag to modify. Possible options include cell_walkable,
-cell_shootable, cell_basilica. For a full list, see const.txt.
+The 'type' defines which flag to modify. Possible options see const.txt.
 
 Example:
 

+ 17 - 0
src/map/pc.c

@@ -4990,6 +4990,7 @@ int pc_setpos(struct map_session_data* sd, unsigned short mapindex, int x, int y
 		sd->md->ud.dir = sd->ud.dir;
 	}
 
+	pc_cell_basilica(sd);
 	return 0;
 }
 
@@ -10463,6 +10464,22 @@ void pc_bonus_script_check(struct map_session_data *sd, enum e_bonus_script_flag
 		status_calc_pc(sd,false);
 }
 
+/** [Cydh]
+ * Gives/removes SC_BASILICA when player steps in/out the cell with 'cell_basilica'
+ * @param sd player
+ */
+void pc_cell_basilica(struct map_session_data *sd) {
+	if (!sd)
+		return;
+	
+	if (!map_getcell(sd->bl.m,sd->bl.x,sd->bl.y,CELL_CHKBASILICA)) {
+		if (&sd->sc && sd->sc.data[SC_BASILICA])
+			status_change_end(&sd->bl,SC_BASILICA,INVALID_TIMER);
+	}
+	else if (!(&sd->sc) || !sd->sc.data[SC_BASILICA])
+		sc_start(&sd->bl,&sd->bl,SC_BASILICA,100,0,-1);
+}
+
 /*==========================================
  * pc Init/Terminate
  *------------------------------------------*/

+ 2 - 0
src/map/pc.h

@@ -1050,6 +1050,8 @@ int pc_bonus_script_timer(int tid, unsigned int tick, int id, intptr_t data);
 void pc_bonus_script_remove(struct map_session_data *sd, uint8 i);
 void pc_bonus_script_check(struct map_session_data *sd, enum e_bonus_script_flags flag);
 
+void pc_cell_basilica(struct map_session_data *sd);
+
 #if defined(RENEWAL_DROP) || defined(RENEWAL_EXP)
 int pc_level_penalty_mod(struct map_session_data *sd, int mob_level, uint32 mob_race, uint32 mob_mode, int type);
 #endif

+ 12 - 10
src/map/unit.c

@@ -228,8 +228,8 @@ static int unit_walktoxy_timer(int tid, unsigned int tick, int id, intptr_t data
 	int i;
 	int x,y,dx,dy;
 	uint8 dir;
-	struct block_list       *bl;
-	struct unit_data        *ud;
+	struct block_list *bl;
+	struct unit_data *ud;
 	TBL_PC *sd;
 	TBL_MOB *md;
 	TBL_MER *mrd;
@@ -301,10 +301,12 @@ static int unit_walktoxy_timer(int tid, unsigned int tick, int id, intptr_t data
 		} else
 			sd->areanpc_id=0;
 
-		if( sd->md) unit_check_start_teleport_timer(&sd->md->bl);
-		if( sd->ed) unit_check_start_teleport_timer(&sd->ed->bl);
-		if( sd->hd) unit_check_start_teleport_timer(&sd->hd->bl);
-		if( sd->pd) unit_check_start_teleport_timer(&sd->pd->bl);
+		if(sd->md) unit_check_start_teleport_timer(&sd->md->bl);
+		if(sd->ed) unit_check_start_teleport_timer(&sd->ed->bl);
+		if(sd->hd) unit_check_start_teleport_timer(&sd->hd->bl);
+		if(sd->pd) unit_check_start_teleport_timer(&sd->pd->bl);
+		
+		pc_cell_basilica(sd);
 	} else if (md) {
 		if( map_getcell(bl->m,x,y,CELL_CHKNPC) ) {
 			if( npc_touch_areanpc2(md) )
@@ -326,10 +328,10 @@ static int unit_walktoxy_timer(int tid, unsigned int tick, int id, intptr_t data
 			clif_move(ud);
 		}
 	}
-	else if( hd) unit_check_start_teleport_timer(&hd->bl);
-	else if( ed) unit_check_start_teleport_timer(&ed->bl);
-	else if( pd) unit_check_start_teleport_timer(&pd->bl);
-	else if( mrd) unit_check_start_teleport_timer(&mrd->bl);
+	else if (hd) unit_check_start_teleport_timer(&hd->bl);
+	else if (ed) unit_check_start_teleport_timer(&ed->bl);
+	else if (pd) unit_check_start_teleport_timer(&pd->bl);
+	else if (mrd) unit_check_start_teleport_timer(&mrd->bl);
 
 	if(tid == INVALID_TIMER) // A directly invoked timer is from battle_stop_walking, therefore the rest is irrelevant.
 		return 0;