Revamped buff system + skill cd/buff schedule rework

Completely rearranged buff system (system can smartly check for the best
statup to take effect for it's duration, or the server can be flagged to
act as usual). Refactored scheduling system for buffs expiration and
cooldowns to use one single thread per player rather than one per
instance.
This commit is contained in:
ronancpl
2017-09-22 19:09:56 -03:00
parent 1ffcf47f79
commit 9c72ce1e3a
104 changed files with 1321 additions and 583 deletions
+4 -16
View File
@@ -35,12 +35,10 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import java.util.concurrent.ScheduledFuture;
import net.server.Server;
import server.MapleInventoryManipulator;
import server.MapleItemInformationProvider;
import server.MaplePlayerShopItem;
import server.TimerManager;
import tools.DatabaseConnection;
import tools.MaplePacketCreator;
import tools.Pair;
@@ -61,7 +59,6 @@ public class HiredMerchant extends AbstractMapleMapObject {
private List<Pair<String, Byte>> messages = new LinkedList<>();
private List<SoldItem> sold = new LinkedList<>();
private boolean open;
public ScheduledFuture<?> schedule = null;
private MapleMap map;
public HiredMerchant(final MapleCharacter owner, int itemId, String desc) {
@@ -74,14 +71,6 @@ public class HiredMerchant extends AbstractMapleMapObject {
this.ownerName = owner.getName();
this.description = desc;
this.map = owner.getMap();
this.schedule = TimerManager.getInstance().schedule(new Runnable() {
@Override
public void run() {
HiredMerchant.this.forceClose();
Server.getInstance().getChannel(world, channel).removeHiredMerchant(ownerId);
}
}, 1000 * 60 * 60 * 24);
}
public void broadcastToVisitors(final byte[] packet) {
@@ -194,9 +183,8 @@ public class HiredMerchant extends AbstractMapleMapObject {
}
public void forceClose() {
if (schedule != null) {
schedule.cancel(false);
}
Server.getInstance().getWorld(world).unregisterHiredMerchant(this);
try {
saveItems(true);
items.clear();
@@ -226,7 +214,6 @@ public class HiredMerchant extends AbstractMapleMapObject {
}
map = null;
schedule = null;
}
public void closeShop(MapleClient c, boolean timeout) {
@@ -268,7 +255,8 @@ public class HiredMerchant extends AbstractMapleMapObject {
} catch (Exception e) {
e.printStackTrace();
}
schedule.cancel(false);
Server.getInstance().getWorld(world).unregisterHiredMerchant(this);
}
public String getOwner() {