Map chair skill + Hired Merchant fix

Changed map chair bonus healing mechanic to be a player skill, instead of promptly available for all players (healing buff takes place only if the player has the skill). Hired Merchant now properly checks for a space on the inventory before permitting a player to buy an item/bundle. Minor fix with concurrency on MapleStorage.
This commit is contained in:
ronancpl
2017-10-22 01:08:40 -02:00
parent 75e11e1996
commit e993c8c7b0
63 changed files with 354 additions and 191 deletions
+13 -3
View File
@@ -266,7 +266,9 @@ public class MapleStatEffect {
}
}
} else {
if((sourceid == Beginner.NIMBLE_FEET || sourceid == Noblesse.NIMBLE_FEET || sourceid == Evan.NIMBLE_FEET || sourceid == Legend.AGILE_BODY) && ServerConstants.USE_ULTRA_NIMBLE_FEET == true) {
if(isMapChair(sourceid)) {
addBuffStatPairToListIfNotZero(statups, MapleBuffStat.MAP_CHAIR, 1);
} else if((sourceid == Beginner.NIMBLE_FEET || sourceid == Noblesse.NIMBLE_FEET || sourceid == Evan.NIMBLE_FEET || sourceid == Legend.AGILE_BODY) && ServerConstants.USE_ULTRA_NIMBLE_FEET == true) {
ret.jump = (short)(ret.speed * 4);
ret.speed *= 15;
}
@@ -756,8 +758,7 @@ public class MapleStatEffect {
applyto.dispelDebuff(MapleDisease.SEDUCE);
applyto.dispelDebuff(MapleDisease.ZOMBIFY);
applyto.dispelDebuffs();
}
if (isComboReset()) {
} else if (isComboReset()) {
applyto.setCombo((short) 0);
}
/*if (applyfrom.getMp() < getMpCon()) {
@@ -1322,6 +1323,15 @@ public class MapleStatEffect {
return sourceid == Beginner.RECOVERY || sourceid == Noblesse.RECOVERY || sourceid == Legend.RECOVERY || sourceid == Evan.RECOVERY;
}
public boolean isMapChair() {
return sourceid == Beginner.MAP_CHAIR || sourceid == Noblesse.MAP_CHAIR || sourceid == Legend.MAP_CHAIR;
}
public static boolean isMapChair(int sourceid) {
return sourceid == Beginner.MAP_CHAIR || sourceid == Noblesse.MAP_CHAIR || sourceid == Legend.MAP_CHAIR;
}
public boolean isDojoBuff() {
return sourceid >= 2022359 && sourceid <= 2022421;
}
+43 -25
View File
@@ -3,19 +3,16 @@
Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc>
Matthias Butz <matze@odinms.de>
Jan Christian Meyer <vimes@odinms.de>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation version 3 as published by
the Free Software Foundation. You may not use, modify or distribute
this program under any other version of the GNU Affero General Public
License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@@ -164,12 +161,13 @@ public class MapleStorage {
lock.lock();
try {
ret = items.remove(slot);
MapleInventoryType type = MapleItemInformationProvider.getInstance().getInventoryType(ret.getItemId());
typeItems.put(type, new ArrayList<>(filterItems(type)));
} finally {
lock.unlock();
}
MapleInventoryType type = MapleItemInformationProvider.getInstance().getInventoryType(ret.getItemId());
typeItems.put(type, new ArrayList<>(filterItems(type)));
return ret;
}
@@ -177,12 +175,12 @@ public class MapleStorage {
lock.lock();
try {
items.add(item);
MapleInventoryType type = MapleItemInformationProvider.getInstance().getInventoryType(item.getItemId());
typeItems.put(type, new ArrayList<>(filterItems(type)));
} finally {
lock.unlock();
}
MapleInventoryType type = MapleItemInformationProvider.getInstance().getInventoryType(item.getItemId());
typeItems.put(type, new ArrayList<>(filterItems(type)));
}
public List<Item> getItems() {
@@ -208,15 +206,20 @@ public class MapleStorage {
}
public byte getSlot(MapleInventoryType type, byte slot) {
byte ret = 0;
List<Item> storageItems = getItems();
for (Item item : storageItems) {
if (item == typeItems.get(type).get(slot)) {
return ret;
lock.lock();
try {
byte ret = 0;
List<Item> storageItems = getItems();
for (Item item : storageItems) {
if (item == typeItems.get(type).get(slot)) {
return ret;
}
ret++;
}
ret++;
return -1;
} finally {
lock.unlock();
}
return -1;
}
public void sendStorage(MapleClient c, int npcId) {
@@ -235,23 +238,33 @@ public class MapleStorage {
return 1;
}
});
List<Item> storageItems = getItems();
for (MapleInventoryType type : MapleInventoryType.values()) {
typeItems.put(type, new ArrayList<>(storageItems));
}
c.announce(MaplePacketCreator.getStorage(npcId, slots, storageItems, meso));
} finally {
lock.unlock();
}
List<Item> storageItems = getItems();
for (MapleInventoryType type : MapleInventoryType.values()) {
typeItems.put(type, new ArrayList<>(storageItems));
}
c.announce(MaplePacketCreator.getStorage(npcId, slots, storageItems, meso));
}
public void sendStored(MapleClient c, MapleInventoryType type) {
c.announce(MaplePacketCreator.storeStorage(slots, type, typeItems.get(type)));
lock.lock();
try {
c.announce(MaplePacketCreator.storeStorage(slots, type, typeItems.get(type)));
} finally {
lock.unlock();
}
}
public void sendTakenOut(MapleClient c, MapleInventoryType type) {
c.announce(MaplePacketCreator.takeOutStorage(slots, type, typeItems.get(type)));
lock.lock();
try {
c.announce(MaplePacketCreator.takeOutStorage(slots, type, typeItems.get(type)));
} finally {
lock.unlock();
}
}
public int getMeso() {
@@ -279,6 +292,11 @@ public class MapleStorage {
}
public void close() {
typeItems.clear();
lock.lock();
try {
typeItems.clear();
} finally {
lock.unlock();
}
}
}
}
+3 -2
View File
@@ -167,7 +167,8 @@ public class MapleHiredMerchant extends AbstractMapleMapObject {
}
int price = (int)Math.min((long)pItem.getPrice() * quantity, Integer.MAX_VALUE);
if (c.getPlayer().getMeso() >= price) {
if (MapleInventoryManipulator.addFromDrop(c, newItem, false)) {
if (MapleInventoryManipulator.checkSpace(c, newItem.getItemId(), newItem.getQuantity(), newItem.getOwner())) {
MapleInventoryManipulator.addFromDrop(c, newItem, false);
c.getPlayer().gainMeso(-price, false);
synchronized (sold) {
@@ -196,7 +197,7 @@ public class MapleHiredMerchant extends AbstractMapleMapObject {
}
}
} else {
c.getPlayer().dropMessage(1, "Your inventory is full. Please clean a slot before buying this item.");
c.getPlayer().dropMessage(1, "Your inventory is full. Please clear a slot before buying this item.");
}
} else {
c.getPlayer().dropMessage(1, "You do not have enough mesos.");