Browse Source

reset manor support

janiii 15 years ago
parent
commit
2fd490e0d8
1 changed files with 16 additions and 3 deletions
  1. 16 3
      L2_GameServer/java/com/l2jserver/gameserver/model/entity/Castle.java

+ 16 - 3
L2_GameServer/java/com/l2jserver/gameserver/model/entity/Castle.java

@@ -1361,7 +1361,7 @@ public class Castle
 			statement.setInt(1, getCastleId());
 			statement.execute();
 			statement.close();
-			if (_procure != null)
+			if (_procure != null && _procure.size() > 0)
 			{
 				int count = 0;
 				String query = "INSERT INTO castle_manor_procure VALUES ";
@@ -1383,7 +1383,7 @@ public class Castle
 					statement.close();
 				}
 			}
-			if (_procureNext != null)
+			if (_procureNext != null && _procureNext.size() > 0)
 			{
 				int count = 0;
 				String query = "INSERT INTO castle_manor_procure VALUES ";
@@ -1440,7 +1440,7 @@ public class Castle
 			List<CropProcure> proc = null;
 			proc = getCropProcure(period);
 			
-			if (proc != null)
+			if (proc != null && proc.size() > 0)
 			{
 				int count = 0;
 				String query = "INSERT INTO castle_manor_procure VALUES ";
@@ -1647,4 +1647,17 @@ public class Castle
 	{
 		return _artefacts;
 	}
+	
+	public void resetManor()
+	{
+		setCropProcure(new FastList<CropProcure>(), CastleManorManager.PERIOD_CURRENT);
+		setCropProcure(new FastList<CropProcure>(), CastleManorManager.PERIOD_NEXT);
+		setSeedProduction(new FastList<SeedProduction>(), CastleManorManager.PERIOD_CURRENT);
+		setSeedProduction(new FastList<SeedProduction>(), CastleManorManager.PERIOD_NEXT);
+		if (Config.ALT_MANOR_SAVE_ALL_ACTIONS)
+		{
+			saveCropData();
+			saveSeedData();
+		}
+	}
 }