Reformat and clean up "net" package

This commit is contained in:
P0nk
2021-09-09 23:26:02 +02:00
parent 69f4580637
commit 6be6ea9927
235 changed files with 3556 additions and 3398 deletions

View File

@@ -46,10 +46,12 @@ public final class ItemRewardHandler extends AbstractPacketHandler {
public final void handlePacket(InPacket p, Client c) {
byte slot = (byte) p.readShort();
int itemId = p.readInt(); // will load from xml I don't care.
Item it = c.getPlayer().getInventory(InventoryType.USE).getItem(slot); // null check here thanks to Thora
if (it == null || it.getItemId() != itemId || c.getPlayer().getInventory(InventoryType.USE).countById(itemId) < 1) return;
if (it == null || it.getItemId() != itemId || c.getPlayer().getInventory(InventoryType.USE).countById(itemId) < 1) {
return;
}
ItemInformationProvider ii = ItemInformationProvider.getInstance();
Pair<Integer, List<RewardItem>> rewards = ii.getItemReward(itemId);
for (RewardItem reward : rewards.getRight()) {
@@ -58,10 +60,10 @@ public final class ItemRewardHandler extends AbstractPacketHandler {
break;
}
if (Randomizer.nextInt(rewards.getLeft()) < reward.prob) {//Is it even possible to get an item with prob 1?
if (ItemConstants.getInventoryType(reward.itemid) == InventoryType.EQUIP) {
if (ItemConstants.getInventoryType(reward.itemid) == InventoryType.EQUIP) {
final Item item = ii.getEquipById(reward.itemid);
if (reward.period != -1) {
item.setExpiration(currentServerTime() + (reward.period * 60 * 60 * 10));
item.setExpiration(currentServerTime() + (reward.period * 60 * 60 * 10));
}
InventoryManipulator.addFromDrop(c, item, false);
} else {