Clean slate counting Vicious Hammer + Scroll Handler patch
Improved clean slate, now taking Vicious Hammer slots into max upgrade slots account. Solved some exploit cases within Scroll Handler.
This commit is contained in:
@@ -49,6 +49,8 @@ public final class ScrollHandler extends AbstractMaplePacketHandler {
|
||||
|
||||
@Override
|
||||
public final void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) {
|
||||
if (c.tryacquireClient()) {
|
||||
try {
|
||||
slea.readInt(); // whatever...
|
||||
short slot = slea.readShort();
|
||||
short dst = slea.readShort();
|
||||
@@ -113,10 +115,26 @@ public final class ScrollHandler extends AbstractMaplePacketHandler {
|
||||
} else if (scrolled.getLevel() > oldLevel || (ItemConstants.isCleanSlate(scroll.getItemId()) && scrolled.getUpgradeSlots() == oldSlots + 1) || ItemConstants.isFlagModifier(scroll.getItemId(), scrolled.getFlag())) {
|
||||
scrollSuccess = Equip.ScrollResult.SUCCESS;
|
||||
}
|
||||
MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.USE, scroll.getPosition(), (short) 1, false);
|
||||
|
||||
useInventory.lockInventory();
|
||||
try {
|
||||
if (scroll.getQuantity() < 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (whiteScroll && !ItemConstants.isCleanSlate(scroll.getItemId())) {
|
||||
if (wscroll.getQuantity() < 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.USE, wscroll.getPosition(), (short) 1, false, false);
|
||||
}
|
||||
|
||||
MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.USE, scroll.getPosition(), (short) 1, false);
|
||||
} finally {
|
||||
useInventory.unlockInventory();
|
||||
}
|
||||
|
||||
final List<ModifyInventory> mods = new ArrayList<>();
|
||||
if (scrollSuccess == Equip.ScrollResult.CURSE) {
|
||||
if(!ItemConstants.isWeddingRing(toScroll.getItemId())) {
|
||||
@@ -132,7 +150,14 @@ public final class ScrollHandler extends AbstractMaplePacketHandler {
|
||||
inv.unlockInventory();
|
||||
}
|
||||
} else {
|
||||
chr.getInventory(MapleInventoryType.EQUIP).removeItem(toScroll.getPosition());
|
||||
MapleInventory inv = chr.getInventory(MapleInventoryType.EQUIP);
|
||||
|
||||
inv.lockInventory();
|
||||
try {
|
||||
inv.removeItem(toScroll.getPosition());
|
||||
} finally {
|
||||
inv.unlockInventory();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
scrolled = toScroll;
|
||||
@@ -150,6 +175,10 @@ public final class ScrollHandler extends AbstractMaplePacketHandler {
|
||||
if (dst < 0 && (scrollSuccess == Equip.ScrollResult.SUCCESS || scrollSuccess == Equip.ScrollResult.CURSE)) {
|
||||
chr.equipChanged();
|
||||
}
|
||||
} finally {
|
||||
c.releaseClient();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean canScroll(int scrollid, int itemid) {
|
||||
|
||||
@@ -507,7 +507,7 @@ public final class UseCashItemHandler extends AbstractMaplePacketHandler {
|
||||
int itemSlot = slea.readInt();
|
||||
slea.readInt();
|
||||
final Equip equip = (Equip) player.getInventory(MapleInventoryType.EQUIP).getItem((short) itemSlot);
|
||||
if (equip.getVicious() == 2 || player.getInventory(MapleInventoryType.CASH).findById(5570000) == null) {
|
||||
if (equip.getVicious() >= 2 || player.getInventory(MapleInventoryType.CASH).findById(5570000) == null) {
|
||||
return;
|
||||
}
|
||||
equip.setVicious(equip.getVicious() + 1);
|
||||
|
||||
@@ -913,7 +913,7 @@ public class MapleItemInformationProvider {
|
||||
|
||||
public boolean canUseCleanSlate(Equip nEquip) {
|
||||
Map<String, Integer> eqstats = this.getEquipStats(nEquip.getItemId());
|
||||
return ServerConstants.USE_ENHANCED_CLNSLATE || nEquip.getUpgradeSlots() < (byte) (eqstats.get("tuc") + nEquipe.getVicious()); // issue with clean slate found thanks to Masterrulax
|
||||
return ServerConstants.USE_ENHANCED_CLNSLATE || nEquip.getUpgradeSlots() < (byte) (eqstats.get("tuc") + nEquip.getVicious()); // issue with clean slate found thanks to Masterrulax, vicious added in the check thanks to Crypter (CrypterDEV)
|
||||
}
|
||||
|
||||
public Item scrollEquipWithId(Item equip, int scrollId, boolean usingWhiteScroll, int vegaItemId, boolean isGM) {
|
||||
|
||||
Reference in New Issue
Block a user