Prohibit multiple duel requests.
This commit is contained in:
@ -486,6 +486,7 @@ public final class L2PcInstance extends L2Playable
|
||||
|
||||
/** Duel */
|
||||
private boolean _isInDuel = false;
|
||||
private boolean _startingDuel = false;
|
||||
private int _duelState = Duel.DUELSTATE_NODUEL;
|
||||
private int _duelId = 0;
|
||||
private SystemMessageId _noDuelReason = SystemMessageId.THERE_IS_NO_OPPONENT_TO_RECEIVE_YOUR_CHALLENGE_FOR_A_DUEL;
|
||||
@ -9310,6 +9311,11 @@ public final class L2PcInstance extends L2Playable
|
||||
return _isInDuel;
|
||||
}
|
||||
|
||||
public void setStartingDuel()
|
||||
{
|
||||
_startingDuel = true;
|
||||
}
|
||||
|
||||
public int getDuelId()
|
||||
{
|
||||
return _duelId;
|
||||
@ -9348,6 +9354,7 @@ public final class L2PcInstance extends L2Playable
|
||||
_duelState = Duel.DUELSTATE_NODUEL;
|
||||
_duelId = 0;
|
||||
}
|
||||
_startingDuel = false;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -9379,7 +9386,7 @@ public final class L2PcInstance extends L2Playable
|
||||
_noDuelReason = SystemMessageId.C1_CANNOT_DUEL_BECAUSE_C1_S_HP_OR_MP_IS_BELOW_50;
|
||||
return false;
|
||||
}
|
||||
if (_isInDuel)
|
||||
if (_isInDuel || _startingDuel)
|
||||
{
|
||||
_noDuelReason = SystemMessageId.C1_CANNOT_DUEL_BECAUSE_C1_IS_ALREADY_ENGAGED_IN_A_DUEL;
|
||||
return false;
|
||||
@ -12003,7 +12010,7 @@ public final class L2PcInstance extends L2Playable
|
||||
sendPacket(SystemMessageId.YOU_CANNOT_USE_MY_TELEPORTS_WHILE_PARTICIPATING_A_LARGE_SCALE_BATTLE_SUCH_AS_A_CASTLE_SIEGE_FORTRESS_SIEGE_OR_CLAN_HALL_SIEGE);
|
||||
return false;
|
||||
}
|
||||
else if (_isInDuel)
|
||||
else if (_isInDuel || _startingDuel)
|
||||
{
|
||||
sendPacket(SystemMessageId.YOU_CANNOT_USE_MY_TELEPORTS_DURING_A_DUEL);
|
||||
return false;
|
||||
|
@ -84,6 +84,23 @@ public class Duel
|
||||
_playerB = playerB;
|
||||
_partyDuel = partyDuel == 1;
|
||||
|
||||
if (_partyDuel)
|
||||
{
|
||||
for (L2PcInstance member : _playerA.getParty().getMembers())
|
||||
{
|
||||
member.setStartingDuel();
|
||||
}
|
||||
for (L2PcInstance member : _playerB.getParty().getMembers())
|
||||
{
|
||||
member.setStartingDuel();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_playerA.setStartingDuel();
|
||||
_playerB.setStartingDuel();
|
||||
}
|
||||
|
||||
_duelEndTime = Calendar.getInstance();
|
||||
_duelEndTime.add(Calendar.SECOND, _partyDuel ? PARTY_DUEL_DURATION : PLAYER_DUEL_DURATION);
|
||||
|
||||
|
Reference in New Issue
Block a user