Reformat and clean up "net" package
This commit is contained in:
@@ -16,7 +16,6 @@ import tools.PacketCreator;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Xari
|
||||
* @author Ronan - added concurrency protection and quest progress limit
|
||||
*/
|
||||
@@ -27,7 +26,7 @@ public class RaiseIncExpHandler extends AbstractPacketHandler {
|
||||
byte inventorytype = p.readByte();//nItemIT
|
||||
short slot = p.readShort();//nSlotPosition
|
||||
int itemid = p.readInt();//nItemID
|
||||
|
||||
|
||||
if (c.tryacquireClient()) {
|
||||
try {
|
||||
ItemInformationProvider ii = ItemInformationProvider.getInstance();
|
||||
@@ -38,14 +37,14 @@ public class RaiseIncExpHandler extends AbstractPacketHandler {
|
||||
|
||||
int infoNumber = consItem.questid;
|
||||
Map<Integer, Integer> consumables = consItem.items;
|
||||
|
||||
|
||||
Character chr = c.getPlayer();
|
||||
Quest quest = Quest.getInstanceFromInfoNumber(infoNumber);
|
||||
if (!chr.getQuest(quest).getStatus().equals(QuestStatus.Status.STARTED)) {
|
||||
c.sendPacket(PacketCreator.enableActions());
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
int consId;
|
||||
Inventory inv = chr.getInventory(InventoryType.getByType(inventorytype));
|
||||
inv.lockInventory();
|
||||
@@ -59,11 +58,11 @@ public class RaiseIncExpHandler extends AbstractPacketHandler {
|
||||
} finally {
|
||||
inv.unlockInventory();
|
||||
}
|
||||
|
||||
|
||||
int questid = quest.getId();
|
||||
int nextValue = Math.min(consumables.get(consId) + c.getAbstractPlayerInteraction().getQuestProgressInt(questid, infoNumber), consItem.exp * consItem.grade);
|
||||
c.getAbstractPlayerInteraction().setQuestProgress(questid, infoNumber, nextValue);
|
||||
|
||||
|
||||
c.sendPacket(PacketCreator.enableActions());
|
||||
} finally {
|
||||
c.releaseClient();
|
||||
|
||||
Reference in New Issue
Block a user