Conditional Buffs & M. Magnet & Loot Patch + Exp Split + Duey Rework
Fixed Monster Magnet skill when used on bosses disconnecting the caster. Improved conditional buff system, no longer updating buffs that are not supposed to toggle. Added party hunting in the conditional buffs system. Refactored usage of DB by Duey. Registered Duey items now make use of the same table as the other inventory items. Fixed non-encapsulated unlocking in reactor class. Fixed stylish NPCs disconnecting players when trying to display empty styles list. Fixed a deadlock case within recently implemented update buff effects (conditional buffs mechanic). Fixed AOE mobskills not behaving well for fixed mobs (those shouldn't take into account attribute "facingLeft"). Fixed non-flipping mobs having attribute "facingLeft" updated according to controller position. Revised aggro system no longer having bosses expire player chase. Fixed chalkboard being depleted upon use. Refactored MapleMapFactory, looking for normalization of the Factory design pattern the class was intended to make use at its conception. Added MP replenishing system for mobs, gains based on its level. Fixed indisponibility of one-of-a-kind loots due to the killer's team already having one sample each. Reworked the EXP split system within the source. New behavior is expected to be GMS-like. Adjusted interaction within the NPC Nein Spirit's Baby Dragon area. Only players who interacts with quests within can access the area now. One player at a time, with a timeout timer. Fixed check of level requisites for expeditions.
This commit is contained in:
@@ -84,13 +84,12 @@ import server.events.gm.MapleFitness;
|
||||
import server.events.gm.MapleOla;
|
||||
import server.life.MapleMonster;
|
||||
import server.life.MobSkill;
|
||||
import server.loot.MapleLootManager;
|
||||
import server.maps.MapleHiredMerchant;
|
||||
import server.maps.MapleDoor;
|
||||
import server.maps.MapleDragon;
|
||||
import server.maps.MapleMap;
|
||||
import server.maps.MapleMapEffect;
|
||||
import server.maps.MapleMapFactory;
|
||||
import server.maps.MapleMapManager;
|
||||
import server.maps.MapleMapObject;
|
||||
import server.maps.MapleMapObjectType;
|
||||
import server.maps.MapleMiniGame;
|
||||
@@ -3489,7 +3488,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
for(Entry<Integer, Map<MapleBuffStat, MapleBuffStatValueHolder>> bpl: buffEffects.entrySet()) {
|
||||
MapleBuffStatValueHolder mbsvhi = bpl.getValue().get(mbs);
|
||||
if(mbsvhi != null) {
|
||||
if(!mbsvhi.effect.isActive(mapid)) {
|
||||
if(!mbsvhi.effect.isActive(this)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -3714,17 +3713,57 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
}
|
||||
}
|
||||
|
||||
public void updateActiveEffects() {
|
||||
chrLock.lock();
|
||||
private static MapleStatEffect getEffectFromBuffSource(Map<MapleBuffStat, MapleBuffStatValueHolder> buffSource) {
|
||||
try {
|
||||
effects.clear();
|
||||
updateEffects(buffEffectsCount.keySet());
|
||||
return buffSource.entrySet().iterator().next().getValue().effect;
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isUpdatingEffect(Set<MapleStatEffect> activeEffects, MapleStatEffect mse) {
|
||||
if (mse == null) return false;
|
||||
|
||||
// thanks xinyifly for noticing "Speed Infusion" crashing game when updating buffs during map transition
|
||||
boolean active = mse.isActive(this);
|
||||
if (active) {
|
||||
return !activeEffects.contains(mse);
|
||||
} else {
|
||||
return activeEffects.contains(mse);
|
||||
}
|
||||
}
|
||||
|
||||
public void updateActiveEffects() {
|
||||
effLock.lock(); // thanks davidlafriniere, maple006, RedHat for pointing a deadlock occurring here
|
||||
try {
|
||||
Set<MapleBuffStat> updatedBuffs = new LinkedHashSet<>();
|
||||
Set<MapleStatEffect> activeEffects = new LinkedHashSet<>();
|
||||
|
||||
for (MapleBuffStatValueHolder mse : effects.values()) {
|
||||
activeEffects.add(mse.effect);
|
||||
}
|
||||
|
||||
for (Map<MapleBuffStat, MapleBuffStatValueHolder> buff : buffEffects.values()) {
|
||||
MapleStatEffect mse = getEffectFromBuffSource(buff);
|
||||
if (isUpdatingEffect(activeEffects, mse)) {
|
||||
for (Pair<MapleBuffStat, Integer> p : mse.getStatups()) {
|
||||
updatedBuffs.add(p.getLeft());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (MapleBuffStat mbs : updatedBuffs) {
|
||||
effects.remove(mbs);
|
||||
}
|
||||
|
||||
updateEffects(updatedBuffs);
|
||||
} finally {
|
||||
chrLock.unlock();
|
||||
effLock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
private void updateEffects(Set<MapleBuffStat> removedStats) {
|
||||
effLock.lock();
|
||||
chrLock.lock();
|
||||
try {
|
||||
Set<MapleBuffStat> retrievedStats = new LinkedHashSet<>();
|
||||
@@ -3743,6 +3782,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
propagateBuffEffectUpdates(new LinkedHashMap<Integer, Pair<MapleStatEffect, Long>>(), retrievedStats, removedStats);
|
||||
} finally {
|
||||
chrLock.unlock();
|
||||
effLock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4169,6 +4209,12 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
case COUPON_DRP1:
|
||||
case COUPON_DRP2:
|
||||
case COUPON_DRP3:
|
||||
case MESO_UP_BY_ITEM:
|
||||
case ITEM_UP_BY_ITEM:
|
||||
case RESPECT_PIMMUNE:
|
||||
case RESPECT_MIMMUNE:
|
||||
case DEFENSE_ATT:
|
||||
case DEFENSE_STATE:
|
||||
case WATK:
|
||||
case WDEF:
|
||||
case MATK:
|
||||
@@ -4314,7 +4360,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
appliedStatups.put(ps.getLeft(), new MapleBuffStatValueHolder(effect, starttime, ps.getRight()));
|
||||
}
|
||||
|
||||
boolean active = effect.isActive(mapid);
|
||||
boolean active = effect.isActive(this);
|
||||
if(ServerConstants.USE_BUFF_MOST_SIGNIFICANT) {
|
||||
toDeploy = new LinkedHashMap<>();
|
||||
Map<Integer, Pair<MapleStatEffect, Long>> retrievedEffects = new LinkedHashMap<>();
|
||||
@@ -5289,20 +5335,6 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
return false;
|
||||
}
|
||||
|
||||
public List<MonsterDropEntry> retrieveRelevantDrops(int monsterId) {
|
||||
List<MapleCharacter> pchars = new LinkedList<>();
|
||||
for (MapleCharacter chr : getPartyMembers()) {
|
||||
if (chr.isLoggedinWorld()) {
|
||||
pchars.add(chr);
|
||||
}
|
||||
}
|
||||
|
||||
if (pchars.isEmpty()) {
|
||||
pchars.add(this);
|
||||
}
|
||||
return MapleLootManager.retrieveRelevantDrops(monsterId, pchars);
|
||||
}
|
||||
|
||||
public MaplePlayerShop getPlayerShop() {
|
||||
return playerShop;
|
||||
}
|
||||
@@ -6507,9 +6539,10 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
}
|
||||
|
||||
public void updateCouponRates() {
|
||||
MapleInventory cashInv = this.getInventory(MapleInventoryType.CASH);
|
||||
if (cashInv == null) return;
|
||||
|
||||
if (cpnLock.tryLock()) {
|
||||
MapleInventory cashInv = this.getInventory(MapleInventoryType.CASH);
|
||||
|
||||
effLock.lock();
|
||||
chrLock.lock();
|
||||
cashInv.lockInventory();
|
||||
@@ -6944,11 +6977,11 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
ret.commitExcludedItems();
|
||||
|
||||
if (channelserver) {
|
||||
MapleMapFactory mapFactory = client.getChannelServer().getMapFactory();
|
||||
ret.map = mapFactory.getMap(ret.mapid);
|
||||
MapleMapManager mapManager = client.getChannelServer().getMapFactory();
|
||||
ret.map = mapManager.getMap(ret.mapid);
|
||||
|
||||
if (ret.map == null) {
|
||||
ret.map = mapFactory.getMap(100000000);
|
||||
ret.map = mapManager.getMap(100000000);
|
||||
}
|
||||
MaplePortal portal = ret.map.getPortal(ret.initialSpawnPoint);
|
||||
if (portal == null) {
|
||||
|
||||
Reference in New Issue
Block a user