Pārlūkot izejas kodu

BETA: Config option to set offline traders invulnerable is removed.
Added a new option to set them to take damage or not. This way they can be recharged and buffed.

Nik 13 gadi atpakaļ
vecāks
revīzija
adb4392f0b

+ 2 - 2
L2J_Server_BETA/dist/game/config/l2jmods.properties

@@ -256,9 +256,9 @@ OfflineCraftEnable = False
 # Default: False
 OfflineModeInPaceZone = False
 
-# If set to True, players in off-line shop mode will be invulnerable.
+# If set to True, players in off-line shop mode wont take any damage, thus they cannot be killed.
 # Default: False
-OfflineModeSetInvulnerable = False
+OfflineModeNoDamage = False
 
 # If set to True, name color will be changed then entering offline mode
 OfflineSetNameColor = False

+ 2 - 2
L2J_Server_BETA/java/com/l2jserver/Config.java

@@ -728,7 +728,7 @@ public final class Config
 	public static boolean OFFLINE_TRADE_ENABLE;
 	public static boolean OFFLINE_CRAFT_ENABLE;
 	public static boolean OFFLINE_MODE_IN_PEACE_ZONE;
-	public static boolean OFFLINE_MODE_SET_INVULNERABLE;
+	public static boolean OFFLINE_MODE_NO_DAMAGE;
 	public static boolean RESTORE_OFFLINERS;
 	public static int OFFLINE_MAX_DAYS;
 	public static boolean OFFLINE_DISCONNECT_FINISHED;
@@ -2572,7 +2572,7 @@ public final class Config
 					OFFLINE_TRADE_ENABLE = Boolean.parseBoolean(L2JModSettings.getProperty("OfflineTradeEnable", "false"));
 					OFFLINE_CRAFT_ENABLE = Boolean.parseBoolean(L2JModSettings.getProperty("OfflineCraftEnable", "false"));
 					OFFLINE_MODE_IN_PEACE_ZONE = Boolean.parseBoolean(L2JModSettings.getProperty("OfflineModeInPaceZone", "False"));
-					OFFLINE_MODE_SET_INVULNERABLE = Boolean.parseBoolean(L2JModSettings.getProperty("OfflineModeSetInvulnerable", "False"));
+					OFFLINE_MODE_NO_DAMAGE = Boolean.parseBoolean(L2JModSettings.getProperty("OfflineModeNoDamage", "False"));
 					OFFLINE_SET_NAME_COLOR = Boolean.parseBoolean(L2JModSettings.getProperty("OfflineSetNameColor", "false"));
 					OFFLINE_NAME_COLOR = Integer.decode("0x" + L2JModSettings.getProperty("OfflineNameColor", "808080"));
 					OFFLINE_FAME = Boolean.parseBoolean(L2JModSettings.getProperty("OfflineFame", "true"));

+ 0 - 2
L2J_Server_BETA/java/com/l2jserver/gameserver/datatables/OfflineTradersTable.java

@@ -222,8 +222,6 @@ public class OfflineTradersTable
 					stm_items.close();
 					
 					player.sitDown();
-					if (Config.OFFLINE_MODE_SET_INVULNERABLE)
-						player.setIsInvul(true);
 					if (Config.OFFLINE_SET_NAME_COLOR)
 						player.getAppearance().setNameColor(Config.OFFLINE_NAME_COLOR);
 					player.setPrivateStoreType(type);

+ 8 - 0
L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/status/PcStatus.java

@@ -68,6 +68,14 @@ public class PcStatus extends PlayableStatus
 		if (getActiveChar().isDead())
 			return;
 		
+		// If OFFLINE_MODE_NO_DAMAGE is enabled and player is offline and he is in store/craft mode, no damage is taken.
+		if (Config.OFFLINE_MODE_NO_DAMAGE && getActiveChar().getClient() != null && getActiveChar().getClient().isDetached()
+			&& ((Config.OFFLINE_TRADE_ENABLE && ((getActiveChar().getPrivateStoreType() == L2PcInstance.STORE_PRIVATE_SELL) || (getActiveChar().getPrivateStoreType() == L2PcInstance.STORE_PRIVATE_BUY)))
+			|| (Config.OFFLINE_CRAFT_ENABLE && (getActiveChar().isInCraftMode() || (getActiveChar().getPrivateStoreType() == L2PcInstance.STORE_PRIVATE_MANUFACTURE)))))
+		{
+			return;
+		}
+		
 		if (getActiveChar().isInvul() && !(isDOT || isHPConsumption))
 			return;
 		

+ 0 - 3
L2J_Server_BETA/java/com/l2jserver/gameserver/network/L2GameClient.java

@@ -766,9 +766,6 @@ public final class L2GameClient extends MMOClient<MMOConnection<L2GameClient>> i
 							}
 						}
 						
-						if (Config.OFFLINE_MODE_SET_INVULNERABLE)
-							getActiveChar().setIsInvul(true);
-						
 						if (Config.OFFLINE_SET_NAME_COLOR)
 						{
 							getActiveChar().getAppearance().setNameColor(Config.OFFLINE_NAME_COLOR);