Ludibrium PQ + MapleIdRetriever

Implemented LPQ. New application tool that realizes fetches by names and
returns respective ids, over all items depicted in the GM handbook.
This commit is contained in:
ronancpl
2017-05-13 15:24:02 -03:00
parent ed6121dd5f
commit b26469301d
94 changed files with 36729 additions and 1186 deletions

View File

@@ -4871,7 +4871,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
return false;
}
public boolean sellAllItemsFromName(byte invTypeId, String name) {
public int sellAllItemsFromName(byte invTypeId, String name) {
//player decides from which inventory items should be sold.
MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();
@@ -4879,38 +4879,42 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
Item it = getInventory(type).findByName(name);
if(it == null) {
return(false);
return(-1);
}
sellAllItemsFromPosition(ii, type, it.getPosition());
return(true);
return(sellAllItemsFromPosition(ii, type, it.getPosition()));
}
public void sellAllItemsFromPosition(MapleItemInformationProvider ii, MapleInventoryType type, short pos) {
public int sellAllItemsFromPosition(MapleItemInformationProvider ii, MapleInventoryType type, short pos) {
int mesoGain = 0;
for(short i = pos; i <= getInventory(type).getSlotLimit(); i++) {
if(getInventory(type).getItem(i) == null) continue;
standaloneSell(getClient(), ii, type, i, getInventory(type).getItem(i).getQuantity());
mesoGain += standaloneSell(getClient(), ii, type, i, getInventory(type).getItem(i).getQuantity());
}
return(mesoGain);
}
private void standaloneSell(MapleClient c, MapleItemInformationProvider ii, MapleInventoryType type, short slot, short quantity) {
private int standaloneSell(MapleClient c, MapleItemInformationProvider ii, MapleInventoryType type, short slot, short quantity) {
if (quantity == 0xFFFF || quantity == 0) {
quantity = 1;
}
Item item = getInventory(type).getItem((short) slot);
if (item == null){ //Basic check
return;
return(0);
}
if (ItemConstants.isRechargable(item.getItemId())) {
quantity = item.getQuantity();
}
if (quantity < 0) {
return;
return(0);
}
short iQuant = item.getQuantity();
if (iQuant == 0xFFFF) {
iQuant = 1;
}
if (quantity <= iQuant && iQuant > 0) {
MapleInventoryManipulator.removeFromSlot(c, type, (byte) slot, quantity, false);
double price;
@@ -4919,11 +4923,15 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
} else {
price = ii.getPrice(item.getItemId());
}
int recvMesos = (int) Math.max(Math.ceil(price * quantity), 0);
if (price != -1 && recvMesos > 0) {
gainMeso(recvMesos, false);
return(recvMesos);
}
}
return(0);
}
public void setShop(MapleShop shop) {

View File

@@ -652,7 +652,7 @@ public class Commands {
case "debugmap":
if(ServerConstants.USE_DEBUG) {
player.dropMessage("Current map id " + player.getMap().getId() + ", event: '" + ((player.getMap().getEventInstance() != null) ? player.getMap().getEventInstance().getName() : "null") + "'; Players: " + player.getMap().getAllPlayers().size() + ", Mobs: " + player.getMap().getMonsters().size() + ".");
player.dropMessage("Current map id " + player.getMap().getId() + ", event: '" + ((player.getMap().getEventInstance() != null) ? player.getMap().getEventInstance().getName() : "null") + "'; Players: " + player.getMap().getAllPlayers().size() + ", Mobs: " + player.getMap().countMonsters() + ", Reactors: " + player.getMap().countReactors() + ".");
}
break;

View File

@@ -77,7 +77,13 @@ public class MapleInventory implements Iterable<Item> {
public Item findByName(String name) {
for (Item item : inventory.values()) {
if (name.compareToIgnoreCase(MapleItemInformationProvider.getInstance().getName(item.getItemId())) == 0) {
String itemName = MapleItemInformationProvider.getInstance().getName(item.getItemId());
if(itemName == null) {
System.out.println("[CRITICAL] Item " + item.getItemId() + " has no name.");
continue;
}
if (name.compareToIgnoreCase(itemName) == 0) {
return item;
}
}

View File

@@ -144,11 +144,11 @@ public class AbstractPlayerInteraction {
}
public int countAllMonstersOnMap(int map) {
return getMap(map).countAllMonsters();
return getMap(map).countMonsters();
}
public int countMonster() {
return getPlayer().getMap().countAllMonsters();
return getPlayer().getMap().countMonsters();
}
public void resetMapObjects(int mapid) {

View File

@@ -794,6 +794,15 @@ public class EventInstanceManager {
}
}
public final void warpEventTeam(int warpFrom, int warpTo) {
List<MapleCharacter> players = getPlayerList();
for (MapleCharacter chr : players) {
if(chr.getMapId() == warpFrom)
chr.changeMap(warpTo);
}
}
public final void warpEventTeam(int warpTo) {
List<MapleCharacter> players = getPlayerList();

View File

@@ -223,7 +223,7 @@ public class MapleItemInformationProvider {
theData = cashStringData;
} else if (itemId >= 2000000 && itemId < 3000000) {
theData = consumeStringData;
} else if ((itemId >= 1010000 && itemId < 1040000) || (itemId >= 1122000 && itemId < 1123000) || (itemId >= 1142000 && itemId < 1143000)) {
} else if ((itemId >= 1010000 && itemId < 1040000) || (itemId >= 1122000 && itemId < 1123000) || (itemId >= 1132000 && itemId < 1133000) || (itemId >= 1142000 && itemId < 1143000)) {
theData = eqpStringData;
cat = "Eqp/Accessory";
} else if (itemId >= 1000000 && itemId < 1010000) {
@@ -250,7 +250,7 @@ public class MapleItemInformationProvider {
} else if (itemId >= 1060000 && itemId < 1070000) {
theData = eqpStringData;
cat = "Eqp/Pants";
} else if (itemId >= 1802000 && itemId < 1810000) {
} else if (itemId >= 1802000 && itemId < 1842000) {
theData = eqpStringData;
cat = "Eqp/PetEquip";
} else if (itemId >= 1112000 && itemId < 1120000) {

View File

@@ -539,9 +539,17 @@ public class MapleMap {
return list;
}
public int countAllMonsters() {
public int countMonsters() {
return getMapObjectsInRange(new Point(0, 0), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.MONSTER)).size();
}
public int countReactors() {
return getMapObjectsInRange(new Point(0, 0), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.REACTOR)).size();
}
public final List<MapleMapObject> getReactors() {
return getMapObjectsInRange(new Point(0, 0), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.REACTOR));
}
public boolean damageMonster(final MapleCharacter chr, final MapleMonster monster, final int damage) {
if (monster.getId() == 8800000) {
@@ -616,7 +624,7 @@ public class MapleMap {
}
public List<MapleMonster> getMonsters() {
List<MapleMonster> mobs = new ArrayList<MapleMonster>();
List<MapleMonster> mobs = new ArrayList<>();
for (MapleMapObject object : this.getMapObjects()) {
if(object instanceof MapleMonster) mobs.add((MapleMonster)object);
}
@@ -1385,7 +1393,7 @@ public class MapleMap {
private void activateItemReactors(final MapleMapItem drop, final MapleClient c) {
final Item item = drop.getItem();
for (final MapleMapObject o : getAllReactor()) {
for (final MapleMapObject o : getReactors()) {
final MapleReactor react = (MapleReactor) o;
if (react.getReactorType() == 100) {
@@ -1400,10 +1408,6 @@ public class MapleMap {
}
}
public final List<MapleMapObject> getAllReactor() {
return getMapObjectsInRange(new Point(0, 0), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.REACTOR));
}
public void startMapEffect(String msg, int itemId) {
startMapEffect(msg, itemId, 30000);
}