浏览代码

BETA: Blood Alliance and Blood Oath implementation logic fix:
* Now this values for reward are stored in clan data instead of castle or fort data.
* Fix for #6352

Patch by: VlLight, Zoey76

Zoey76 12 年之前
父节点
当前提交
2428e1f298

+ 3 - 0
L2J_Server_BETA/dist/game/config/Feature.properties

@@ -287,6 +287,9 @@ SevenSignsDawnTicketBundle = 10
 # Default: 6388
 # Default: 6388
 SevenSignsManorsAgreementId = 6388
 SevenSignsManorsAgreementId = 6388
 
 
+# Fee for joining Dawn
+SevenSignsJoinDawnFee = 50000
+
 
 
 # ---------------------------------------------------------------------------
 # ---------------------------------------------------------------------------
 # Clan Reputation Points
 # Clan Reputation Points

+ 2 - 1
L2J_Server_BETA/java/com/l2jserver/gameserver/FortUpdater.java

@@ -62,7 +62,8 @@ public class FortUpdater implements Runnable
 						return;
 						return;
 					}
 					}
 					
 					
-					_fort.setBloodOathReward(_fort.getBloodOathReward() + Config.FS_BLOOD_OATH_COUNT);
+					_fort.getOwnerClan().increaseBloodOathCount();
+					
 					if (_fort.getFortState() == 2)
 					if (_fort.getFortState() == 2)
 					{
 					{
 						if (_clan.getWarehouse().getAdena() >= Config.FS_FEE_FOR_CASTLE)
 						if (_clan.getWarehouse().getAdena() >= Config.FS_FEE_FOR_CASTLE)

+ 114 - 21
L2J_Server_BETA/java/com/l2jserver/gameserver/model/L2Clan.java

@@ -73,14 +73,14 @@ import com.l2jserver.gameserver.scripting.scriptengine.listeners.clan.ClanCreati
 import com.l2jserver.gameserver.scripting.scriptengine.listeners.clan.ClanMembershipListener;
 import com.l2jserver.gameserver.scripting.scriptengine.listeners.clan.ClanMembershipListener;
 import com.l2jserver.gameserver.util.Util;
 import com.l2jserver.gameserver.util.Util;
 
 
-/**
- * This class ...
- * @version $Revision: 1.7.2.4.2.7 $ $Date: 2005/04/06 16:13:41 $
- */
 public class L2Clan
 public class L2Clan
 {
 {
 	private static final Logger _log = Logger.getLogger(L2Clan.class.getName());
 	private static final Logger _log = Logger.getLogger(L2Clan.class.getName());
 	
 	
+	// SQL queries
+	private static final String INSERT_CLAN_DATA = "INSERT INTO clan_data (clan_id,clan_name,clan_level,hasCastle,blood_alliance_count,blood_oath_count,ally_id,ally_name,leader_id,crest_id,crest_large_id,ally_crest_id) values (?,?,?,?,?,?,?,?,?,?,?)";
+	private static final String SELECT_CLAN_DATA = "SELECT clan_name,clan_level,hasCastle,blood_alliance_count,blood_oath_count,ally_id,ally_name,leader_id,crest_id,crest_large_id,ally_crest_id,reputation_score,auction_bid_at,ally_penalty_expiry_time,ally_penalty_type,char_penalty_expiry_time,dissolving_expiry_time FROM clan_data where clan_id=?";
+	
 	private static List<ClanCreationListener> clanCreationListeners = new FastList<ClanCreationListener>().shared();
 	private static List<ClanCreationListener> clanCreationListeners = new FastList<ClanCreationListener>().shared();
 	private static List<ClanMembershipListener> clanMembershipListeners = new FastList<ClanMembershipListener>().shared();
 	private static List<ClanMembershipListener> clanMembershipListeners = new FastList<ClanMembershipListener>().shared();
 	
 	
@@ -104,6 +104,9 @@ public class L2Clan
 	private int _allyPenaltyType;
 	private int _allyPenaltyType;
 	private long _charPenaltyExpiryTime;
 	private long _charPenaltyExpiryTime;
 	private long _dissolvingExpiryTime;
 	private long _dissolvingExpiryTime;
+	private int _bloodAllianceCount;
+	private int _bloodOathCount;
+	
 	// Ally Penalty Types
 	// Ally Penalty Types
 	/** Clan leaved ally */
 	/** Clan leaved ally */
 	public static final int PENALTY_TYPE_CLAN_LEAVED = 1;
 	public static final int PENALTY_TYPE_CLAN_LEAVED = 1;
@@ -830,6 +833,94 @@ public class L2Clan
 		return (id == 0 ? false : _members.containsKey(id));
 		return (id == 0 ? false : _members.containsKey(id));
 	}
 	}
 	
 	
+	/**
+	 * @return the Blood Alliance count for this clan
+	 */
+	public int getBloodAllianceCount()
+	{
+		return _bloodAllianceCount;
+	}
+	
+	/**
+	 * Increase Blood Alliance count by config predefined count and updates the database.
+	 */
+	public void increaseBloodAllianceCount()
+	{
+		_bloodAllianceCount += SiegeManager.getInstance().getBloodAllianceReward();
+		updateBloodAllianceCountInDB();
+	}
+	
+	/**
+	 * Reset the Blood Alliance count to zero and updates the database.
+	 */
+	public void resetBloodAllianceCount()
+	{
+		_bloodAllianceCount = 0;
+		updateBloodAllianceCountInDB();
+	}
+	
+	/**
+	 * Store current Bloood Alliances count in database.
+	 */
+	public void updateBloodAllianceCountInDB()
+	{
+		try (Connection con = L2DatabaseFactory.getInstance().getConnection();
+			PreparedStatement statement = con.prepareStatement("UPDATE clan_data SET blood_alliance_count=? WHERE clan_id=?"))
+		{
+			statement.setInt(1, getBloodAllianceCount());
+			statement.setInt(2, getClanId());
+			statement.execute();
+		}
+		catch (Exception e)
+		{
+			_log.log(Level.WARNING, "Exception on updateBloodAllianceCountInDB(): " + e.getMessage(), e);
+		}
+	}
+	
+	/**
+	 * @return the Blood Oath count for this clan
+	 */
+	public int getBloodOathCount()
+	{
+		return _bloodOathCount;
+	}
+	
+	/**
+	 * Increase Blood Oath count by config predefined count and updates the database.
+	 */
+	public void increaseBloodOathCount()
+	{
+		_bloodOathCount += Config.FS_BLOOD_OATH_COUNT;
+		updateBloodOathCountInDB();
+	}
+	
+	/**
+	 * Reset the Blood Oath count to zero and updates the database.
+	 */
+	public void resetBloodOathCount()
+	{
+		_bloodOathCount = 0;
+		updateBloodOathCountInDB();
+	}
+	
+	/**
+	 * Store current Bloood Alliances count in database.
+	 */
+	public void updateBloodOathCountInDB()
+	{
+		try (Connection con = L2DatabaseFactory.getInstance().getConnection();
+			PreparedStatement ps = con.prepareStatement("UPDATE clan_data SET blood_oath_count=? WHERE clan_id=?"))
+		{
+			ps.setInt(1, getBloodOathCount());
+			ps.setInt(2, getClanId());
+			ps.execute();
+		}
+		catch (Exception e)
+		{
+			_log.log(Level.WARNING, "Exception on updateBloodAllianceCountInDB(): " + e.getMessage(), e);
+		}
+	}
+	
 	/**
 	/**
 	 * Store in database current clan's reputation.
 	 * Store in database current clan's reputation.
 	 */
 	 */
@@ -906,21 +997,22 @@ public class L2Clan
 	 */
 	 */
 	public void store()
 	public void store()
 	{
 	{
-		try (Connection con = L2DatabaseFactory.getInstance().getConnection())
-		{
-			final PreparedStatement statement = con.prepareStatement("INSERT INTO clan_data (clan_id,clan_name,clan_level,hasCastle,ally_id,ally_name,leader_id,crest_id,crest_large_id,ally_crest_id) values (?,?,?,?,?,?,?,?,?,?)");
-			statement.setInt(1, getClanId());
-			statement.setString(2, getName());
-			statement.setInt(3, getLevel());
-			statement.setInt(4, getCastleId());
-			statement.setInt(5, getAllyId());
-			statement.setString(6, getAllyName());
-			statement.setInt(7, getLeaderId());
-			statement.setInt(8, getCrestId());
-			statement.setInt(9, getCrestLargeId());
-			statement.setInt(10, getAllyCrestId());
-			statement.execute();
-			statement.close();
+		try (Connection con = L2DatabaseFactory.getInstance().getConnection();
+			PreparedStatement ps = con.prepareStatement(INSERT_CLAN_DATA))
+		{
+			ps.setInt(1, getClanId());
+			ps.setString(2, getName());
+			ps.setInt(3, getLevel());
+			ps.setInt(4, getCastleId());
+			ps.setInt(5, getBloodAllianceCount());
+			ps.setInt(6, getBloodOathCount());
+			ps.setInt(7, getAllyId());
+			ps.setString(8, getAllyName());
+			ps.setInt(9, getLeaderId());
+			ps.setInt(10, getCrestId());
+			ps.setInt(11, getCrestLargeId());
+			ps.setInt(12, getAllyCrestId());
+			ps.execute();
 			if (Config.DEBUG)
 			if (Config.DEBUG)
 			{
 			{
 				_log.fine("New clan saved in db: " + getClanId());
 				_log.fine("New clan saved in db: " + getClanId());
@@ -987,9 +1079,8 @@ public class L2Clan
 	
 	
 	private void restore()
 	private void restore()
 	{
 	{
-		// restorewars();
 		try (Connection con = L2DatabaseFactory.getInstance().getConnection();
 		try (Connection con = L2DatabaseFactory.getInstance().getConnection();
-			PreparedStatement statement = con.prepareStatement("SELECT clan_name,clan_level,hasCastle,ally_id,ally_name,leader_id,crest_id,crest_large_id,ally_crest_id,reputation_score,auction_bid_at,ally_penalty_expiry_time,ally_penalty_type,char_penalty_expiry_time,dissolving_expiry_time FROM clan_data where clan_id=?"))
+			PreparedStatement statement = con.prepareStatement(SELECT_CLAN_DATA))
 		{
 		{
 			statement.setInt(1, getClanId());
 			statement.setInt(1, getClanId());
 			try (ResultSet clanData = statement.executeQuery())
 			try (ResultSet clanData = statement.executeQuery())
@@ -999,6 +1090,8 @@ public class L2Clan
 					setName(clanData.getString("clan_name"));
 					setName(clanData.getString("clan_name"));
 					setLevel(clanData.getInt("clan_level"));
 					setLevel(clanData.getInt("clan_level"));
 					setCastleId(clanData.getInt("hasCastle"));
 					setCastleId(clanData.getInt("hasCastle"));
+					_bloodAllianceCount = clanData.getInt("blood_alliance_count");
+					_bloodOathCount = clanData.getInt("blood_Oath_count");
 					setAllyId(clanData.getInt("ally_id"));
 					setAllyId(clanData.getInt("ally_id"));
 					setAllyName(clanData.getString("ally_name"));
 					setAllyName(clanData.getString("ally_name"));
 					setAllyPenaltyExpiryTime(clanData.getLong("ally_penalty_expiry_time"), clanData.getInt("ally_penalty_type"));
 					setAllyPenaltyExpiryTime(clanData.getLong("ally_penalty_expiry_time"), clanData.getInt("ally_penalty_type"));

+ 15 - 42
L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/instance/L2FortLogisticsInstance.java

@@ -23,11 +23,10 @@ import com.l2jserver.gameserver.network.serverpackets.ActionFailed;
 import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
 import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
 
 
 /**
 /**
- * @author Vice
+ * @author Vice, Zoey76
  */
  */
 public class L2FortLogisticsInstance extends L2MerchantInstance
 public class L2FortLogisticsInstance extends L2MerchantInstance
 {
 {
-	private static final int BLOOD_OATH = 9910;
 	private static final int[] SUPPLY_BOX_IDS =
 	private static final int[] SUPPLY_BOX_IDS =
 	{
 	{
 		35665,
 		35665,
@@ -62,7 +61,6 @@ public class L2FortLogisticsInstance extends L2MerchantInstance
 	@Override
 	@Override
 	public void onBypassFeedback(L2PcInstance player, String command)
 	public void onBypassFeedback(L2PcInstance player, String command)
 	{
 	{
-		// BypassValidation Exploit plug.
 		if (player.getLastFolkNPC().getObjectId() != getObjectId())
 		if (player.getLastFolkNPC().getObjectId() != getObjectId())
 		{
 		{
 			return;
 			return;
@@ -71,60 +69,44 @@ public class L2FortLogisticsInstance extends L2MerchantInstance
 		StringTokenizer st = new StringTokenizer(command, " ");
 		StringTokenizer st = new StringTokenizer(command, " ");
 		String actualCommand = st.nextToken(); // Get actual command
 		String actualCommand = st.nextToken(); // Get actual command
 		
 		
+		final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
 		if (actualCommand.equalsIgnoreCase("rewards"))
 		if (actualCommand.equalsIgnoreCase("rewards"))
 		{
 		{
-			if (player.isClanLeader() && (getFort().getOwnerClan() != null) && (player.getClan() == getFort().getOwnerClan()))
+			if (isMyLord(player))
 			{
 			{
-				NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
 				html.setFile(player.getHtmlPrefix(), "data/html/fortress/logistics-rewards.htm");
 				html.setFile(player.getHtmlPrefix(), "data/html/fortress/logistics-rewards.htm");
-				int blood = getFort().getBloodOathReward();
-				html.replace("%objectId%", String.valueOf(getObjectId()));
-				html.replace("%bloodoath%", String.valueOf(blood));
-				player.sendPacket(html);
+				html.replace("%bloodoath%", String.valueOf(player.getClan().getBloodOathCount()));
 			}
 			}
 			else
 			else
 			{
 			{
-				NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
 				html.setFile(player.getHtmlPrefix(), "data/html/fortress/logistics-noprivs.htm");
 				html.setFile(player.getHtmlPrefix(), "data/html/fortress/logistics-noprivs.htm");
-				html.replace("%objectId%", String.valueOf(getObjectId()));
-				player.sendPacket(html);
 			}
 			}
-			return;
 		}
 		}
 		else if (actualCommand.equalsIgnoreCase("blood"))
 		else if (actualCommand.equalsIgnoreCase("blood"))
 		{
 		{
-			if ((player.getClan() != null) && (getFort().getOwnerClan() != null) && (player.getClan() == getFort().getOwnerClan()) && player.isClanLeader())
+			if (isMyLord(player))
 			{
 			{
-				NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
-				int blood = getFort().getBloodOathReward();
+				final int blood = player.getClan().getBloodOathCount();
 				if (blood > 0)
 				if (blood > 0)
 				{
 				{
 					html.setFile(player.getHtmlPrefix(), "data/html/fortress/logistics-blood.htm");
 					html.setFile(player.getHtmlPrefix(), "data/html/fortress/logistics-blood.htm");
-					player.addItem("Quest", BLOOD_OATH, blood, this, true);
-					getFort().setBloodOathReward(0);
-					getFort().saveFortVariables();
+					player.addItem("Quest", 9910, blood, this, true);
+					player.getClan().resetBloodOathCount();
 				}
 				}
 				else
 				else
 				{
 				{
 					html.setFile(player.getHtmlPrefix(), "data/html/fortress/logistics-noblood.htm");
 					html.setFile(player.getHtmlPrefix(), "data/html/fortress/logistics-noblood.htm");
 				}
 				}
-				html.replace("%objectId%", String.valueOf(getObjectId()));
-				player.sendPacket(html);
 			}
 			}
 			else
 			else
 			{
 			{
-				NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
 				html.setFile(player.getHtmlPrefix(), "data/html/fortress/logistics-noprivs.htm");
 				html.setFile(player.getHtmlPrefix(), "data/html/fortress/logistics-noprivs.htm");
-				html.replace("%objectId%", String.valueOf(getObjectId()));
-				player.sendPacket(html);
 			}
 			}
-			return;
 		}
 		}
 		else if (actualCommand.equalsIgnoreCase("supplylvl"))
 		else if (actualCommand.equalsIgnoreCase("supplylvl"))
 		{
 		{
 			if ((player.getClan() != null) && (getFort().getOwnerClan() != null) && (player.getClan() == getFort().getOwnerClan()) && (getFort().getFortState() == 2))
 			if ((player.getClan() != null) && (getFort().getOwnerClan() != null) && (player.getClan() == getFort().getOwnerClan()) && (getFort().getFortState() == 2))
 			{
 			{
-				NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
 				if (player.isClanLeader())
 				if (player.isClanLeader())
 				{
 				{
 					html.setFile(player.getHtmlPrefix(), "data/html/fortress/logistics-supplylvl.htm");
 					html.setFile(player.getHtmlPrefix(), "data/html/fortress/logistics-supplylvl.htm");
@@ -134,23 +116,16 @@ public class L2FortLogisticsInstance extends L2MerchantInstance
 				{
 				{
 					html.setFile(player.getHtmlPrefix(), "data/html/fortress/logistics-noprivs.htm");
 					html.setFile(player.getHtmlPrefix(), "data/html/fortress/logistics-noprivs.htm");
 				}
 				}
-				html.replace("%objectId%", String.valueOf(getObjectId()));
-				player.sendPacket(html);
 			}
 			}
 			else
 			else
 			{
 			{
-				NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
 				html.setFile(player.getHtmlPrefix(), "data/html/fortress/logistics-1.htm");
 				html.setFile(player.getHtmlPrefix(), "data/html/fortress/logistics-1.htm");
-				html.replace("%objectId%", String.valueOf(getObjectId()));
-				player.sendPacket(html);
 			}
 			}
-			return;
 		}
 		}
 		else if (actualCommand.equalsIgnoreCase("supply"))
 		else if (actualCommand.equalsIgnoreCase("supply"))
 		{
 		{
-			if ((player.getClan() != null) && (getFort().getOwnerClan() != null) && (player.getClan() == getFort().getOwnerClan()) && player.isClanLeader())
+			if (isMyLord(player))
 			{
 			{
-				NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
 				if (getFort().getSiege().getIsInProgress())
 				if (getFort().getSiege().getIsInProgress())
 				{
 				{
 					html.setFile(player.getHtmlPrefix(), "data/html/fortress/logistics-siege.htm");
 					html.setFile(player.getHtmlPrefix(), "data/html/fortress/logistics-siege.htm");
@@ -167,7 +142,6 @@ public class L2FortLogisticsInstance extends L2MerchantInstance
 						box.setCurrentHp(box.getMaxHp());
 						box.setCurrentHp(box.getMaxHp());
 						box.setCurrentMp(box.getMaxMp());
 						box.setCurrentMp(box.getMaxMp());
 						box.setHeading(0);
 						box.setHeading(0);
-						// L2World.getInstance().storeObject(box);
 						box.spawnMe(getX() - 23, getY() + 41, getZ());
 						box.spawnMe(getX() - 23, getY() + 41, getZ());
 						
 						
 						getFort().setSupplyLvL(0);
 						getFort().setSupplyLvL(0);
@@ -178,19 +152,18 @@ public class L2FortLogisticsInstance extends L2MerchantInstance
 						html.setFile(player.getHtmlPrefix(), "data/html/fortress/logistics-nosupply.htm");
 						html.setFile(player.getHtmlPrefix(), "data/html/fortress/logistics-nosupply.htm");
 					}
 					}
 				}
 				}
-				html.replace("%objectId%", String.valueOf(getObjectId()));
-				player.sendPacket(html);
 			}
 			}
 			else
 			else
 			{
 			{
-				NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
 				html.setFile(player.getHtmlPrefix(), "data/html/fortress/logistics-noprivs.htm");
 				html.setFile(player.getHtmlPrefix(), "data/html/fortress/logistics-noprivs.htm");
-				html.replace("%objectId%", String.valueOf(getObjectId()));
-				player.sendPacket(html);
 			}
 			}
-			return;
+			html.replace("%objectId%", String.valueOf(getObjectId()));
+			player.sendPacket(html);
+		}
+		else
+		{
+			super.onBypassFeedback(player, command);
 		}
 		}
-		super.onBypassFeedback(player, command);
 	}
 	}
 	
 	
 	@Override
 	@Override

+ 0 - 25
L2J_Server_BETA/java/com/l2jserver/gameserver/model/entity/Castle.java

@@ -92,7 +92,6 @@ public class Castle
 	private final TIntIntHashMap _engrave = new TIntIntHashMap(1);
 	private final TIntIntHashMap _engrave = new TIntIntHashMap(1);
 	private final Map<Integer, CastleFunction> _function;
 	private final Map<Integer, CastleFunction> _function;
 	private final List<L2Skill> _residentialSkills = new ArrayList<>();
 	private final List<L2Skill> _residentialSkills = new ArrayList<>();
-	private int _bloodAlliance = 0;
 	private int _ticketBuyCount = 0;
 	private int _ticketBuyCount = 0;
 	
 	
 	private List<CropProcure> _procure = new ArrayList<>();
 	private List<CropProcure> _procure = new ArrayList<>();
@@ -749,8 +748,6 @@ public class Castle
 					
 					
 					_showNpcCrest = rs.getBoolean("showNpcCrest");
 					_showNpcCrest = rs.getBoolean("showNpcCrest");
 					
 					
-					_bloodAlliance = rs.getInt("bloodAlliance");
-					
 					_ticketBuyCount = rs.getInt("ticketBuyCount");
 					_ticketBuyCount = rs.getInt("ticketBuyCount");
 				}
 				}
 			}
 			}
@@ -1567,28 +1564,6 @@ public class Castle
 		}
 		}
 	}
 	}
 	
 	
-	public int getBloodAlliance()
-	{
-		return _bloodAlliance;
-	}
-	
-	public void setBloodAlliance(int count)
-	{
-		_bloodAlliance = count;
-		
-		try (Connection con = L2DatabaseFactory.getInstance().getConnection();
-			PreparedStatement statement = con.prepareStatement("UPDATE castle SET bloodAlliance = ? WHERE id = ?"))
-		{
-			statement.setInt(1, _bloodAlliance);
-			statement.setInt(2, _castleId);
-			statement.execute();
-		}
-		catch (Exception e)
-		{
-			_log.log(Level.WARNING, e.getMessage(), e);
-		}
-	}
-	
 	/**
 	/**
 	 * @return the tickets exchanged for this castle
 	 * @return the tickets exchanged for this castle
 	 */
 	 */

+ 6 - 23
L2J_Server_BETA/java/com/l2jserver/gameserver/model/entity/Fort.java

@@ -80,7 +80,6 @@ public class Fort
 	private int _fortType = 0;
 	private int _fortType = 0;
 	private int _state = 0;
 	private int _state = 0;
 	private int _castleId = 0;
 	private int _castleId = 0;
-	private int _blood = 0;
 	private int _supplyLvL = 0;
 	private int _supplyLvL = 0;
 	private final FastMap<Integer, FortFunction> _function;
 	private final FastMap<Integer, FortFunction> _function;
 	private final FastList<L2Skill> _residentialSkills = new FastList<>();
 	private final FastList<L2Skill> _residentialSkills = new FastList<>();
@@ -489,7 +488,6 @@ public class Fort
 			FortManager.getInstance().getFortByOwner(clan).removeOwner(true);
 			FortManager.getInstance().getFortByOwner(clan).removeOwner(true);
 		}
 		}
 		
 		
-		setBloodOathReward(0);
 		setSupplyLvL(0);
 		setSupplyLvL(0);
 		setOwnerClan(clan);
 		setOwnerClan(clan);
 		updateOwnerInDB(); // Update in database
 		updateOwnerInDB(); // Update in database
@@ -521,7 +519,6 @@ public class Fort
 			clan.setFortId(0);
 			clan.setFortId(0);
 			clan.broadcastToOnlineMembers(new PledgeShowInfoUpdate(clan));
 			clan.broadcastToOnlineMembers(new PledgeShowInfoUpdate(clan));
 			setOwnerClan(null);
 			setOwnerClan(null);
-			setBloodOathReward(0);
 			setSupplyLvL(0);
 			setSupplyLvL(0);
 			saveFortVariables();
 			saveFortVariables();
 			removeAllFunctions();
 			removeAllFunctions();
@@ -532,16 +529,6 @@ public class Fort
 		}
 		}
 	}
 	}
 	
 	
-	public void setBloodOathReward(int val)
-	{
-		_blood = val;
-	}
-	
-	public int getBloodOathReward()
-	{
-		return _blood;
-	}
-	
 	public void raiseSupplyLvL()
 	public void raiseSupplyLvL()
 	{
 	{
 		_supplyLvL++;
 		_supplyLvL++;
@@ -567,11 +554,10 @@ public class Fort
 	public void saveFortVariables()
 	public void saveFortVariables()
 	{
 	{
 		try (Connection con = L2DatabaseFactory.getInstance().getConnection();
 		try (Connection con = L2DatabaseFactory.getInstance().getConnection();
-			PreparedStatement ps = con.prepareStatement("UPDATE fort SET blood=?, supplyLvL=? WHERE id = ?"))
+			PreparedStatement ps = con.prepareStatement("UPDATE fort SET supplyLvL=? WHERE id = ?"))
 		{
 		{
-			ps.setInt(1, _blood);
-			ps.setInt(2, _supplyLvL);
-			ps.setInt(3, getFortId());
+			ps.setInt(1, _supplyLvL);
+			ps.setInt(2, getFortId());
 			ps.execute();
 			ps.execute();
 		}
 		}
 		catch (Exception e)
 		catch (Exception e)
@@ -581,8 +567,7 @@ public class Fort
 	}
 	}
 	
 	
 	/**
 	/**
-	 * Show or hide flag inside flagpole<BR>
-	 * <BR>
+	 * Show or hide flag inside flag pole.
 	 * @param val
 	 * @param val
 	 */
 	 */
 	public void setVisibleFlag(boolean val)
 	public void setVisibleFlag(boolean val)
@@ -653,7 +638,6 @@ public class Fort
 					_fortType = rs.getInt("fortType");
 					_fortType = rs.getInt("fortType");
 					_state = rs.getInt("state");
 					_state = rs.getInt("state");
 					_castleId = rs.getInt("castleId");
 					_castleId = rs.getInt("castleId");
-					_blood = rs.getInt("blood");
 					_supplyLvL = rs.getInt("supplyLvL");
 					_supplyLvL = rs.getInt("supplyLvL");
 				}
 				}
 			}
 			}
@@ -888,14 +872,13 @@ public class Fort
 		}
 		}
 		
 		
 		try (Connection con = L2DatabaseFactory.getInstance().getConnection();
 		try (Connection con = L2DatabaseFactory.getInstance().getConnection();
-			PreparedStatement ps = con.prepareStatement("UPDATE fort SET owner=?,lastOwnedTime=?,state=?,castleId=?,blood=? WHERE id = ?"))
+			PreparedStatement ps = con.prepareStatement("UPDATE fort SET owner=?,lastOwnedTime=?,state=?,castleId=? WHERE id = ?"))
 		{
 		{
 			ps.setInt(1, clanId);
 			ps.setInt(1, clanId);
 			ps.setLong(2, _lastOwnedTime.getTimeInMillis());
 			ps.setLong(2, _lastOwnedTime.getTimeInMillis());
 			ps.setInt(3, 0);
 			ps.setInt(3, 0);
 			ps.setInt(4, 0);
 			ps.setInt(4, 0);
-			ps.setInt(5, getBloodOathReward());
-			ps.setInt(6, getFortId());
+			ps.setInt(5, getFortId());
 			ps.execute();
 			ps.execute();
 			
 			
 			// Announce to clan members
 			// Announce to clan members

+ 4 - 8
L2J_Server_BETA/java/com/l2jserver/gameserver/model/entity/Siege.java

@@ -272,16 +272,10 @@ public class Siege implements Siegable
 				if (clan.getClanId() == _firstOwnerClanId)
 				if (clan.getClanId() == _firstOwnerClanId)
 				{
 				{
 					// Owner is unchanged
 					// Owner is unchanged
-					final int num = SiegeManager.getInstance().getBloodAllianceReward();
-					int count = getCastle().getBloodAlliance();
-					if (num > 0)
-					{
-						getCastle().setBloodAlliance(count + num);
-					}
+					clan.increaseBloodAllianceCount();
 				}
 				}
 				else
 				else
 				{
 				{
-					getCastle().setBloodAlliance(0);
 					getCastle().setTicketBuyCount(0);
 					getCastle().setTicketBuyCount(0);
 					for (L2ClanMember member : clan.getMembers())
 					for (L2ClanMember member : clan.getMembers())
 					{
 					{
@@ -478,13 +472,15 @@ public class Siege implements Siegable
 			if (getAttackerClans().isEmpty())
 			if (getAttackerClans().isEmpty())
 			{
 			{
 				SystemMessage sm;
 				SystemMessage sm;
-				if (getCastle().getOwnerId() <= 0)
+				if (_firstOwnerClanId <= 0)
 				{
 				{
 					sm = SystemMessage.getSystemMessage(SystemMessageId.SIEGE_OF_S1_HAS_BEEN_CANCELED_DUE_TO_LACK_OF_INTEREST);
 					sm = SystemMessage.getSystemMessage(SystemMessageId.SIEGE_OF_S1_HAS_BEEN_CANCELED_DUE_TO_LACK_OF_INTEREST);
 				}
 				}
 				else
 				else
 				{
 				{
 					sm = SystemMessage.getSystemMessage(SystemMessageId.S1_SIEGE_WAS_CANCELED_BECAUSE_NO_CLANS_PARTICIPATED);
 					sm = SystemMessage.getSystemMessage(SystemMessageId.S1_SIEGE_WAS_CANCELED_BECAUSE_NO_CLANS_PARTICIPATED);
+					final L2Clan ownerClan = ClanTable.getInstance().getClan(_firstOwnerClanId);
+					ownerClan.increaseBloodAllianceCount();
 				}
 				}
 				sm.addCastleId(getCastle().getCastleId());
 				sm.addCastleId(getCastle().getCastleId());
 				Announcements.getInstance().announceToAll(sm);
 				Announcements.getInstance().announceToAll(sm);