Fixed inventory full now properly shown + loading GM with pet issue

Fixed issues related to "inventory full" messages not popping when
failing to pick-up items and when loading GM pets giving out exceptions.
This commit is contained in:
ronancpl
2017-05-18 14:45:46 -03:00
parent 39a53e88fd
commit 66a19d6fa6
5 changed files with 54 additions and 47 deletions

View File

@@ -3,34 +3,18 @@
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
<group>
<file>file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/scripts/npc/world0/2131000.js</file>
<file>file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/server/quest/requirements/InfoExRequirement.java</file>
<file>file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/client/inventory/Item.java</file>
<file>file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/scripting/map/MapScriptMethods.java</file>
<file>file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/scripts/npc/world0/2101000.js</file>
<file>file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/scripts/npc/world0/2103001.js</file>
<file>file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/scripts/quest/1021.js</file>
<file>file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/client/inventory/Equip.java</file>
<file>file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/net/server/channel/handlers/UseCashItemHandler.java</file>
<file>file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/scripts/quest/3927.js</file>
<file>file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/scripting/quest/QuestActionManager.java</file>
<file>file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/scripting/quest/QuestScriptManager.java</file>
<file>file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/net/server/channel/handlers/SpecialMoveHandler.java</file>
<file>file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/net/server/channel/handlers/CashOperationHandler.java</file>
<file>file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/server/MapleStatEffect.java</file>
<file>file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/constants/skills/Priest.java</file>
<file>file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/net/PacketProcessor.java</file>
<file>file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/net/server/channel/handlers/GeneralChatHandler.java</file>
<file>file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/scripting/AbstractPlayerInteraction.java</file>
<file>file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/client/MapleBuffStat.java</file>
<file>file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/net/server/channel/handlers/PetFoodHandler.java</file>
<file>file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/client/MapleCharacter.java</file>
<file>file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/server/maps/MapleMap.java</file>
<file>file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/client/inventory/ModifyInventory.java</file>
<file>file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/client/inventory/MaplePet.java</file>
<file>file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/scripts/npc/world0/2111009.js</file>
<file>file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/server/MapleShop.java</file>
<file>file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/wz/String.wz/Npc.img.xml</file>
<file>file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/scripts/quest/20522.js</file>
<file>file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/tools/MaplePacketCreator.java</file>
<file>file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/client/inventory/MapleInventory.java</file>
<file>file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/scripts/npc/world0/2101001.js</file>
<file>file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/scripts/npc/world0/2094001.js</file>
<file>file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/client/MapleQuestStatus.java</file>
<file>file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/net/server/channel/handlers/QuestActionHandler.java</file>
<file>file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/scripts/npc/world0/2131002.js</file>
<file>file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/server/quest/MapleQuest.java</file>
<file>file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/server/CashShop.java</file>
</group>
</open-files>
</project-private>

View File

