Scrolls for spike/cold protection + quest completion with equipped items

Added mechanic for the scrolls for spikes on shoes and cold protection
on capes. Fixed an issue where equipped items were being counted towards
materials for quests, therefore showing odds behaviours when completing
it. Fixed some minor issues on the dollhouse quest/event.
This commit is contained in:
ronancpl
2017-05-22 01:49:35 -03:00
parent 514656d238
commit 53927576e7
14 changed files with 152 additions and 115 deletions

View File

@@ -415,7 +415,7 @@ public final class PlayerInteractionHandler extends AbstractMaplePacketHandler {
if (chr.getTrade() != null) {
if ((quantity <= item.getQuantity() && quantity >= 0) || ItemConstants.isRechargable(item.getItemId())) {
if (ii.isDropRestricted(item.getItemId())) { // ensure that undroppable items do not make it to the trade window
if (!((item.getFlag() & ItemConstants.KARMA) == ItemConstants.KARMA || (item.getFlag() & ItemConstants.SPIKES) == ItemConstants.SPIKES)) {
if (!((item.getFlag() & ItemConstants.KARMA) == ItemConstants.KARMA)) {
c.announce(MaplePacketCreator.enableActions());
return;
}

View File

@@ -30,6 +30,7 @@ import client.inventory.Item;
import client.inventory.MapleInventory;
import client.inventory.MapleInventoryType;
import client.inventory.ModifyInventory;
import constants.ItemConstants;
import java.util.ArrayList;
import java.util.List;
import net.AbstractMaplePacketHandler;
@@ -97,7 +98,7 @@ public final class ScrollHandler extends AbstractMaplePacketHandler {
ScrollResult scrollSuccess = Equip.ScrollResult.FAIL; // fail
if (scrolled == null) {
scrollSuccess = Equip.ScrollResult.CURSE;
} else if (scrolled.getLevel() > oldLevel || (isCleanSlate(scroll.getItemId()) && scrolled.getUpgradeSlots() == oldSlots + 1)) {
} else if (scrolled.getLevel() > oldLevel || (isCleanSlate(scroll.getItemId()) && scrolled.getUpgradeSlots() == oldSlots + 1) || isFlagModifier(scroll.getItemId(), scrolled.getFlag())) {
scrollSuccess = Equip.ScrollResult.SUCCESS;
}
MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.USE, scroll.getPosition(), (short) 1, false);
@@ -123,6 +124,12 @@ public final class ScrollHandler extends AbstractMaplePacketHandler {
}
}
private boolean isFlagModifier(int scrollId, byte flag) {
if(scrollId == 2041058 && ((flag & ItemConstants.COLD) == ItemConstants.COLD)) return true;
if(scrollId == 2040727 && ((flag & ItemConstants.SPIKES) == ItemConstants.SPIKES)) return true;
return false;
}
private boolean isCleanSlate(int scrollId) {
return scrollId > 2048999 && scrollId < 2049004;
}

View File

@@ -82,8 +82,6 @@ public final class StorageHandler extends AbstractMaplePacketHandler {
FilePrinter.printError(FilePrinter.STORAGE + c.getAccountName() + ".txt", c.getPlayer().getName() + " took out " + item.getQuantity() + " " + itemName + " (" + item.getItemId() + ")\r\n");
if ((item.getFlag() & ItemConstants.KARMA) == ItemConstants.KARMA) {
item.setFlag((byte) (item.getFlag() ^ ItemConstants.KARMA)); //items with scissors of karma used on them are reset once traded
} else if (item.getType() == 2 && (item.getFlag() & ItemConstants.SPIKES) == ItemConstants.SPIKES){
item.setFlag((byte) (item.getFlag() ^ ItemConstants.SPIKES));
}
MapleInventoryManipulator.addFromDrop(c, item, false);
storage.sendTakenOut(c, ii.getInventoryType(item.getItemId()));

View File

@@ -490,9 +490,7 @@ public final class UseCashItemHandler extends AbstractMaplePacketHandler {
c.announce(MaplePacketCreator.enableActions());
return;
}
if (type.equals(MapleInventoryType.USE)) {
item.setFlag((byte) ItemConstants.SPIKES);
} else {
if (!type.equals(MapleInventoryType.USE)) {
item.setFlag((byte) ItemConstants.KARMA);
}