Quellcode durchsuchen

Feature by demand: configurable boat broadcast radius.

_DS_ vor 15 Jahren
Ursprung
Commit
4d8e967193

+ 3 - 1
L2_GameServer/java/com/l2jserver/Config.java

@@ -468,6 +468,7 @@ public final class Config
 	public static boolean ALLOW_RENTPET;
 	public static boolean ALLOWFISHING;
 	public static boolean ALLOW_BOAT;
+	public static int BOAT_BROADCAST_RADIUS;
 	public static boolean ALLOW_CURSED_WEAPONS;
 	public static boolean ALLOW_MANOR;
 	public static boolean ALLOW_NPC_WALKERS;
@@ -1725,6 +1726,7 @@ public final class Config
 					ALLOWFISHING = Boolean.parseBoolean(General.getProperty("AllowFishing", "True"));
 					ALLOW_MANOR = Boolean.parseBoolean(General.getProperty("AllowManor", "True"));
 					ALLOW_BOAT = Boolean.parseBoolean(General.getProperty("AllowBoat", "True"));
+					BOAT_BROADCAST_RADIUS = Integer.parseInt(General.getProperty("BoatBroadcastRadius", "20000"));
 					ALLOW_CURSED_WEAPONS = Boolean.parseBoolean(General.getProperty("AllowCursedWeapons", "True"));
 					ALLOW_NPC_WALKERS = Boolean.parseBoolean(General.getProperty("AllowNpcWalkers", "true"));
 					ALLOW_PET_WALKERS = Boolean.parseBoolean(General.getProperty("AllowPetWalkers", "True"));
@@ -2689,7 +2691,7 @@ public final class Config
 		else if (pName.equalsIgnoreCase("WearPrice")) WEAR_PRICE = Integer.parseInt(pValue);
 		else if (pName.equalsIgnoreCase("AllowWater")) ALLOW_WATER = Boolean.parseBoolean(pValue);
 		else if (pName.equalsIgnoreCase("AllowRentPet")) ALLOW_RENTPET = Boolean.parseBoolean(pValue);
-		else if (pName.equalsIgnoreCase("AllowBoat")) ALLOW_BOAT = Boolean.parseBoolean(pValue);
+		else if (pName.equalsIgnoreCase("BoatBroadcastRadius")) BOAT_BROADCAST_RADIUS = Integer.parseInt(pValue);
 		else if (pName.equalsIgnoreCase("AllowCursedWeapons")) ALLOW_CURSED_WEAPONS = Boolean.parseBoolean(pValue);
 		else if (pName.equalsIgnoreCase("AllowManor")) ALLOW_MANOR = Boolean.parseBoolean(pValue);
 		else if (pName.equalsIgnoreCase("AllowNpcWalkers")) ALLOW_NPC_WALKERS = Boolean.parseBoolean(pValue);

+ 4 - 6
L2_GameServer/java/com/l2jserver/gameserver/instancemanager/BoatManager.java

@@ -38,8 +38,6 @@ public class BoatManager
 	public static final int GLUDIN_HARBOR = 2;
 	public static final int RUNE_HARBOR = 3;
 
-	private static final double BROADCAST_DISTANCE = 400000000; // 20000
-
 	public static final BoatManager getInstance()
 	{
 		return SingletonHolder._instance;
@@ -163,13 +161,13 @@ public class BoatManager
 
 			dx = (double)player.getX() - point1.x;
 			dy = (double)player.getY() - point1.y;
-			if ((dx*dx + dy*dy) < BROADCAST_DISTANCE)
+			if (Math.sqrt(dx*dx + dy*dy) < Config.BOAT_BROADCAST_RADIUS)
 				player.sendPacket(packet);
 			else
 			{
 				dx = (double)player.getX() - point2.x;
 				dy = (double)player.getY() - point2.y;
-				if ((dx*dx + dy*dy) < BROADCAST_DISTANCE)
+				if (Math.sqrt(dx*dx + dy*dy) < Config.BOAT_BROADCAST_RADIUS)
 					player.sendPacket(packet);
 			}
 		}
@@ -188,7 +186,7 @@ public class BoatManager
 				continue;
 			dx = (double)player.getX() - point1.x;
 			dy = (double)player.getY() - point1.y;
-			if ((dx*dx + dy*dy) < BROADCAST_DISTANCE)
+			if (Math.sqrt(dx*dx + dy*dy) < Config.BOAT_BROADCAST_RADIUS)
 			{
 				for (L2GameServerPacket p : packets)
 					player.sendPacket(p);
@@ -197,7 +195,7 @@ public class BoatManager
 			{
 				dx = (double)player.getX() - point2.x;
 				dy = (double)player.getY() - point2.y;
-				if ((dx*dx + dy*dy) < BROADCAST_DISTANCE)
+				if (Math.sqrt(dx*dx + dy*dy) < Config.BOAT_BROADCAST_RADIUS)
 					for (L2GameServerPacket p : packets)
 						player.sendPacket(p);
 			}

+ 5 - 0
L2_GameServer/java/config/General.properties

@@ -452,6 +452,11 @@ AllowFishing = True
 # Default: True
 AllowBoat = True
 
+# Boat broadcast radius.
+# If players getting annoyed by boat shouts then radius can be decreased.
+# Default: 20000
+BoatBroadcastRadius = 20000
+
 # Default: True
 AllowCursedWeapons = True