{
announceToPlayer(new SystemMessage(SystemMessage.THE_SIEGE_OF_S1_HAS_ENDED_IN_A_DRAW).addString(getSiegeUnit().getName()), false, false);
}
else
{
L2Clan oldOwner = null;
if(_ownerBeforeStart != 0)
{
oldOwner = ClanTable.getInstance().getClan(_ownerBeforeStart);
}
L2Clan newOwner = ClanTable.getInstance().getClan(getSiegeUnit().getOwnerId());
if(oldOwner == null)
{ // castle was taken over from scratch
if(newOwner.getLevel() >= 5)
{
newOwner.broadcastToOnlineMembers(new SystemMessage(SystemMessage.SINCE_YOUR_CLAN_EMERGED_VICTORIOUS_FROM_THE_SIEGE_S1_POINTS_HAVE_BEEN_ADDED_TO_YOUR_CLAN_REPUTATION_SCORE).addNumber(newOwner.incReputation(1500, true, "CastleSiege")));
}
SiegeManager.clearCastleRegistrations(newOwner);
SiegeManager.clearFortressRegistrations(newOwner); // TODO убрать
}
else if(newOwner.equals(oldOwner))
{ // castle was defended
if(newOwner.getLevel() >= 5)
{
newOwner.broadcastToOnlineMembers(new SystemMessage(SystemMessage.SINCE_YOUR_CLAN_EMERGED_VICTORIOUS_FROM_THE_SIEGE_S1_POINTS_HAVE_BEEN_ADDED_TO_YOUR_CLAN_REPUTATION_SCORE).addNumber(newOwner.incReputation(1500, true, "CastleSiege")));
}
SiegeManager.clearCastleRegistrations(newOwner);
SiegeManager.clearFortressRegistrations(newOwner); // TODO убрать
}
else
{ // castle was taken over by another clan
announceToPlayer(new SystemMessage(SystemMessage.CLAN_S1_IS_VICTORIOUS_OVER_S2S_CASTLE_SIEGE).addString(newOwner.getName()).addString(getSiegeUnit().getName()), false, false);
if(newOwner.getLevel() >= 5)
{
newOwner.broadcastToOnlineMembers(new SystemMessage(SystemMessage.SINCE_YOUR_CLAN_EMERGED_VICTORIOUS_FROM_THE_SIEGE_S1_POINTS_HAVE_BEEN_ADDED_TO_YOUR_CLAN_REPUTATION_SCORE).addNumber(newOwner.incReputation(3000, true, "CastleSiege")));
}
if(oldOwner.getLevel() >= 5)
{
oldOwner.broadcastToOnlineMembers(new SystemMessage(SystemMessage.YOUR_CLAN_HAS_FAILED_TO_DEFEND_THE_CASTLE_S1_POINTS_HAVE_BEEN_DEDUCTED_FROM_YOUR_CLAN_REPUTATION_SCORE).addNumber(-oldOwner.incReputation(-3000, true, "CastleSiege")));
}