{
request.cancel();
activeChar.sendActionFailed();
return;
}
DuelEvent duelEvent = EventHolder.getInstance().getEvent(EventType.PVP_EVENT, _duelType);
switch (_response)
{
case 0:
request.cancel();
if (_duelType == 1)
{
requestor.sendPacket(SystemMsg.THE_OPPOSING_PARTY_HAS_DECLINED_YOUR_CHALLENGE_TO_A_DUEL);
}
else
{
requestor.sendPacket(new SystemMessage2(SystemMsg.C1_HAS_DECLINED_YOUR_CHALLENGE_TO_A_PARTY_DUEL).addName(activeChar));
}
break;
case -1:
request.cancel();
requestor.sendPacket(new SystemMessage2(SystemMsg.C1_IS_SET_TO_REFUSE_DUEL_REQUESTS_AND_CANNOT_RECEIVE_A_DUEL_REQUEST).addName(activeChar));
break;
case 1:
if (!duelEvent.canDuel(requestor, activeChar, false))
{
request.cancel();
return;
}
SystemMessage2 msg1,
msg2;
if (_duelType == 1)
{
msg1 = new SystemMessage2(SystemMsg.YOU_HAVE_ACCEPTED_C1S_CHALLENGE_TO_A_PARTY_DUEL);
msg2 = new SystemMessage2(SystemMsg.S1_HAS_ACCEPTED_YOUR_CHALLENGE_TO_DUEL_AGAINST_THEIR_PARTY);
}
else
{
msg1 = new SystemMessage2(SystemMsg.YOU_HAVE_ACCEPTED_C1S_CHALLENGE_A_DUEL);
msg2 = new SystemMessage2(SystemMsg.C1_HAS_ACCEPTED_YOUR_CHALLENGE_TO_A_DUEL);
}
activeChar.sendPacket(msg1.addName(requestor));
requestor.sendPacket(msg2.addName(activeChar));
try
{
duelEvent.createDuel(requestor, activeChar);
}
finally
{
request.done();
}