@@ -54,6 +54,7 @@ public class MaplePet extends Item {
private MaplePet(int id, short position, int uniqueid) {
super(id, position, (short) 1);
this.uniqueid = uniqueid;
this.pos = new Point(0, 0);
}
public static MaplePet loadFromDb(int itemid, short position, int petid) {

View File

@@ -36,7 +36,7 @@ import client.MapleClient;
/**
*
* @author Matze
* @author Matze, Ronan
*/
public final class ItemPickupHandler extends AbstractMaplePacketHandler {
@@ -57,8 +57,10 @@ public final class ItemPickupHandler extends AbstractMaplePacketHandler {
if(System.currentTimeMillis() - mapitem.getDropTime() < 900) {
c.announce(MaplePacketCreator.enableActions());
return;
}
if (mapitem.getItemId() == 4031865 || mapitem.getItemId() == 4031866 || mapitem.getMeso() > 0 || MapleItemInformationProvider.getInstance().isConsumeOnPickup(mapitem.getItemId()) || MapleInventoryManipulator.checkSpace(c, mapitem.getItemId(), mapitem.getItem().getQuantity(), mapitem.getItem().getOwner())) {
}
boolean hasSpaceInventory = true;
if (mapitem.getItemId() == 4031865 || mapitem.getItemId() == 4031866 || mapitem.getMeso() > 0 || MapleItemInformationProvider.getInstance().isConsumeOnPickup(mapitem.getItemId()) || (hasSpaceInventory = MapleInventoryManipulator.checkSpace(c, mapitem.getItemId(), mapitem.getItem().getQuantity(), mapitem.getItem().getOwner()))) {
if ((chr.getMapId() > 209000000 && chr.getMapId() < 209000016) || (chr.getMapId() >= 990000500 && chr.getMapId() <= 990000502)) {//happyville trees and guild PQ
if (!mapitem.isPlayerDrop() || mapitem.getDropper().getObjectId() == c.getPlayer().getObjectId()) {
if(mapitem.getMeso() > 0) {
@@ -90,8 +92,8 @@ public final class ItemPickupHandler extends AbstractMaplePacketHandler {
return;
}
if (mapitem.isPickedUp()) {
c.announce(MaplePacketCreator.getInventoryFull());
c.announce(MaplePacketCreator.getShowInventoryFull());
c.announce(MaplePacketCreator.showItemUnavailable());
c.announce(MaplePacketCreator.enableActions());
return;
}
if (mapitem.getMeso() > 0) {
@@ -134,7 +136,7 @@ public final class ItemPickupHandler extends AbstractMaplePacketHandler {
}
}
} else if(mapitem.getItemId() == 4031865 || mapitem.getItemId() == 4031866) {
// Add NX to account, show effect and make item disapear
// Add NX to account, show effect and make item disappear
chr.getCashShop().gainCash(1, mapitem.getItemId() == 4031865 ? 100 : 250);
} else if (useItem(c, mapitem.getItem().getItemId())) {
if (mapitem.getItem().getItemId() / 10000 == 238) {
@@ -151,6 +153,9 @@ public final class ItemPickupHandler extends AbstractMaplePacketHandler {
chr.getMap().broadcastMessage(MaplePacketCreator.removeItemFromMap(mapitem.getObjectId(), 2, chr.getId()), mapitem.getPosition());
chr.getMap().removeMapObject(ob);
}
} else if(!hasSpaceInventory) {
c.announce(MaplePacketCreator.getInventoryFull());
c.announce(MaplePacketCreator.getShowInventoryFull());
}
}
c.announce(MaplePacketCreator.enableActions());

View File

@@ -43,12 +43,15 @@ import constants.ServerConstants;
public final class PetLootHandler extends AbstractMaplePacketHandler {
public final void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) {
MapleCharacter chr = c.getPlayer();
if(System.currentTimeMillis() - chr.getPetLootCd() < ServerConstants.PET_LOOT_UPON_ATTACK)
if(System.currentTimeMillis() - chr.getPetLootCd() < ServerConstants.PET_LOOT_UPON_ATTACK) {
c.announce(MaplePacketCreator.enableActions());
return;
}
MaplePet pet = chr.getPet(chr.getPetIndex(slea.readInt()));//why would it be an int...?
if (pet == null || !pet.isSummoned()) {
return;
c.announce(MaplePacketCreator.enableActions());
return;
}
slea.skip(13);
@@ -56,6 +59,7 @@ public final class PetLootHandler extends AbstractMaplePacketHandler {
MapleMapObject ob = chr.getMap().getMapObject(oid);
if (ob == null) {
c.announce(MaplePacketCreator.getInventoryFull());
c.announce(MaplePacketCreator.enableActions());
return;
}
if (ob instanceof MapleMapItem) {
@@ -66,21 +70,26 @@ public final class PetLootHandler extends AbstractMaplePacketHandler {
c.announce(MaplePacketCreator.enableActions());
return;
}
if(System.currentTimeMillis() - mapitem.getDropTime() < 900) {
c.announce(MaplePacketCreator.enableActions());
return;
}
if(System.currentTimeMillis() - mapitem.getDropTime() < 900) {
c.announce(MaplePacketCreator.enableActions());
return;
}
if (mapitem.isPickedUp()) {
c.announce(MaplePacketCreator.getInventoryFull());
c.announce(MaplePacketCreator.showItemUnavailable());
c.announce(MaplePacketCreator.enableActions());
return;
}
if (mapitem.getDropper() == c.getPlayer()) {
c.announce(MaplePacketCreator.enableActions());
return;
}
if (mapitem.getMeso() > 0) {
if (chr.getParty() != null) {
int mesosamm = mapitem.getMeso();
if (mesosamm > 50000 * chr.getMesoRate()) return;
if (mesosamm > 50000 * chr.getMesoRate()) {
c.announce(MaplePacketCreator.enableActions());
return;
}
int partynum = 0;
for (MaplePartyCharacter partymem : chr.getParty().getMembers()) {
if (partymem.isOnline() && partymem.getMapId() == chr.getMap().getId() && partymem.getChannel() == c.getChannel()) {
@@ -115,6 +124,7 @@ public final class PetLootHandler extends AbstractMaplePacketHandler {
if (chr.getInventory(MapleInventoryType.EQUIPPED).findById(1812007) != null) {
for (int i : chr.getExcluded()) {
if (mapitem.getItem().getItemId() == i) {
c.announce(MaplePacketCreator.enableActions());
return;
}
}
@@ -122,6 +132,7 @@ public final class PetLootHandler extends AbstractMaplePacketHandler {
chr.getMap().broadcastMessage(MaplePacketCreator.removeItemFromMap(mapitem.getObjectId(), 5, chr.getId(), true, chr.getPetIndex(pet)), mapitem.getPosition());
chr.getMap().removeMapObject(ob);
} else {
c.announce(MaplePacketCreator.enableActions());
return;
}
} else if (mapitem.getItem().getItemId() / 10000 == 243) {
@@ -138,20 +149,22 @@ public final class PetLootHandler extends AbstractMaplePacketHandler {
}
chr.getMap().broadcastMessage(MaplePacketCreator.removeItemFromMap(mapitem.getObjectId(), 5, chr.getId(), true, chr.getPetIndex(pet)), mapitem.getPosition());
chr.getMap().removeMapObject(ob);
} else if(mapitem.getItemId() == 4031865 || mapitem.getItemId() == 4031866) {
// Add NX to account, show effect and make item disapear
} else if(mapitem.getItemId() == 4031865 || mapitem.getItemId() == 4031866) {
// Add NX to account, show effect and make item disappear
chr.getCashShop().gainCash(1, mapitem.getItemId() == 4031865 ? 100 : 250);
chr.getMap().broadcastMessage(MaplePacketCreator.removeItemFromMap(mapitem.getObjectId(), 5, chr.getId(), true, chr.getPetIndex(pet)), mapitem.getPosition());
chr.getMap().removeMapObject(ob);
} else if (MapleInventoryManipulator.addFromDrop(c, mapitem.getItem(), true)) {
chr.getMap().broadcastMessage(MaplePacketCreator.removeItemFromMap(mapitem.getObjectId(), 5, chr.getId(), true, chr.getPetIndex(pet)), mapitem.getPosition());
chr.getMap().removeMapObject(ob);
} else {
} else {
c.announce(MaplePacketCreator.enableActions());
return;
}
mapitem.setPickedUp(true);
}
}
//c.announce(MaplePacketCreator.enableActions());
c.announce(MaplePacketCreator.enableActions());
}
}

View File

@@ -35,6 +35,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import tools.FilePrinter;
import tools.MaplePacketCreator;
@@ -182,8 +183,8 @@ public class MapleInventoryManipulator {
Item nItem = new Item(item.getItemId(), (short) 0, newQ, petId);
nItem.setExpiration(item.getExpiration());
nItem.setOwner(item.getOwner());
nItem.setFlag(item.getFlag());
short newSlot = c.getPlayer().getInventory(type).addItem(nItem);
nItem.setFlag(item.getFlag());
short newSlot = c.getPlayer().getInventory(type).addItem(nItem);
if (newSlot == -1) {
c.announce(MaplePacketCreator.getInventoryFull());
c.announce(MaplePacketCreator.getShowInventoryFull());
@@ -204,7 +205,7 @@ public class MapleInventoryManipulator {
c.announce(MaplePacketCreator.enableActions());
}
} else if (quantity == 1) {
short newSlot = c.getPlayer().getInventory(type).addItem(item);
short newSlot = c.getPlayer().getInventory(type).addItem(item);
if (newSlot == -1) {
c.announce(MaplePacketCreator.getInventoryFull());
c.announce(MaplePacketCreator.getShowInventoryFull());
@@ -212,6 +213,9 @@ public class MapleInventoryManipulator {
}
c.announce(MaplePacketCreator.modifyInventory(true, Collections.singletonList(new ModifyInventory(0, item))));
} else {
FilePrinter.print(FilePrinter.ITEM, "Tried to pickup Equip id " + item.getItemId() + " containing more than 1 quantity --> " + quantity);
c.announce(MaplePacketCreator.getInventoryFull());
c.announce(MaplePacketCreator.showItemUnavailable());
return false;
}
if (show) {