Browse Source

Teleport and Map Warp Portals
- Added a battle_config to allow avoidance of Teleporting on top of Map Warp Portals. (bugreport:8584)
- Officially no one has been able to Teleport on top of a Map Warp Portal.

aleos89 11 năm trước cách đây
mục cha
commit
931f26065c
5 tập tin đã thay đổi với 33 bổ sung28 xóa
  1. 4 0
      conf/battle/skill.conf
  2. 1 0
      src/map/battle.c
  3. 1 0
      src/map/battle.h
  4. 19 19
      src/map/map.h
  5. 8 9
      src/map/pc.c

+ 4 - 0
conf/battle/skill.conf

@@ -298,3 +298,7 @@ path_blown_halt: yes
 // 1: All 5 of the Goblin monsters will count, regardless of Mob ID (Mob ID: 1122-1126) - iRO default
 // 2: Any monster with the same exact name will count, regardless of Mob ID - Comparison based off of jName
 taekwon_mission_mobname: 0
+
+// Can a player Teleport on top of a Map Warp Portal? (Note 1)
+// On official servers players have been unable to do so.
+teleport_on_portal: no

+ 1 - 0
src/map/battle.c

@@ -7372,6 +7372,7 @@ static const struct _battle_data {
 	{ "rental_mount_speed_boost",           &battle_config.rental_mount_speed_boost,        25,     0,      100,        	},
 	{ "feature.warp_suggestions",           &battle_config.warp_suggestions_enabled,        0,      0,      1,              },
 	{ "taekwon_mission_mobname",            &battle_config.taekwon_mission_mobname,         0,      0,      2,              },
+	{ "teleport_on_portal",                 &battle_config.teleport_on_portal,              0,      0,      1,              },
 };
 #ifndef STATS_OPT_OUT
 /**

+ 1 - 0
src/map/battle.h

@@ -534,6 +534,7 @@ extern struct Battle_Config
 	int rental_mount_speed_boost;
 	int warp_suggestions_enabled;
 	int taekwon_mission_mobname;
+	int teleport_on_portal;
 } battle_config;
 
 void do_init_battle(void);

+ 19 - 19
src/map/map.h

@@ -515,25 +515,25 @@ typedef enum {
 
 // used by map_getcell()
 typedef enum {
-	CELL_GETTYPE,		// retrieves a cell's 'gat' type
-
-	CELL_CHKWALL,		// wall (gat type 1)
-	CELL_CHKWATER,		// water (gat type 3)
-	CELL_CHKCLIFF,		// cliff/gap (gat type 5)
-
-	CELL_CHKPASS,		// passable cell (gat type non-1/5)
-	CELL_CHKREACH,		// Same as PASS, but ignores the cell-stacking mod.
-	CELL_CHKNOPASS,		// non-passable cell (gat types 1 and 5)
-	CELL_CHKNOREACH,	// Same as NOPASS, but ignores the cell-stacking mod.
-	CELL_CHKSTACK,		// whether cell is full (reached cell stacking limit)
-
-	CELL_CHKNPC,
-	CELL_CHKBASILICA,
-	CELL_CHKLANDPROTECTOR,
-	CELL_CHKNOVENDING,
-	CELL_CHKNOCHAT,
-	CELL_CHKMAELSTROM,
-	CELL_CHKICEWALL,
+	CELL_GETTYPE,			// Retrieves a cell's 'gat' type
+
+	CELL_CHKWALL,			// Whether the cell is a wall (gat type 1)
+	CELL_CHKWATER,			// Whether the cell is water (gat type 3)
+	CELL_CHKCLIFF,			// Whether the cell is a cliff/gap (gat type 5)
+
+	CELL_CHKPASS,			// Whether the cell is passable (gat type not 1 and 5)
+	CELL_CHKREACH,			// Whether the cell is passable, but ignores the cell stacking limit
+	CELL_CHKNOPASS,			// Whether the cell is non-passable (gat types 1 and 5)
+	CELL_CHKNOREACH,		// Whether the cell is non-passable, but ignores the cell stacking limit
+	CELL_CHKSTACK,			// Whether the cell is full (reached cell stacking limit)
+
+	CELL_CHKNPC,			// Whether the cell has an OnTouch NPC
+	CELL_CHKBASILICA,		// Whether the cell has Basilica
+	CELL_CHKLANDPROTECTOR,	// Whether the cell has Land Protector
+	CELL_CHKNOVENDING,		// Whether the cell denies MC_VENDING skill
+	CELL_CHKNOCHAT,			// Whether the cell denies Player Chat Window
+	CELL_CHKMAELSTROM,		// Whether the cell has Maelstrom
+	CELL_CHKICEWALL,		// Whether the cell has Ice Wall
 
 } cell_chk;
 

+ 8 - 9
src/map/pc.c

@@ -5015,12 +5015,11 @@ int pc_setpos(struct map_session_data* sd, unsigned short mapindex, int x, int y
 		x = y = 0; // make it random
 	}
 
-	if( x == 0 && y == 0 )
-	{// pick a random walkable cell
+	if( x == 0 && y == 0 ) { // pick a random walkable cell
 		do {
-			x=rnd()%(map[m].xs-2)+1;
-			y=rnd()%(map[m].ys-2)+1;
-		} while(map_getcell(m,x,y,CELL_CHKNOPASS));
+			x = rnd()%(map[m].xs-2)+1;
+			y = rnd()%(map[m].ys-2)+1;
+		} while(map_getcell(m,x,y,CELL_CHKNOPASS) || (!battle_config.teleport_on_portal && npc_check_areanpc(1,m,x,y,1)));
 	}
 
 	if (sd->state.vending && map_getcell(m,x,y,CELL_CHKNOVENDING)) {
@@ -5093,10 +5092,10 @@ int pc_randomwarp(struct map_session_data *sd, clr_type type)
 	if (map[sd->bl.m].flag.noteleport) //Teleport forbidden
 		return 0;
 
-	do{
-		x=rnd()%(map[m].xs-2)+1;
-		y=rnd()%(map[m].ys-2)+1;
-	}while(map_getcell(m,x,y,CELL_CHKNOPASS) && (i++)<1000 );
+	do {
+		x = rnd()%(map[m].xs-2)+1;
+		y = rnd()%(map[m].ys-2)+1;
+	} while((map_getcell(m,x,y,CELL_CHKNOPASS) || (!battle_config.teleport_on_portal && npc_check_areanpc(1,m,x,y,1))) && (i++) < 1000);
 
 	if (i < 1000)
 		return pc_setpos(sd,map[sd->bl.m].index,x,y,type);