gameserver/model/actor/L2Character.java (+39 -52) diffs
931 -
931 +
932 + // Verify if the attack can be started
933 + if (getEvtReadyToAct().isScheduled())
934 + {
935 + // Cancel the attack because it can't be done at this moment
936 + sendPacket(ActionFailed.STATIC_PACKET);
937 + return;
938 + }
939 +
933 - if (weaponItem != null && !transformed)
941 + if (weaponItem != null && !transformed && this instanceof L2PcInstance)
943 + // Check for arrows and MP
937 - // Verify if the bow can be use
938 - if (getEvtReadyToAct().isScheduled())
946 + // Equip arrows needed in left hand and send a Server->Client packet ItemList to the L2PcINstance then return True
947 + if (!checkAndEquipArrows())
949 + // Cancel the action because the L2PcInstance have no arrow
950 + getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
952 + sendPacket(SystemMessageId.NOT_ENOUGH_ARROWS);
944 - // Check for arrows and MP
945 - if (this instanceof L2PcInstance)
956 + // Verify if L2PcInstance owns enough MP
957 + int saMpConsume = (int)getStat().calcStat(Stats.MP_CONSUME, 0, null, null);
958 + int mpConsume = saMpConsume == 0 ? weaponItem.getMpConsume() : saMpConsume;
959 + mpConsume = (int)calcStat(Stats.BOW_MP_CONSUME_RATE, mpConsume, null, null);
960 +
961 + if (getStatus().getCurrentMp() < mpConsume)
947 - // Equip arrows needed in left hand and send a Server->Client packet ItemList to the L2PcINstance then return True
948 - if (!checkAndEquipArrows())
949 - {
950 - // Cancel the action because the L2PcInstance have no arrow
951 - getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
952 - sendPacket(ActionFailed.STATIC_PACKET);
953 - sendPacket(SystemMessageId.NOT_ENOUGH_ARROWS);
954 - return;
955 - }
956 -
957 - // Verify if L2PcInstance owns enough MP
958 - int saMpConsume = (int)getStat().calcStat(Stats.MP_CONSUME, 0, null, null);
959 - int mpConsume = saMpConsume == 0 ? weaponItem.getMpConsume() : saMpConsume;
960 - mpConsume = (int)calcStat(Stats.BOW_MP_CONSUME_RATE, mpConsume, null, null);
961 -
962 - if (getStatus().getCurrentMp() < mpConsume)
963 - {
964 - // If L2PcInstance doesn't have enough MP, stop the attack
965 - getEvtReadyToAct().schedule(1000);
966 - sendPacket(ActionFailed.STATIC_PACKET);
967 - sendPacket(SystemMessageId.NOT_ENOUGH_MP);
968 - return;
969 - }
970 -
971 - // If L2PcInstance have enough MP, the bow consumes it
972 - if (mpConsume > 0)
973 - getStatus().reduceMp(mpConsume);
963 + // If L2PcInstance doesn't have enough MP, stop the attack
964 + getEvtReadyToAct().schedule(1000);
965 + sendPacket(ActionFailed.STATIC_PACKET);
966 + sendPacket(SystemMessageId.NOT_ENOUGH_MP);
967 + return;
969 +
970 + // If L2PcInstance have enough MP, the bow consumes it
971 + if (mpConsume > 0)
972 + getStatus().reduceMp(mpConsume);
974 + // Check for bolts
978 - // Verify if the crossbow can be use
979 - if (getEvtReadyToAct().isScheduled())
977 + // Equip bolts needed in left hand and send a Server->Client packet ItemList to the L2PcINstance then return True
978 + if (!checkAndEquipBolts())
981 - // Cancel the action because the crossbow can't be re-use at this moment
980 + // Cancel the action because the L2PcInstance have no arrow
981 + getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
983 + sendPacket(SystemMessageId.NOT_ENOUGH_BOLTS);
985 -
986 - // Check for bolts
987 - if (this instanceof L2PcInstance)
988 - {
989 - // Equip bolts needed in left hand and send a Server->Client packet ItemList to the L2PcINstance then return True
990 - if (!checkAndEquipBolts())
991 - {
992 - // Cancel the action because the L2PcInstance have no arrow
993 - getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
994 - sendPacket(ActionFailed.STATIC_PACKET);
995 - sendPacket(SystemMessageId.NOT_ENOUGH_BOLTS);
996 - return;
997 - }
998 - }
- private EvtReadyToAct getEvtReadyToAct()
1105 + protected EvtReadyToAct getEvtReadyToAct()
1126 - private final class EvtReadyToAct extends ExclusiveTask
1113 + protected final class EvtReadyToAct extends ExclusiveTask