Pooled Io Write + EXP loss & Detached morph patch + Storages in World
Fixed autocommit getting called early/unavailable in a few catch blocks, when trying to save player. Fixed the missing variable declaration in several quest scripts that were recently formatted. Reworked the EXP loss formula applied at a knock-out. The new formula follows past discussions in several MS forums. Fixed a deadlock issue related with party HP and party doors management. Refactored management of packets sent to client through an IoSession. New system no longer makes use of a synchronized statement when calling announce(packet), rather makes use of dedicated threads to send queued packets for the respective players. Fixed SP reset allowing increase of unexpected skills. Refactored storages, no longer instantiated as coupled with the character, rather instantiated in a map within the world object, with accountid as key. Reviewed usage of character objects of offline party members, that weren't being properly checked. Fixed some unexpected cases with buffs and morphs (within the enhanced buff system) making the latter show up as another morph figure. Added a "priority buff" perspective within the enhanced buff system, to let such priority items/skills take awareness over other buffs. (This would be vital for some quests, as the one reported in #514 ) Fixed EXP gains in certain scenarios showing up with less amount than the expected (due to float point operations). Fixed a critical bug that have emerged in a recent mount-skill update, issue happened due to an improper object initialization. Fixed mount information packet not being relayed to the player at world login time, rendering some quests not startable until the mob levels up.
This commit is contained in:
@@ -21,7 +21,6 @@
|
||||
*/
|
||||
package server;
|
||||
|
||||
import client.inventory.manipulator.MapleInventoryManipulator;
|
||||
import java.awt.Point;
|
||||
import java.awt.Rectangle;
|
||||
import java.util.ArrayList;
|
||||
@@ -40,6 +39,7 @@ import server.maps.MapleMap;
|
||||
import server.maps.MapleMapObject;
|
||||
import server.maps.MapleMapObjectType;
|
||||
import server.maps.MapleMist;
|
||||
import server.maps.MaplePortal;
|
||||
import server.maps.MapleSummon;
|
||||
import server.maps.SummonMovementType;
|
||||
import tools.ArrayMap;
|
||||
@@ -55,6 +55,7 @@ import client.SkillFactory;
|
||||
import client.inventory.Item;
|
||||
import client.inventory.MapleInventory;
|
||||
import client.inventory.MapleInventoryType;
|
||||
import client.inventory.manipulator.MapleInventoryManipulator;
|
||||
import client.status.MonsterStatus;
|
||||
import client.status.MonsterStatusEffect;
|
||||
import constants.ItemConstants;
|
||||
@@ -1004,21 +1005,26 @@ public class MapleStatEffect {
|
||||
}
|
||||
}
|
||||
if (isShadowClaw()) {
|
||||
int projectile = 0;
|
||||
MapleInventory use = applyto.getInventory(MapleInventoryType.USE);
|
||||
for (int i = 1; i <= use.getSlotLimit(); i++) { // impose order...
|
||||
Item item = use.getItem((short) i);
|
||||
if (item != null) {
|
||||
if (ItemConstants.isThrowingStar(item.getItemId()) && item.getQuantity() >= 200) {
|
||||
projectile = item.getItemId();
|
||||
break;
|
||||
use.lockInventory();
|
||||
try {
|
||||
Item projectile = null;
|
||||
for (int i = 1; i <= use.getSlotLimit(); i++) { // impose order...
|
||||
Item item = use.getItem((short) i);
|
||||
if (item != null) {
|
||||
if (ItemConstants.isThrowingStar(item.getItemId()) && item.getQuantity() >= 200) {
|
||||
projectile = item;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (projectile == 0) {
|
||||
return false;
|
||||
} else {
|
||||
MapleInventoryManipulator.removeById(applyto.getClient(), MapleInventoryType.USE, projectile, 200, false, true);
|
||||
if (projectile == null) {
|
||||
return false;
|
||||
} else {
|
||||
MapleInventoryManipulator.removeFromSlot(applyto.getClient(), MapleInventoryType.USE, projectile.getPosition(), (short) 200, false, true);
|
||||
}
|
||||
} finally {
|
||||
use.unlockInventory();
|
||||
}
|
||||
}
|
||||
SummonMovementType summonMovementType = getSummonMovementType();
|
||||
@@ -1125,8 +1131,11 @@ public class MapleStatEffect {
|
||||
} else if (cureDebuffs.size() > 0) { // by Drago-Dragohe4rt
|
||||
for (final MapleDisease debuff : cureDebuffs) {
|
||||
if (applyfrom.getParty() != null) {
|
||||
for (MaplePartyCharacter chrs : applyfrom.getParty().getPartyMembers()) {
|
||||
chrs.getPlayer().dispelDebuff(debuff);
|
||||
for (MaplePartyCharacter mpc : applyfrom.getParty().getPartyMembers()) {
|
||||
MapleCharacter chr = mpc.getPlayer();
|
||||
if (chr != null) {
|
||||
chr.dispelDebuff(debuff);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
applyfrom.dispelDebuff(debuff);
|
||||
|
||||
@@ -58,13 +58,12 @@ public class MapleStorage {
|
||||
private int meso;
|
||||
private byte slots;
|
||||
private Map<MapleInventoryType, List<Item>> typeItems = new HashMap<>();
|
||||
private List<Item> items;
|
||||
private List<Item> items = new LinkedList<>();
|
||||
private Lock lock = MonitoredReentrantLockFactory.createLock(MonitoredLockType.STORAGE, true);
|
||||
|
||||
private MapleStorage(int id, byte slots, int meso) {
|
||||
this.id = id;
|
||||
this.slots = slots;
|
||||
this.items = new LinkedList<>();
|
||||
this.meso = meso;
|
||||
}
|
||||
|
||||
@@ -119,15 +118,20 @@ public class MapleStorage {
|
||||
return slots;
|
||||
}
|
||||
|
||||
public synchronized boolean gainSlots(int slots) {
|
||||
slots += this.slots;
|
||||
public boolean gainSlots(int slots) {
|
||||
lock.lock();
|
||||
try {
|
||||
slots += this.slots;
|
||||
|
||||
if (slots <= 48) {
|
||||
this.slots = (byte) slots;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (slots <= 48) {
|
||||
this.slots = (byte) slots;
|
||||
return true;
|
||||
return false;
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void saveToDB(Connection con) {
|
||||
@@ -160,29 +164,33 @@ public class MapleStorage {
|
||||
}
|
||||
}
|
||||
|
||||
public Item takeOut(byte slot) {
|
||||
Item ret;
|
||||
|
||||
public boolean takeOut(Item item) {
|
||||
lock.lock();
|
||||
try {
|
||||
ret = items.remove(slot);
|
||||
boolean ret = items.remove(item);
|
||||
|
||||
MapleInventoryType type = ret.getInventoryType();
|
||||
MapleInventoryType type = item.getInventoryType();
|
||||
typeItems.put(type, new ArrayList<>(filterItems(type)));
|
||||
|
||||
return ret;
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
public void store(Item item) {
|
||||
public boolean store(Item item) {
|
||||
lock.lock();
|
||||
try {
|
||||
if (isFull()) { // thanks Optimist for noticing unrestricted amount of insertions here
|
||||
return false;
|
||||
}
|
||||
|
||||
items.add(item);
|
||||
|
||||
MapleInventoryType type = item.getInventoryType();
|
||||
typeItems.put(type, new ArrayList<>(filterItems(type)));
|
||||
|
||||
return true;
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
@@ -196,7 +204,7 @@ public class MapleStorage {
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private List<Item> filterItems(MapleInventoryType type) {
|
||||
List<Item> storageItems = getItems();
|
||||
List<Item> ret = new LinkedList<>();
|
||||
@@ -208,7 +216,7 @@ public class MapleStorage {
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
public byte getSlot(MapleInventoryType type, byte slot) {
|
||||
lock.lock();
|
||||
try {
|
||||
@@ -225,7 +233,7 @@ public class MapleStorage {
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void sendStorage(MapleClient c, int npcId) {
|
||||
if (c.getPlayer().getLevel() < 15){
|
||||
c.getPlayer().dropMessage(1, "You may only use the storage once you have reached level 15.");
|
||||
@@ -287,7 +295,7 @@ public class MapleStorage {
|
||||
for (MapleInventoryType type : MapleInventoryType.values()) {
|
||||
typeItems.put(type, new ArrayList<>(items));
|
||||
}
|
||||
|
||||
|
||||
c.announce(MaplePacketCreator.arrangeStorage(slots, items));
|
||||
} finally {
|
||||
lock.unlock();
|
||||
@@ -353,7 +361,7 @@ public class MapleStorage {
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void close() {
|
||||
lock.lock();
|
||||
try {
|
||||
@@ -362,4 +370,5 @@ public class MapleStorage {
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -703,7 +703,7 @@ public class MapleMonster extends AbstractLoadedMapleLife {
|
||||
exp = Integer.MIN_VALUE;
|
||||
}
|
||||
|
||||
return (int) exp;
|
||||
return (int) Math.round(exp); // operations on float point are not point-precise... thanks IxianMace for noticing -1 EXP gains
|
||||
}
|
||||
|
||||
private void giveExpToCharacter(MapleCharacter attacker, Float personalExp, Float partyExp, boolean white, boolean hasPartySharers) {
|
||||
|
||||
@@ -331,7 +331,7 @@ public class MobSkill {
|
||||
if (lt != null && rb != null && skill) {
|
||||
int i = 0;
|
||||
for (MapleCharacter character : getPlayersInRange(monster, player)) {
|
||||
if (!character.isActiveBuffedValue(2321005)) { // holy shield
|
||||
if (!character.hasActiveBuff(2321005)) { // holy shield
|
||||
if (disease.equals(MapleDisease.SEDUCE)) {
|
||||
if (i < 10) {
|
||||
character.giveDebuff(MapleDisease.SEDUCE, this);
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
package server.maps;
|
||||
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import server.MaplePortal;
|
||||
import server.TimerManager;
|
||||
|
||||
public class MapMonitor {
|
||||
|
||||
@@ -25,7 +25,6 @@ import java.awt.Point;
|
||||
import java.util.Collection;
|
||||
import tools.Pair;
|
||||
|
||||
import server.MaplePortal;
|
||||
import client.MapleCharacter;
|
||||
import constants.ServerConstants;
|
||||
|
||||
|
||||
@@ -26,7 +26,6 @@ import client.MapleCharacter;
|
||||
import constants.GameConstants;
|
||||
import java.awt.Point;
|
||||
import scripting.portal.PortalScriptManager;
|
||||
import server.MaplePortal;
|
||||
import tools.MaplePacketCreator;
|
||||
import net.server.audit.locks.MonitoredLockType;
|
||||
import net.server.audit.locks.MonitoredReentrantLock;
|
||||
|
||||
@@ -68,7 +68,6 @@ import net.server.channel.Channel;
|
||||
import net.server.world.World;
|
||||
import scripting.map.MapScriptManager;
|
||||
import server.MapleItemInformationProvider;
|
||||
import server.MaplePortal;
|
||||
import server.MapleStatEffect;
|
||||
import server.TimerManager;
|
||||
import server.events.gm.MapleCoconut;
|
||||
|
||||
@@ -35,7 +35,6 @@ import provider.MapleData;
|
||||
import provider.MapleDataProvider;
|
||||
import provider.MapleDataProviderFactory;
|
||||
import provider.MapleDataTool;
|
||||
import server.PortalFactory;
|
||||
import server.life.AbstractLoadedMapleLife;
|
||||
import server.life.MapleLifeFactory;
|
||||
import server.life.MapleMonster;
|
||||
@@ -163,7 +162,7 @@ public class MapleMapFactory {
|
||||
|
||||
map.setFieldLimit(MapleDataTool.getInt(infoData.getChildByPath("fieldLimit"), 0));
|
||||
map.setMobInterval((short) MapleDataTool.getInt(infoData.getChildByPath("createMobInterval"), 5000));
|
||||
PortalFactory portalFactory = new PortalFactory();
|
||||
MaplePortalFactory portalFactory = new MaplePortalFactory();
|
||||
for (MapleData portal : mapData.getChildByPath("portal")) {
|
||||
map.addPortal(portalFactory.makePortal(MapleDataTool.getInt(portal.getChildByPath("pt")), portal));
|
||||
}
|
||||
|
||||
@@ -21,8 +21,6 @@
|
||||
*/
|
||||
package server.maps;
|
||||
|
||||
import server.MaplePortal;
|
||||
|
||||
public class MapleMapPortal extends MapleGenericPortal {
|
||||
public MapleMapPortal() {
|
||||
super(MaplePortal.MAP_PORTAL);
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
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/>.
|
||||
*/
|
||||
package server;
|
||||
package server.maps;
|
||||
|
||||
import java.awt.Point;
|
||||
import client.MapleClient;
|
||||
@@ -19,7 +19,7 @@
|
||||
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/>.
|
||||
*/
|
||||
package server;
|
||||
package server.maps;
|
||||
|
||||
import java.awt.Point;
|
||||
|
||||
@@ -28,10 +28,10 @@ import provider.MapleDataTool;
|
||||
import server.maps.MapleGenericPortal;
|
||||
import server.maps.MapleMapPortal;
|
||||
|
||||
public class PortalFactory {
|
||||
public class MaplePortalFactory {
|
||||
private int nextDoorPortal;
|
||||
|
||||
public PortalFactory() {
|
||||
public MaplePortalFactory() {
|
||||
nextDoorPortal = 0x80;
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ public class MonsterCarnival {
|
||||
private ScheduledFuture<?> timer, effectTimer, respawnTask;
|
||||
private long startTime = 0;
|
||||
private int summonsR = 0, summonsB = 0, room = 0;
|
||||
private MapleCharacter leader1, leader2, Grupo1, Grupo2;
|
||||
private MapleCharacter leader1, leader2, team1, team2;
|
||||
private int redCP, blueCP, redTotalCP, blueTotalCP, redTimeupCP, blueTimeupCP;
|
||||
private boolean cpq1;
|
||||
|
||||
@@ -60,7 +60,7 @@ public class MonsterCarnival {
|
||||
if (p1.getLeader().getId() == mc.getId()) {
|
||||
leader1 = mc;
|
||||
}
|
||||
Grupo1 = mc;
|
||||
team1 = mc;
|
||||
}
|
||||
}
|
||||
for (MaplePartyCharacter mpc : p2.getMembers()) {
|
||||
@@ -74,15 +74,21 @@ public class MonsterCarnival {
|
||||
if (p2.getLeader().getId() == mc.getId()) {
|
||||
leader2 = mc;
|
||||
}
|
||||
Grupo2 = mc;
|
||||
team2 = mc;
|
||||
}
|
||||
}
|
||||
if (Grupo1 == null || Grupo2 == null) {
|
||||
for (MaplePartyCharacter mpc : p2.getMembers()) {
|
||||
mpc.getPlayer().dropMessage(5, LanguageConstants.getMessage(mpc.getPlayer(), LanguageConstants.CPQError));
|
||||
if (team1 == null || team2 == null) {
|
||||
for (MaplePartyCharacter mpc : p1.getMembers()) {
|
||||
MapleCharacter chr = mpc.getPlayer();
|
||||
if (chr != null) {
|
||||
chr.dropMessage(5, LanguageConstants.getMessage(chr, LanguageConstants.CPQError));
|
||||
}
|
||||
}
|
||||
for (MaplePartyCharacter mpc : p2.getMembers()) {
|
||||
mpc.getPlayer().dropMessage(5, LanguageConstants.getMessage(mpc.getPlayer(), LanguageConstants.CPQError));
|
||||
MapleCharacter chr = mpc.getPlayer();
|
||||
if (chr != null) {
|
||||
chr.dropMessage(5, LanguageConstants.getMessage(chr, LanguageConstants.CPQError));
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user