DuelResult enum to uppercase.

This commit is contained in:
MobiusDev
2018-02-17 10:45:35 +00:00
parent 33008025c3
commit e1a534e2bd
10 changed files with 280 additions and 225 deletions

View File

@@ -18,11 +18,11 @@ package com.l2jmobius.gameserver.enums;
public enum DuelResult public enum DuelResult
{ {
Continue, CONTINUE,
Team1Win, TEAM_1_WIN,
Team2Win, TEAM_2_WIN,
Team1Surrender, TEAM_1_SURRENDER,
Team2Surrender, TEAM_2_SURRENDER,
Canceled, CANCELED,
Timeout TIMEOUT
} }

View File

@@ -198,14 +198,14 @@ public class Duel
{ {
switch (_duel.checkEndDuelCondition()) switch (_duel.checkEndDuelCondition())
{ {
case Canceled: case CANCELED:
{ {
// do not schedule duel end if it was interrupted // do not schedule duel end if it was interrupted
setFinished(true); setFinished(true);
_duel.endDuel(DuelResult.Canceled); _duel.endDuel(DuelResult.CANCELED);
break; break;
} }
case Continue: case CONTINUE:
{ {
ThreadPoolManager.schedule(this, 1000); ThreadPoolManager.schedule(this, 1000);
break; break;
@@ -317,6 +317,13 @@ public class Duel
temp.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE); temp.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
temp.setTarget(null); temp.setTarget(null);
temp.sendPacket(af); temp.sendPacket(af);
temp.getServitorsAndPets().forEach(s ->
{
s.abortCast();
s.abortAttack();
s.setTarget(null);
s.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
});
} }
for (L2PcInstance temp : _playerB.getParty().getMembers()) for (L2PcInstance temp : _playerB.getParty().getMembers())
{ {
@@ -324,6 +331,13 @@ public class Duel
temp.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE); temp.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
temp.setTarget(null); temp.setTarget(null);
temp.sendPacket(af); temp.sendPacket(af);
temp.getServitorsAndPets().forEach(s ->
{
s.abortCast();
s.abortAttack();
s.setTarget(null);
s.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
});
} }
} }
else else
@@ -336,6 +350,20 @@ public class Duel
_playerB.setTarget(null); _playerB.setTarget(null);
_playerA.sendPacket(af); _playerA.sendPacket(af);
_playerB.sendPacket(af); _playerB.sendPacket(af);
_playerA.getServitorsAndPets().forEach(s ->
{
s.abortCast();
s.abortAttack();
s.setTarget(null);
s.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
});
_playerB.getServitorsAndPets().forEach(s ->
{
s.abortCast();
s.abortAttack();
s.setTarget(null);
s.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
});
} }
} }
@@ -758,8 +786,8 @@ public class Duel
SystemMessage sm = null; SystemMessage sm = null;
switch (result) switch (result)
{ {
case Team1Win: case TEAM_1_WIN:
case Team2Surrender: case TEAM_2_SURRENDER:
{ {
restorePlayerConditions(false); restorePlayerConditions(false);
sm = _partyDuel ? SystemMessage.getSystemMessage(SystemMessageId.C1_S_PARTY_HAS_WON_THE_DUEL) : SystemMessage.getSystemMessage(SystemMessageId.C1_HAS_WON_THE_DUEL); sm = _partyDuel ? SystemMessage.getSystemMessage(SystemMessageId.C1_S_PARTY_HAS_WON_THE_DUEL) : SystemMessage.getSystemMessage(SystemMessageId.C1_HAS_WON_THE_DUEL);
@@ -769,8 +797,8 @@ public class Duel
broadcastToTeam2(sm); broadcastToTeam2(sm);
break; break;
} }
case Team1Surrender: case TEAM_1_SURRENDER:
case Team2Win: case TEAM_2_WIN:
{ {
restorePlayerConditions(false); restorePlayerConditions(false);
sm = _partyDuel ? SystemMessage.getSystemMessage(SystemMessageId.C1_S_PARTY_HAS_WON_THE_DUEL) : SystemMessage.getSystemMessage(SystemMessageId.C1_HAS_WON_THE_DUEL); sm = _partyDuel ? SystemMessage.getSystemMessage(SystemMessageId.C1_S_PARTY_HAS_WON_THE_DUEL) : SystemMessage.getSystemMessage(SystemMessageId.C1_HAS_WON_THE_DUEL);
@@ -780,7 +808,7 @@ public class Duel
broadcastToTeam2(sm); broadcastToTeam2(sm);
break; break;
} }
case Canceled: case CANCELED:
{ {
stopFighting(); stopFighting();
// Don't restore hp, mp, cp // Don't restore hp, mp, cp
@@ -791,7 +819,7 @@ public class Duel
broadcastToTeam2(sm); broadcastToTeam2(sm);
break; break;
} }
case Timeout: case TIMEOUT:
{ {
stopFighting(); stopFighting();
restorePlayerConditions(false); restorePlayerConditions(false);
@@ -822,35 +850,31 @@ public class Duel
// one of the players might leave during duel // one of the players might leave during duel
if ((_playerA == null) || (_playerB == null)) if ((_playerA == null) || (_playerB == null))
{ {
return DuelResult.Canceled; return DuelResult.CANCELED;
} }
// got a duel surrender request? // got a duel surrender request?
if (_surrenderRequest != 0) if (_surrenderRequest != 0)
{ {
if (_surrenderRequest == 1) return _surrenderRequest == 1 ? DuelResult.TEAM_1_SURRENDER : DuelResult.TEAM_2_SURRENDER;
{
return DuelResult.Team1Surrender;
}
return DuelResult.Team2Surrender;
} }
// duel timed out // duel timed out
else if (getRemainingTime() <= 0) else if (getRemainingTime() <= 0)
{ {
return DuelResult.Timeout; return DuelResult.TIMEOUT;
} }
// Has a player been declared winner yet? // Has a player been declared winner yet?
else if (_playerA.getDuelState() == DUELSTATE_WINNER) else if (_playerA.getDuelState() == DUELSTATE_WINNER)
{ {
// If there is a Winner already there should be no more fighting going on // If there is a Winner already there should be no more fighting going on
stopFighting(); stopFighting();
return DuelResult.Team1Win; return DuelResult.TEAM_1_WIN;
} }
else if (_playerB.getDuelState() == DUELSTATE_WINNER) else if (_playerB.getDuelState() == DUELSTATE_WINNER)
{ {
// If there is a Winner already there should be no more fighting going on // If there is a Winner already there should be no more fighting going on
stopFighting(); stopFighting();
return DuelResult.Team2Win; return DuelResult.TEAM_2_WIN;
} }
// More end duel conditions for 1on1 duels // More end duel conditions for 1on1 duels
@@ -859,29 +883,29 @@ public class Duel
// Duel was interrupted e.g.: player was attacked by mobs / other players // Duel was interrupted e.g.: player was attacked by mobs / other players
if ((_playerA.getDuelState() == DUELSTATE_INTERRUPTED) || (_playerB.getDuelState() == DUELSTATE_INTERRUPTED)) if ((_playerA.getDuelState() == DUELSTATE_INTERRUPTED) || (_playerB.getDuelState() == DUELSTATE_INTERRUPTED))
{ {
return DuelResult.Canceled; return DuelResult.CANCELED;
} }
// Are the players too far apart? // Are the players too far apart?
if (!_playerA.isInsideRadius(_playerB, 1600, false, false)) if (!_playerA.isInsideRadius(_playerB, 1600, false, false))
{ {
return DuelResult.Canceled; return DuelResult.CANCELED;
} }
// Did one of the players engage in PvP combat? // Did one of the players engage in PvP combat?
if (isDuelistInPvp(true)) if (isDuelistInPvp(true))
{ {
return DuelResult.Canceled; return DuelResult.CANCELED;
} }
// is one of the players in a Siege, Peace or PvP zone? // is one of the players in a Siege, Peace or PvP zone?
if (_playerA.isInsideZone(ZoneId.PEACE) || _playerB.isInsideZone(ZoneId.PEACE) || _playerA.isInsideZone(ZoneId.SIEGE) || _playerB.isInsideZone(ZoneId.SIEGE) || _playerA.isInsideZone(ZoneId.PVP) || _playerB.isInsideZone(ZoneId.PVP)) if (_playerA.isInsideZone(ZoneId.PEACE) || _playerB.isInsideZone(ZoneId.PEACE) || _playerA.isInsideZone(ZoneId.SIEGE) || _playerB.isInsideZone(ZoneId.SIEGE) || _playerA.isInsideZone(ZoneId.PVP) || _playerB.isInsideZone(ZoneId.PVP))
{ {
return DuelResult.Canceled; return DuelResult.CANCELED;
} }
} }
return DuelResult.Continue; return DuelResult.CONTINUE;
} }
/** /**
@@ -953,24 +977,11 @@ public class Duel
if (_partyDuel) if (_partyDuel)
{ {
boolean teamdefeated = true; boolean teamdefeated = player.getParty().getMembers().stream().anyMatch(member -> member.getDuelState() == DUELSTATE_DUELLING);
for (L2PcInstance temp : player.getParty().getMembers())
{
if (temp.getDuelState() == DUELSTATE_DUELLING)
{
teamdefeated = false;
break;
}
}
if (teamdefeated) if (teamdefeated)
{ {
L2PcInstance winner = _playerA; final L2PcInstance winner = _playerA.getParty().getMembers().contains(player) ? _playerB : _playerA;
if (_playerA.getParty().getMembers().contains(player))
{
winner = _playerB;
}
for (L2PcInstance temp : winner.getParty().getMembers()) for (L2PcInstance temp : winner.getParty().getMembers())
{ {
temp.setDuelState(DUELSTATE_WINNER); temp.setDuelState(DUELSTATE_WINNER);

View File

@@ -18,11 +18,11 @@ package com.l2jmobius.gameserver.enums;
public enum DuelResult public enum DuelResult
{ {
Continue, CONTINUE,
Team1Win, TEAM_1_WIN,
Team2Win, TEAM_2_WIN,
Team1Surrender, TEAM_1_SURRENDER,
Team2Surrender, TEAM_2_SURRENDER,
Canceled, CANCELED,
Timeout TIMEOUT
} }

View File

@@ -198,14 +198,14 @@ public class Duel
{ {
switch (_duel.checkEndDuelCondition()) switch (_duel.checkEndDuelCondition())
{ {
case Canceled: case CANCELED:
{ {
// do not schedule duel end if it was interrupted // do not schedule duel end if it was interrupted
setFinished(true); setFinished(true);
_duel.endDuel(DuelResult.Canceled); _duel.endDuel(DuelResult.CANCELED);
break; break;
} }
case Continue: case CONTINUE:
{ {
ThreadPoolManager.schedule(this, 1000); ThreadPoolManager.schedule(this, 1000);
break; break;
@@ -317,6 +317,13 @@ public class Duel
temp.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE); temp.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
temp.setTarget(null); temp.setTarget(null);
temp.sendPacket(af); temp.sendPacket(af);
temp.getServitorsAndPets().forEach(s ->
{
s.abortCast();
s.abortAttack();
s.setTarget(null);
s.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
});
} }
for (L2PcInstance temp : _playerB.getParty().getMembers()) for (L2PcInstance temp : _playerB.getParty().getMembers())
{ {
@@ -324,6 +331,13 @@ public class Duel
temp.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE); temp.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
temp.setTarget(null); temp.setTarget(null);
temp.sendPacket(af); temp.sendPacket(af);
temp.getServitorsAndPets().forEach(s ->
{
s.abortCast();
s.abortAttack();
s.setTarget(null);
s.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
});
} }
} }
else else
@@ -336,6 +350,20 @@ public class Duel
_playerB.setTarget(null); _playerB.setTarget(null);
_playerA.sendPacket(af); _playerA.sendPacket(af);
_playerB.sendPacket(af); _playerB.sendPacket(af);
_playerA.getServitorsAndPets().forEach(s ->
{
s.abortCast();
s.abortAttack();
s.setTarget(null);
s.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
});
_playerB.getServitorsAndPets().forEach(s ->
{
s.abortCast();
s.abortAttack();
s.setTarget(null);
s.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
});
} }
} }
@@ -758,8 +786,8 @@ public class Duel
SystemMessage sm = null; SystemMessage sm = null;
switch (result) switch (result)
{ {
case Team1Win: case TEAM_1_WIN:
case Team2Surrender: case TEAM_2_SURRENDER:
{ {
restorePlayerConditions(false); restorePlayerConditions(false);
sm = _partyDuel ? SystemMessage.getSystemMessage(SystemMessageId.C1_S_PARTY_HAS_WON_THE_DUEL) : SystemMessage.getSystemMessage(SystemMessageId.C1_HAS_WON_THE_DUEL); sm = _partyDuel ? SystemMessage.getSystemMessage(SystemMessageId.C1_S_PARTY_HAS_WON_THE_DUEL) : SystemMessage.getSystemMessage(SystemMessageId.C1_HAS_WON_THE_DUEL);
@@ -769,8 +797,8 @@ public class Duel
broadcastToTeam2(sm); broadcastToTeam2(sm);
break; break;
} }
case Team1Surrender: case TEAM_1_SURRENDER:
case Team2Win: case TEAM_2_WIN:
{ {
restorePlayerConditions(false); restorePlayerConditions(false);
sm = _partyDuel ? SystemMessage.getSystemMessage(SystemMessageId.C1_S_PARTY_HAS_WON_THE_DUEL) : SystemMessage.getSystemMessage(SystemMessageId.C1_HAS_WON_THE_DUEL); sm = _partyDuel ? SystemMessage.getSystemMessage(SystemMessageId.C1_S_PARTY_HAS_WON_THE_DUEL) : SystemMessage.getSystemMessage(SystemMessageId.C1_HAS_WON_THE_DUEL);
@@ -780,7 +808,7 @@ public class Duel
broadcastToTeam2(sm); broadcastToTeam2(sm);
break; break;
} }
case Canceled: case CANCELED:
{ {
stopFighting(); stopFighting();
// Don't restore hp, mp, cp // Don't restore hp, mp, cp
@@ -791,7 +819,7 @@ public class Duel
broadcastToTeam2(sm); broadcastToTeam2(sm);
break; break;
} }
case Timeout: case TIMEOUT:
{ {
stopFighting(); stopFighting();
restorePlayerConditions(false); restorePlayerConditions(false);
@@ -822,35 +850,31 @@ public class Duel
// one of the players might leave during duel // one of the players might leave during duel
if ((_playerA == null) || (_playerB == null)) if ((_playerA == null) || (_playerB == null))
{ {
return DuelResult.Canceled; return DuelResult.CANCELED;
} }
// got a duel surrender request? // got a duel surrender request?
if (_surrenderRequest != 0) if (_surrenderRequest != 0)
{ {
if (_surrenderRequest == 1) return _surrenderRequest == 1 ? DuelResult.TEAM_1_SURRENDER : DuelResult.TEAM_2_SURRENDER;
{
return DuelResult.Team1Surrender;
}
return DuelResult.Team2Surrender;
} }
// duel timed out // duel timed out
else if (getRemainingTime() <= 0) else if (getRemainingTime() <= 0)
{ {
return DuelResult.Timeout; return DuelResult.TIMEOUT;
} }
// Has a player been declared winner yet? // Has a player been declared winner yet?
else if (_playerA.getDuelState() == DUELSTATE_WINNER) else if (_playerA.getDuelState() == DUELSTATE_WINNER)
{ {
// If there is a Winner already there should be no more fighting going on // If there is a Winner already there should be no more fighting going on
stopFighting(); stopFighting();
return DuelResult.Team1Win; return DuelResult.TEAM_1_WIN;
} }
else if (_playerB.getDuelState() == DUELSTATE_WINNER) else if (_playerB.getDuelState() == DUELSTATE_WINNER)
{ {
// If there is a Winner already there should be no more fighting going on // If there is a Winner already there should be no more fighting going on
stopFighting(); stopFighting();
return DuelResult.Team2Win; return DuelResult.TEAM_2_WIN;
} }
// More end duel conditions for 1on1 duels // More end duel conditions for 1on1 duels
@@ -859,29 +883,29 @@ public class Duel
// Duel was interrupted e.g.: player was attacked by mobs / other players // Duel was interrupted e.g.: player was attacked by mobs / other players
if ((_playerA.getDuelState() == DUELSTATE_INTERRUPTED) || (_playerB.getDuelState() == DUELSTATE_INTERRUPTED)) if ((_playerA.getDuelState() == DUELSTATE_INTERRUPTED) || (_playerB.getDuelState() == DUELSTATE_INTERRUPTED))
{ {
return DuelResult.Canceled; return DuelResult.CANCELED;
} }
// Are the players too far apart? // Are the players too far apart?
if (!_playerA.isInsideRadius(_playerB, 1600, false, false)) if (!_playerA.isInsideRadius(_playerB, 1600, false, false))
{ {
return DuelResult.Canceled; return DuelResult.CANCELED;
} }
// Did one of the players engage in PvP combat? // Did one of the players engage in PvP combat?
if (isDuelistInPvp(true)) if (isDuelistInPvp(true))
{ {
return DuelResult.Canceled; return DuelResult.CANCELED;
} }
// is one of the players in a Siege, Peace or PvP zone? // is one of the players in a Siege, Peace or PvP zone?
if (_playerA.isInsideZone(ZoneId.PEACE) || _playerB.isInsideZone(ZoneId.PEACE) || _playerA.isInsideZone(ZoneId.SIEGE) || _playerB.isInsideZone(ZoneId.SIEGE) || _playerA.isInsideZone(ZoneId.PVP) || _playerB.isInsideZone(ZoneId.PVP)) if (_playerA.isInsideZone(ZoneId.PEACE) || _playerB.isInsideZone(ZoneId.PEACE) || _playerA.isInsideZone(ZoneId.SIEGE) || _playerB.isInsideZone(ZoneId.SIEGE) || _playerA.isInsideZone(ZoneId.PVP) || _playerB.isInsideZone(ZoneId.PVP))
{ {
return DuelResult.Canceled; return DuelResult.CANCELED;
} }
} }
return DuelResult.Continue; return DuelResult.CONTINUE;
} }
/** /**
@@ -953,24 +977,11 @@ public class Duel
if (_partyDuel) if (_partyDuel)
{ {
boolean teamdefeated = true; boolean teamdefeated = player.getParty().getMembers().stream().anyMatch(member -> member.getDuelState() == DUELSTATE_DUELLING);
for (L2PcInstance temp : player.getParty().getMembers())
{
if (temp.getDuelState() == DUELSTATE_DUELLING)
{
teamdefeated = false;
break;
}
}
if (teamdefeated) if (teamdefeated)
{ {
L2PcInstance winner = _playerA; final L2PcInstance winner = _playerA.getParty().getMembers().contains(player) ? _playerB : _playerA;
if (_playerA.getParty().getMembers().contains(player))
{
winner = _playerB;
}
for (L2PcInstance temp : winner.getParty().getMembers()) for (L2PcInstance temp : winner.getParty().getMembers())
{ {
temp.setDuelState(DUELSTATE_WINNER); temp.setDuelState(DUELSTATE_WINNER);

View File

@@ -18,11 +18,11 @@ package com.l2jmobius.gameserver.enums;
public enum DuelResult public enum DuelResult
{ {
Continue, CONTINUE,
Team1Win, TEAM_1_WIN,
Team2Win, TEAM_2_WIN,
Team1Surrender, TEAM_1_SURRENDER,
Team2Surrender, TEAM_2_SURRENDER,
Canceled, CANCELED,
Timeout TIMEOUT
} }

View File

@@ -198,14 +198,14 @@ public class Duel
{ {
switch (_duel.checkEndDuelCondition()) switch (_duel.checkEndDuelCondition())
{ {
case Canceled: case CANCELED:
{ {
// do not schedule duel end if it was interrupted // do not schedule duel end if it was interrupted
setFinished(true); setFinished(true);
_duel.endDuel(DuelResult.Canceled); _duel.endDuel(DuelResult.CANCELED);
break; break;
} }
case Continue: case CONTINUE:
{ {
ThreadPoolManager.schedule(this, 1000); ThreadPoolManager.schedule(this, 1000);
break; break;
@@ -317,6 +317,13 @@ public class Duel
temp.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE); temp.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
temp.setTarget(null); temp.setTarget(null);
temp.sendPacket(af); temp.sendPacket(af);
temp.getServitorsAndPets().forEach(s ->
{
s.abortCast();
s.abortAttack();
s.setTarget(null);
s.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
});
} }
for (L2PcInstance temp : _playerB.getParty().getMembers()) for (L2PcInstance temp : _playerB.getParty().getMembers())
{ {
@@ -324,6 +331,13 @@ public class Duel
temp.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE); temp.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
temp.setTarget(null); temp.setTarget(null);
temp.sendPacket(af); temp.sendPacket(af);
temp.getServitorsAndPets().forEach(s ->
{
s.abortCast();
s.abortAttack();
s.setTarget(null);
s.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
});
} }
} }
else else
@@ -336,6 +350,20 @@ public class Duel
_playerB.setTarget(null); _playerB.setTarget(null);
_playerA.sendPacket(af); _playerA.sendPacket(af);
_playerB.sendPacket(af); _playerB.sendPacket(af);
_playerA.getServitorsAndPets().forEach(s ->
{
s.abortCast();
s.abortAttack();
s.setTarget(null);
s.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
});
_playerB.getServitorsAndPets().forEach(s ->
{
s.abortCast();
s.abortAttack();
s.setTarget(null);
s.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
});
} }
} }
@@ -758,8 +786,8 @@ public class Duel
SystemMessage sm = null; SystemMessage sm = null;
switch (result) switch (result)
{ {
case Team1Win: case TEAM_1_WIN:
case Team2Surrender: case TEAM_2_SURRENDER:
{ {
restorePlayerConditions(false); restorePlayerConditions(false);
sm = _partyDuel ? SystemMessage.getSystemMessage(SystemMessageId.C1_S_PARTY_HAS_WON_THE_DUEL) : SystemMessage.getSystemMessage(SystemMessageId.C1_HAS_WON_THE_DUEL); sm = _partyDuel ? SystemMessage.getSystemMessage(SystemMessageId.C1_S_PARTY_HAS_WON_THE_DUEL) : SystemMessage.getSystemMessage(SystemMessageId.C1_HAS_WON_THE_DUEL);
@@ -769,8 +797,8 @@ public class Duel
broadcastToTeam2(sm); broadcastToTeam2(sm);
break; break;
} }
case Team1Surrender: case TEAM_1_SURRENDER:
case Team2Win: case TEAM_2_WIN:
{ {
restorePlayerConditions(false); restorePlayerConditions(false);
sm = _partyDuel ? SystemMessage.getSystemMessage(SystemMessageId.C1_S_PARTY_HAS_WON_THE_DUEL) : SystemMessage.getSystemMessage(SystemMessageId.C1_HAS_WON_THE_DUEL); sm = _partyDuel ? SystemMessage.getSystemMessage(SystemMessageId.C1_S_PARTY_HAS_WON_THE_DUEL) : SystemMessage.getSystemMessage(SystemMessageId.C1_HAS_WON_THE_DUEL);
@@ -780,7 +808,7 @@ public class Duel
broadcastToTeam2(sm); broadcastToTeam2(sm);
break; break;
} }
case Canceled: case CANCELED:
{ {
stopFighting(); stopFighting();
// Don't restore hp, mp, cp // Don't restore hp, mp, cp
@@ -791,7 +819,7 @@ public class Duel
broadcastToTeam2(sm); broadcastToTeam2(sm);
break; break;
} }
case Timeout: case TIMEOUT:
{ {
stopFighting(); stopFighting();
restorePlayerConditions(false); restorePlayerConditions(false);
@@ -822,35 +850,31 @@ public class Duel
// one of the players might leave during duel // one of the players might leave during duel
if ((_playerA == null) || (_playerB == null)) if ((_playerA == null) || (_playerB == null))
{ {
return DuelResult.Canceled; return DuelResult.CANCELED;
} }
// got a duel surrender request? // got a duel surrender request?
if (_surrenderRequest != 0) if (_surrenderRequest != 0)
{ {
if (_surrenderRequest == 1) return _surrenderRequest == 1 ? DuelResult.TEAM_1_SURRENDER : DuelResult.TEAM_2_SURRENDER;
{
return DuelResult.Team1Surrender;
}
return DuelResult.Team2Surrender;
} }
// duel timed out // duel timed out
else if (getRemainingTime() <= 0) else if (getRemainingTime() <= 0)
{ {
return DuelResult.Timeout; return DuelResult.TIMEOUT;
} }
// Has a player been declared winner yet? // Has a player been declared winner yet?
else if (_playerA.getDuelState() == DUELSTATE_WINNER) else if (_playerA.getDuelState() == DUELSTATE_WINNER)
{ {
// If there is a Winner already there should be no more fighting going on // If there is a Winner already there should be no more fighting going on
stopFighting(); stopFighting();
return DuelResult.Team1Win; return DuelResult.TEAM_1_WIN;
} }
else if (_playerB.getDuelState() == DUELSTATE_WINNER) else if (_playerB.getDuelState() == DUELSTATE_WINNER)
{ {
// If there is a Winner already there should be no more fighting going on // If there is a Winner already there should be no more fighting going on
stopFighting(); stopFighting();
return DuelResult.Team2Win; return DuelResult.TEAM_2_WIN;
} }
// More end duel conditions for 1on1 duels // More end duel conditions for 1on1 duels
@@ -859,29 +883,29 @@ public class Duel
// Duel was interrupted e.g.: player was attacked by mobs / other players // Duel was interrupted e.g.: player was attacked by mobs / other players
if ((_playerA.getDuelState() == DUELSTATE_INTERRUPTED) || (_playerB.getDuelState() == DUELSTATE_INTERRUPTED)) if ((_playerA.getDuelState() == DUELSTATE_INTERRUPTED) || (_playerB.getDuelState() == DUELSTATE_INTERRUPTED))
{ {
return DuelResult.Canceled; return DuelResult.CANCELED;
} }
// Are the players too far apart? // Are the players too far apart?
if (!_playerA.isInsideRadius(_playerB, 1600, false, false)) if (!_playerA.isInsideRadius(_playerB, 1600, false, false))
{ {
return DuelResult.Canceled; return DuelResult.CANCELED;
} }
// Did one of the players engage in PvP combat? // Did one of the players engage in PvP combat?
if (isDuelistInPvp(true)) if (isDuelistInPvp(true))
{ {
return DuelResult.Canceled; return DuelResult.CANCELED;
} }
// is one of the players in a Siege, Peace or PvP zone? // is one of the players in a Siege, Peace or PvP zone?
if (_playerA.isInsideZone(ZoneId.PEACE) || _playerB.isInsideZone(ZoneId.PEACE) || _playerA.isInsideZone(ZoneId.SIEGE) || _playerB.isInsideZone(ZoneId.SIEGE) || _playerA.isInsideZone(ZoneId.PVP) || _playerB.isInsideZone(ZoneId.PVP)) if (_playerA.isInsideZone(ZoneId.PEACE) || _playerB.isInsideZone(ZoneId.PEACE) || _playerA.isInsideZone(ZoneId.SIEGE) || _playerB.isInsideZone(ZoneId.SIEGE) || _playerA.isInsideZone(ZoneId.PVP) || _playerB.isInsideZone(ZoneId.PVP))
{ {
return DuelResult.Canceled; return DuelResult.CANCELED;
} }
} }
return DuelResult.Continue; return DuelResult.CONTINUE;
} }
/** /**
@@ -953,24 +977,11 @@ public class Duel
if (_partyDuel) if (_partyDuel)
{ {
boolean teamdefeated = true; boolean teamdefeated = player.getParty().getMembers().stream().anyMatch(member -> member.getDuelState() == DUELSTATE_DUELLING);
for (L2PcInstance temp : player.getParty().getMembers())
{
if (temp.getDuelState() == DUELSTATE_DUELLING)
{
teamdefeated = false;
break;
}
}
if (teamdefeated) if (teamdefeated)
{ {
L2PcInstance winner = _playerA; final L2PcInstance winner = _playerA.getParty().getMembers().contains(player) ? _playerB : _playerA;
if (_playerA.getParty().getMembers().contains(player))
{
winner = _playerB;
}
for (L2PcInstance temp : winner.getParty().getMembers()) for (L2PcInstance temp : winner.getParty().getMembers())
{ {
temp.setDuelState(DUELSTATE_WINNER); temp.setDuelState(DUELSTATE_WINNER);

View File

@@ -18,11 +18,11 @@ package com.l2jmobius.gameserver.enums;
public enum DuelResult public enum DuelResult
{ {
Continue, CONTINUE,
Team1Win, TEAM_1_WIN,
Team2Win, TEAM_2_WIN,
Team1Surrender, TEAM_1_SURRENDER,
Team2Surrender, TEAM_2_SURRENDER,
Canceled, CANCELED,
Timeout TIMEOUT
} }

View File

@@ -198,14 +198,14 @@ public class Duel
{ {
switch (_duel.checkEndDuelCondition()) switch (_duel.checkEndDuelCondition())
{ {
case Canceled: case CANCELED:
{ {
// do not schedule duel end if it was interrupted // do not schedule duel end if it was interrupted
setFinished(true); setFinished(true);
_duel.endDuel(DuelResult.Canceled); _duel.endDuel(DuelResult.CANCELED);
break; break;
} }
case Continue: case CONTINUE:
{ {
ThreadPoolManager.schedule(this, 1000); ThreadPoolManager.schedule(this, 1000);
break; break;
@@ -317,6 +317,13 @@ public class Duel
temp.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE); temp.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
temp.setTarget(null); temp.setTarget(null);
temp.sendPacket(af); temp.sendPacket(af);
temp.getServitorsAndPets().forEach(s ->
{
s.abortCast();
s.abortAttack();
s.setTarget(null);
s.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
});
} }
for (L2PcInstance temp : _playerB.getParty().getMembers()) for (L2PcInstance temp : _playerB.getParty().getMembers())
{ {
@@ -324,6 +331,13 @@ public class Duel
temp.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE); temp.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
temp.setTarget(null); temp.setTarget(null);
temp.sendPacket(af); temp.sendPacket(af);
temp.getServitorsAndPets().forEach(s ->
{
s.abortCast();
s.abortAttack();
s.setTarget(null);
s.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
});
} }
} }
else else
@@ -336,6 +350,20 @@ public class Duel
_playerB.setTarget(null); _playerB.setTarget(null);
_playerA.sendPacket(af); _playerA.sendPacket(af);
_playerB.sendPacket(af); _playerB.sendPacket(af);
_playerA.getServitorsAndPets().forEach(s ->
{
s.abortCast();
s.abortAttack();
s.setTarget(null);
s.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
});
_playerB.getServitorsAndPets().forEach(s ->
{
s.abortCast();
s.abortAttack();
s.setTarget(null);
s.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
});
} }
} }
@@ -758,8 +786,8 @@ public class Duel
SystemMessage sm = null; SystemMessage sm = null;
switch (result) switch (result)
{ {
case Team1Win: case TEAM_1_WIN:
case Team2Surrender: case TEAM_2_SURRENDER:
{ {
restorePlayerConditions(false); restorePlayerConditions(false);
sm = _partyDuel ? SystemMessage.getSystemMessage(SystemMessageId.C1_S_PARTY_HAS_WON_THE_DUEL) : SystemMessage.getSystemMessage(SystemMessageId.C1_HAS_WON_THE_DUEL); sm = _partyDuel ? SystemMessage.getSystemMessage(SystemMessageId.C1_S_PARTY_HAS_WON_THE_DUEL) : SystemMessage.getSystemMessage(SystemMessageId.C1_HAS_WON_THE_DUEL);
@@ -769,8 +797,8 @@ public class Duel
broadcastToTeam2(sm); broadcastToTeam2(sm);
break; break;
} }
case Team1Surrender: case TEAM_1_SURRENDER:
case Team2Win: case TEAM_2_WIN:
{ {
restorePlayerConditions(false); restorePlayerConditions(false);
sm = _partyDuel ? SystemMessage.getSystemMessage(SystemMessageId.C1_S_PARTY_HAS_WON_THE_DUEL) : SystemMessage.getSystemMessage(SystemMessageId.C1_HAS_WON_THE_DUEL); sm = _partyDuel ? SystemMessage.getSystemMessage(SystemMessageId.C1_S_PARTY_HAS_WON_THE_DUEL) : SystemMessage.getSystemMessage(SystemMessageId.C1_HAS_WON_THE_DUEL);
@@ -780,7 +808,7 @@ public class Duel
broadcastToTeam2(sm); broadcastToTeam2(sm);
break; break;
} }
case Canceled: case CANCELED:
{ {
stopFighting(); stopFighting();
// Don't restore hp, mp, cp // Don't restore hp, mp, cp
@@ -791,7 +819,7 @@ public class Duel
broadcastToTeam2(sm); broadcastToTeam2(sm);
break; break;
} }
case Timeout: case TIMEOUT:
{ {
stopFighting(); stopFighting();
restorePlayerConditions(false); restorePlayerConditions(false);
@@ -822,35 +850,31 @@ public class Duel
// one of the players might leave during duel // one of the players might leave during duel
if ((_playerA == null) || (_playerB == null)) if ((_playerA == null) || (_playerB == null))
{ {
return DuelResult.Canceled; return DuelResult.CANCELED;
} }
// got a duel surrender request? // got a duel surrender request?
if (_surrenderRequest != 0) if (_surrenderRequest != 0)
{ {
if (_surrenderRequest == 1) return _surrenderRequest == 1 ? DuelResult.TEAM_1_SURRENDER : DuelResult.TEAM_2_SURRENDER;
{
return DuelResult.Team1Surrender;
}
return DuelResult.Team2Surrender;
} }
// duel timed out // duel timed out
else if (getRemainingTime() <= 0) else if (getRemainingTime() <= 0)
{ {
return DuelResult.Timeout; return DuelResult.TIMEOUT;
} }
// Has a player been declared winner yet? // Has a player been declared winner yet?
else if (_playerA.getDuelState() == DUELSTATE_WINNER) else if (_playerA.getDuelState() == DUELSTATE_WINNER)
{ {
// If there is a Winner already there should be no more fighting going on // If there is a Winner already there should be no more fighting going on
stopFighting(); stopFighting();
return DuelResult.Team1Win; return DuelResult.TEAM_1_WIN;
} }
else if (_playerB.getDuelState() == DUELSTATE_WINNER) else if (_playerB.getDuelState() == DUELSTATE_WINNER)
{ {
// If there is a Winner already there should be no more fighting going on // If there is a Winner already there should be no more fighting going on
stopFighting(); stopFighting();
return DuelResult.Team2Win; return DuelResult.TEAM_2_WIN;
} }
// More end duel conditions for 1on1 duels // More end duel conditions for 1on1 duels
@@ -859,29 +883,29 @@ public class Duel
// Duel was interrupted e.g.: player was attacked by mobs / other players // Duel was interrupted e.g.: player was attacked by mobs / other players
if ((_playerA.getDuelState() == DUELSTATE_INTERRUPTED) || (_playerB.getDuelState() == DUELSTATE_INTERRUPTED)) if ((_playerA.getDuelState() == DUELSTATE_INTERRUPTED) || (_playerB.getDuelState() == DUELSTATE_INTERRUPTED))
{ {
return DuelResult.Canceled; return DuelResult.CANCELED;
} }
// Are the players too far apart? // Are the players too far apart?
if (!_playerA.isInsideRadius(_playerB, 1600, false, false)) if (!_playerA.isInsideRadius(_playerB, 1600, false, false))
{ {
return DuelResult.Canceled; return DuelResult.CANCELED;
} }
// Did one of the players engage in PvP combat? // Did one of the players engage in PvP combat?
if (isDuelistInPvp(true)) if (isDuelistInPvp(true))
{ {
return DuelResult.Canceled; return DuelResult.CANCELED;
} }
// is one of the players in a Siege, Peace or PvP zone? // is one of the players in a Siege, Peace or PvP zone?
if (_playerA.isInsideZone(ZoneId.PEACE) || _playerB.isInsideZone(ZoneId.PEACE) || _playerA.isInsideZone(ZoneId.SIEGE) || _playerB.isInsideZone(ZoneId.SIEGE) || _playerA.isInsideZone(ZoneId.PVP) || _playerB.isInsideZone(ZoneId.PVP)) if (_playerA.isInsideZone(ZoneId.PEACE) || _playerB.isInsideZone(ZoneId.PEACE) || _playerA.isInsideZone(ZoneId.SIEGE) || _playerB.isInsideZone(ZoneId.SIEGE) || _playerA.isInsideZone(ZoneId.PVP) || _playerB.isInsideZone(ZoneId.PVP))
{ {
return DuelResult.Canceled; return DuelResult.CANCELED;
} }
} }
return DuelResult.Continue; return DuelResult.CONTINUE;
} }
/** /**
@@ -953,24 +977,11 @@ public class Duel
if (_partyDuel) if (_partyDuel)
{ {
boolean teamdefeated = true; boolean teamdefeated = player.getParty().getMembers().stream().anyMatch(member -> member.getDuelState() == DUELSTATE_DUELLING);
for (L2PcInstance temp : player.getParty().getMembers())
{
if (temp.getDuelState() == DUELSTATE_DUELLING)
{
teamdefeated = false;
break;
}
}
if (teamdefeated) if (teamdefeated)
{ {
L2PcInstance winner = _playerA; final L2PcInstance winner = _playerA.getParty().getMembers().contains(player) ? _playerB : _playerA;
if (_playerA.getParty().getMembers().contains(player))
{
winner = _playerB;
}
for (L2PcInstance temp : winner.getParty().getMembers()) for (L2PcInstance temp : winner.getParty().getMembers())
{ {
temp.setDuelState(DUELSTATE_WINNER); temp.setDuelState(DUELSTATE_WINNER);

View File

@@ -18,11 +18,11 @@ package com.l2jmobius.gameserver.enums;
public enum DuelResult public enum DuelResult
{ {
Continue, CONTINUE,
Team1Win, TEAM_1_WIN,
Team2Win, TEAM_2_WIN,
Team1Surrender, TEAM_1_SURRENDER,
Team2Surrender, TEAM_2_SURRENDER,
Canceled, CANCELED,
Timeout TIMEOUT
} }

View File

@@ -198,14 +198,14 @@ public class Duel
{ {
switch (_duel.checkEndDuelCondition()) switch (_duel.checkEndDuelCondition())
{ {
case Canceled: case CANCELED:
{ {
// do not schedule duel end if it was interrupted // do not schedule duel end if it was interrupted
setFinished(true); setFinished(true);
_duel.endDuel(DuelResult.Canceled); _duel.endDuel(DuelResult.CANCELED);
break; break;
} }
case Continue: case CONTINUE:
{ {
ThreadPoolManager.schedule(this, 1000); ThreadPoolManager.schedule(this, 1000);
break; break;
@@ -317,6 +317,13 @@ public class Duel
temp.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE); temp.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
temp.setTarget(null); temp.setTarget(null);
temp.sendPacket(af); temp.sendPacket(af);
temp.getServitorsAndPets().forEach(s ->
{
s.abortCast();
s.abortAttack();
s.setTarget(null);
s.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
});
} }
for (L2PcInstance temp : _playerB.getParty().getMembers()) for (L2PcInstance temp : _playerB.getParty().getMembers())
{ {
@@ -324,6 +331,13 @@ public class Duel
temp.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE); temp.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
temp.setTarget(null); temp.setTarget(null);
temp.sendPacket(af); temp.sendPacket(af);
temp.getServitorsAndPets().forEach(s ->
{
s.abortCast();
s.abortAttack();
s.setTarget(null);
s.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
});
} }
} }
else else
@@ -336,6 +350,20 @@ public class Duel
_playerB.setTarget(null); _playerB.setTarget(null);
_playerA.sendPacket(af); _playerA.sendPacket(af);
_playerB.sendPacket(af); _playerB.sendPacket(af);
_playerA.getServitorsAndPets().forEach(s ->
{
s.abortCast();
s.abortAttack();
s.setTarget(null);
s.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
});
_playerB.getServitorsAndPets().forEach(s ->
{
s.abortCast();
s.abortAttack();
s.setTarget(null);
s.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
});
} }
} }
@@ -758,8 +786,8 @@ public class Duel
SystemMessage sm = null; SystemMessage sm = null;
switch (result) switch (result)
{ {
case Team1Win: case TEAM_1_WIN:
case Team2Surrender: case TEAM_2_SURRENDER:
{ {
restorePlayerConditions(false); restorePlayerConditions(false);
sm = _partyDuel ? SystemMessage.getSystemMessage(SystemMessageId.C1_S_PARTY_HAS_WON_THE_DUEL) : SystemMessage.getSystemMessage(SystemMessageId.C1_HAS_WON_THE_DUEL); sm = _partyDuel ? SystemMessage.getSystemMessage(SystemMessageId.C1_S_PARTY_HAS_WON_THE_DUEL) : SystemMessage.getSystemMessage(SystemMessageId.C1_HAS_WON_THE_DUEL);
@@ -769,8 +797,8 @@ public class Duel
broadcastToTeam2(sm); broadcastToTeam2(sm);
break; break;
} }
case Team1Surrender: case TEAM_1_SURRENDER:
case Team2Win: case TEAM_2_WIN:
{ {
restorePlayerConditions(false); restorePlayerConditions(false);
sm = _partyDuel ? SystemMessage.getSystemMessage(SystemMessageId.C1_S_PARTY_HAS_WON_THE_DUEL) : SystemMessage.getSystemMessage(SystemMessageId.C1_HAS_WON_THE_DUEL); sm = _partyDuel ? SystemMessage.getSystemMessage(SystemMessageId.C1_S_PARTY_HAS_WON_THE_DUEL) : SystemMessage.getSystemMessage(SystemMessageId.C1_HAS_WON_THE_DUEL);
@@ -780,7 +808,7 @@ public class Duel
broadcastToTeam2(sm); broadcastToTeam2(sm);
break; break;
} }
case Canceled: case CANCELED:
{ {
stopFighting(); stopFighting();
// Don't restore hp, mp, cp // Don't restore hp, mp, cp
@@ -791,7 +819,7 @@ public class Duel
broadcastToTeam2(sm); broadcastToTeam2(sm);
break; break;
} }
case Timeout: case TIMEOUT:
{ {
stopFighting(); stopFighting();
restorePlayerConditions(false); restorePlayerConditions(false);
@@ -822,35 +850,31 @@ public class Duel
// one of the players might leave during duel // one of the players might leave during duel
if ((_playerA == null) || (_playerB == null)) if ((_playerA == null) || (_playerB == null))
{ {
return DuelResult.Canceled; return DuelResult.CANCELED;
} }
// got a duel surrender request? // got a duel surrender request?
if (_surrenderRequest != 0) if (_surrenderRequest != 0)
{ {
if (_surrenderRequest == 1) return _surrenderRequest == 1 ? DuelResult.TEAM_1_SURRENDER : DuelResult.TEAM_2_SURRENDER;
{
return DuelResult.Team1Surrender;
}
return DuelResult.Team2Surrender;
} }
// duel timed out // duel timed out
else if (getRemainingTime() <= 0) else if (getRemainingTime() <= 0)
{ {
return DuelResult.Timeout; return DuelResult.TIMEOUT;
} }
// Has a player been declared winner yet? // Has a player been declared winner yet?
else if (_playerA.getDuelState() == DUELSTATE_WINNER) else if (_playerA.getDuelState() == DUELSTATE_WINNER)
{ {
// If there is a Winner already there should be no more fighting going on // If there is a Winner already there should be no more fighting going on
stopFighting(); stopFighting();
return DuelResult.Team1Win; return DuelResult.TEAM_1_WIN;
} }
else if (_playerB.getDuelState() == DUELSTATE_WINNER) else if (_playerB.getDuelState() == DUELSTATE_WINNER)
{ {
// If there is a Winner already there should be no more fighting going on // If there is a Winner already there should be no more fighting going on
stopFighting(); stopFighting();
return DuelResult.Team2Win; return DuelResult.TEAM_2_WIN;
} }
// More end duel conditions for 1on1 duels // More end duel conditions for 1on1 duels
@@ -859,29 +883,29 @@ public class Duel
// Duel was interrupted e.g.: player was attacked by mobs / other players // Duel was interrupted e.g.: player was attacked by mobs / other players
if ((_playerA.getDuelState() == DUELSTATE_INTERRUPTED) || (_playerB.getDuelState() == DUELSTATE_INTERRUPTED)) if ((_playerA.getDuelState() == DUELSTATE_INTERRUPTED) || (_playerB.getDuelState() == DUELSTATE_INTERRUPTED))
{ {
return DuelResult.Canceled; return DuelResult.CANCELED;
} }
// Are the players too far apart? // Are the players too far apart?
if (!_playerA.isInsideRadius(_playerB, 1600, false, false)) if (!_playerA.isInsideRadius(_playerB, 1600, false, false))
{ {
return DuelResult.Canceled; return DuelResult.CANCELED;
} }
// Did one of the players engage in PvP combat? // Did one of the players engage in PvP combat?
if (isDuelistInPvp(true)) if (isDuelistInPvp(true))
{ {
return DuelResult.Canceled; return DuelResult.CANCELED;
} }
// is one of the players in a Siege, Peace or PvP zone? // is one of the players in a Siege, Peace or PvP zone?
if (_playerA.isInsideZone(ZoneId.PEACE) || _playerB.isInsideZone(ZoneId.PEACE) || _playerA.isInsideZone(ZoneId.SIEGE) || _playerB.isInsideZone(ZoneId.SIEGE) || _playerA.isInsideZone(ZoneId.PVP) || _playerB.isInsideZone(ZoneId.PVP)) if (_playerA.isInsideZone(ZoneId.PEACE) || _playerB.isInsideZone(ZoneId.PEACE) || _playerA.isInsideZone(ZoneId.SIEGE) || _playerB.isInsideZone(ZoneId.SIEGE) || _playerA.isInsideZone(ZoneId.PVP) || _playerB.isInsideZone(ZoneId.PVP))
{ {
return DuelResult.Canceled; return DuelResult.CANCELED;
} }
} }
return DuelResult.Continue; return DuelResult.CONTINUE;
} }
/** /**
@@ -953,24 +977,11 @@ public class Duel
if (_partyDuel) if (_partyDuel)
{ {
boolean teamdefeated = true; boolean teamdefeated = player.getParty().getMembers().stream().anyMatch(member -> member.getDuelState() == DUELSTATE_DUELLING);
for (L2PcInstance temp : player.getParty().getMembers())
{
if (temp.getDuelState() == DUELSTATE_DUELLING)
{
teamdefeated = false;
break;
}
}
if (teamdefeated) if (teamdefeated)
{ {
L2PcInstance winner = _playerA; final L2PcInstance winner = _playerA.getParty().getMembers().contains(player) ? _playerB : _playerA;
if (_playerA.getParty().getMembers().contains(player))
{
winner = _playerB;
}
for (L2PcInstance temp : winner.getParty().getMembers()) for (L2PcInstance temp : winner.getParty().getMembers())
{ {
temp.setDuelState(DUELSTATE_WINNER); temp.setDuelState(DUELSTATE_WINNER);