Level/exp on all equips + Player stats overhaul + Chair handler patch
Implemented a massive overhaul on Character.wz, adding in equipment level-related nodes in order to make equipments level/EXP info available for anyone to check. Implemented a major overhaul on the player stat management throughout the source, properly encapsulating and concurrency protecting it's mechanics. Reviewed several MoveLifeHandler aspects, some of them trying to prevent mobs from falling from footholds in certain circumstances. Fixed MP Recovery instant killing players when they run out of HP to use. Fixed some chairs arbitrarily disconnecting players upon HP/MP recovery. Fixed Puppets sticking to maps in certain scenarios. Cached data and added concurrency protection for EXP gain on equipments. Reworked Chair Mastery skill, now with recovering amounts based on a player's base HP/MP pool. Fixed several deadlock issues revolving rate coupons and character inventory. Improved overall autopot handler performance. Reworked door bosses (such as Crocell), now spawning each 3 hours instead of upon player's demand. Fixed alliances not saving rank names on DB at creation time. Fixed alliances retaining disbanded guild info on DB. Added Mystic Door support for the Mushroom Castle area.
This commit is contained in:
@@ -71,7 +71,7 @@ public class MakerItemFactory {
|
||||
private static double getMakerStimulantFee(int itemid) {
|
||||
if(ServerConstants.USE_MAKER_FEE_HEURISTICS) {
|
||||
EquipType et = EquipType.getEquipTypeById(itemid);
|
||||
int eqpLevel = ii.getEquipStats(itemid).get("reqLevel");
|
||||
int eqpLevel = ii.getEquipLevelReq(itemid);
|
||||
|
||||
switch(et) {
|
||||
case CAP:
|
||||
@@ -106,7 +106,7 @@ public class MakerItemFactory {
|
||||
private static double getMakerReagentFee(int itemid, int reagentLevel) {
|
||||
if(ServerConstants.USE_MAKER_FEE_HEURISTICS) {
|
||||
EquipType et = EquipType.getEquipTypeById(itemid);
|
||||
int eqpLevel = ii.getEquipStats(itemid).get("reqLevel");
|
||||
int eqpLevel = ii.getEquipLevelReq(itemid);
|
||||
|
||||
switch(et) {
|
||||
case CAP:
|
||||
|
||||
@@ -98,6 +98,7 @@ public class MapleItemInformationProvider {
|
||||
protected Map<Integer, Map<String, Integer>> equipStatsCache = new HashMap<>();
|
||||
protected Map<Integer, Equip> equipCache = new HashMap<>();
|
||||
protected Map<Integer, MapleData> equipLevelInfoCache = new HashMap<>();
|
||||
protected Map<Integer, Integer> equipLevelReqCache = new HashMap<>();
|
||||
protected Map<Integer, Integer> equipMaxLevelCache = new HashMap<>();
|
||||
protected Map<Integer, Integer> wholePriceCache = new HashMap<>();
|
||||
protected Map<Integer, Double> unitPriceCache = new HashMap<>();
|
||||
@@ -598,6 +599,24 @@ public class MapleItemInformationProvider {
|
||||
equipStatsCache.put(itemId, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
public Integer getEquipLevelReq(int itemId) {
|
||||
if (equipLevelReqCache.containsKey(itemId)) {
|
||||
return equipLevelReqCache.get(itemId);
|
||||
}
|
||||
|
||||
int ret = 0;
|
||||
MapleData item = getItemData(itemId);
|
||||
if (item != null) {
|
||||
MapleData info = item.getChildByPath("info");
|
||||
if (info != null) {
|
||||
ret = MapleDataTool.getInt("reqLevel", info, 0);
|
||||
}
|
||||
}
|
||||
|
||||
equipLevelReqCache.put(itemId, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
public List<Integer> getScrollReqs(int itemId) {
|
||||
List<Integer> ret = new ArrayList<>();
|
||||
@@ -1570,7 +1589,7 @@ public class MapleItemInformationProvider {
|
||||
}
|
||||
for (Item item : items) {
|
||||
Equip equip = (Equip) item;
|
||||
int reqLevel = getEquipStats(equip.getItemId()).get("reqLevel");
|
||||
int reqLevel = getEquipLevelReq(equip.getItemId());
|
||||
if (highfivestamp) {
|
||||
reqLevel -= 5;
|
||||
if (reqLevel < 0) {
|
||||
@@ -1645,7 +1664,7 @@ public class MapleItemInformationProvider {
|
||||
ex.printStackTrace();
|
||||
}*/
|
||||
|
||||
int reqLevel = getEquipStats(equip.getItemId()).get("reqLevel");
|
||||
int reqLevel = getEquipLevelReq(equip.getItemId());
|
||||
if (highfivestamp) {
|
||||
reqLevel -= 5;
|
||||
}
|
||||
@@ -1922,8 +1941,7 @@ public class MapleItemInformationProvider {
|
||||
|
||||
public int getMakerCrystalFromEquip(Integer equipId) {
|
||||
try {
|
||||
Map<String, Integer> stats = getEquipStats(equipId);
|
||||
return getCrystalForLevel(stats.get("reqLevel"));
|
||||
return getCrystalForLevel(getEquipLevelReq(equipId));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -1933,7 +1951,7 @@ public class MapleItemInformationProvider {
|
||||
|
||||
public int getMakerStimulantFromEquip(Integer equipId) {
|
||||
try {
|
||||
return getCrystalForLevel(getEquipStats(equipId).get("reqLevel"));
|
||||
return getCrystalForLevel(getEquipLevelReq(equipId));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@@ -708,7 +708,7 @@ public class MapleStatEffect {
|
||||
if (absorbMp > 0) {
|
||||
mob.setMp(mob.getMp() - absorbMp);
|
||||
applyto.addMP(absorbMp);
|
||||
applyto.getClient().announce(MaplePacketCreator.showOwnBuffEffect(sourceid, 1));
|
||||
applyto.announce(MaplePacketCreator.showOwnBuffEffect(sourceid, 1));
|
||||
applyto.getMap().broadcastMessage(applyto, MaplePacketCreator.showBuffeffect(applyto.getId(), sourceid, 1), false);
|
||||
}
|
||||
}
|
||||
@@ -745,14 +745,14 @@ public class MapleStatEffect {
|
||||
if (primary) {
|
||||
if (itemConNo != 0) {
|
||||
if(!applyto.getClient().getAbstractPlayerInteraction().hasItem(itemCon, itemConNo)) {
|
||||
applyto.getClient().announce(MaplePacketCreator.enableActions());
|
||||
applyto.announce(MaplePacketCreator.enableActions());
|
||||
return false;
|
||||
}
|
||||
MapleInventoryManipulator.removeById(applyto.getClient(), ItemConstants.getInventoryType(itemCon), itemCon, itemConNo, false, true);
|
||||
}
|
||||
} else {
|
||||
if(isResurrection()) {
|
||||
hpchange = applyto.getMaxHp();
|
||||
if (isResurrection()) {
|
||||
hpchange = applyto.getCurrentMaxHp();
|
||||
applyto.setStance(0);
|
||||
|
||||
applyto.getMap().broadcastMessage(applyto, MaplePacketCreator.removePlayerFromMap(applyto.getId()), false);
|
||||
@@ -773,38 +773,11 @@ public class MapleStatEffect {
|
||||
AutobanFactory.MPCON.addPoint(applyfrom.getAutobanManager(), "mpCon hack for skill:" + sourceid + "; Player MP: " + applyto.getMp() + " MP Needed: " + getMpCon());
|
||||
} */
|
||||
|
||||
List<Pair<MapleStat, Integer>> hpmpupdate = new ArrayList<>(2);
|
||||
if (hpchange != 0) {
|
||||
if (hpchange < 0 && (-hpchange) >= applyto.getHp() && (!applyto.hasDisease(MapleDisease.ZOMBIFY) || hpCon > 0)) {
|
||||
if(!applyto.isGM()) {
|
||||
applyto.getClient().announce(MaplePacketCreator.enableActions());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
int newHp = applyto.getHp() + hpchange;
|
||||
if (newHp < 1) {
|
||||
newHp = 1;
|
||||
}
|
||||
applyto.setHp(newHp);
|
||||
hpmpupdate.add(new Pair<>(MapleStat.HP, Integer.valueOf(applyto.getHp())));
|
||||
if (!applyto.applyHpMpChange(hpCon, hpchange, mpchange)) {
|
||||
applyto.announce(MaplePacketCreator.enableActions());
|
||||
return false;
|
||||
}
|
||||
|
||||
if (mpchange != 0) {
|
||||
int newMp = applyto.getMp() + mpchange;
|
||||
if (mpchange < 0 && -mpchange > applyto.getMp()) {
|
||||
if(!applyto.isGM()) {
|
||||
applyto.getClient().announce(MaplePacketCreator.enableActions());
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
newMp = 0;
|
||||
}
|
||||
}
|
||||
|
||||
applyto.setMp(newMp);
|
||||
hpmpupdate.add(new Pair<>(MapleStat.MP, Integer.valueOf(applyto.getMp())));
|
||||
}
|
||||
applyto.getClient().announce(MaplePacketCreator.updatePlayerStats(hpmpupdate, true, applyto));
|
||||
if (moveTo != -1) {
|
||||
if (moveTo != applyto.getMapId()) {
|
||||
MapleMap target;
|
||||
@@ -835,7 +808,6 @@ public class MapleStatEffect {
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
if (isShadowClaw()) {
|
||||
int projectile = 0;
|
||||
@@ -858,8 +830,13 @@ public class MapleStatEffect {
|
||||
SummonMovementType summonMovementType = getSummonMovementType();
|
||||
if (overTime || isCygnusFA() || summonMovementType != null) {
|
||||
if (summonMovementType != null && pos != null) {
|
||||
if(summonMovementType.getValue() == summonMovementType.STATIONARY.getValue()) applyto.cancelBuffStats(MapleBuffStat.PUPPET);
|
||||
else applyto.cancelBuffStats(MapleBuffStat.SUMMON);
|
||||
if(summonMovementType.getValue() == summonMovementType.STATIONARY.getValue()) {
|
||||
applyto.cancelBuffStats(MapleBuffStat.PUPPET);
|
||||
} else {
|
||||
applyto.cancelBuffStats(MapleBuffStat.SUMMON);
|
||||
}
|
||||
|
||||
applyto.announce(MaplePacketCreator.enableActions());
|
||||
}
|
||||
|
||||
applyBuffEffect(applyfrom, applyto, primary);
|
||||
@@ -951,7 +928,7 @@ public class MapleStatEffect {
|
||||
affectedc += affectedp.size(); // used for heal
|
||||
for (MapleCharacter affected : affectedp) {
|
||||
applyTo(applyfrom, affected, false, null, useMaxRange, affectedc);
|
||||
affected.getClient().announce(MaplePacketCreator.showOwnBuffEffect(sourceid, 2));
|
||||
affected.announce(MaplePacketCreator.showOwnBuffEffect(sourceid, 2));
|
||||
affected.getMap().broadcastMessage(affected, MaplePacketCreator.showBuffeffect(affected.getId(), sourceid, 2), false);
|
||||
}
|
||||
}
|
||||
@@ -1186,7 +1163,7 @@ public class MapleStatEffect {
|
||||
hpchange /= 2;
|
||||
}
|
||||
} else { // assumption: this is heal
|
||||
float hpHeal = (applyfrom.getMaxHpEquipped() * (float) hp / (100.0f * affectedPlayers));
|
||||
float hpHeal = (applyfrom.getCurrentMaxHp() * (float) hp / (100.0f * affectedPlayers));
|
||||
hpchange += hpHeal;
|
||||
if (applyfrom.hasDisease(MapleDisease.ZOMBIFY)) {
|
||||
hpchange = -hpchange;
|
||||
@@ -1196,7 +1173,6 @@ public class MapleStatEffect {
|
||||
}
|
||||
if (hpR != 0) {
|
||||
hpchange += (int) (applyfrom.getCurrentMaxHp() * hpR) / (applyfrom.hasDisease(MapleDisease.ZOMBIFY) ? 2 : 1);
|
||||
applyfrom.checkBerserk(applyfrom.isHidden());
|
||||
}
|
||||
if (primary) {
|
||||
if (hpCon != 0) {
|
||||
@@ -1206,7 +1182,7 @@ public class MapleStatEffect {
|
||||
if (isChakra()) {
|
||||
hpchange += makeHealHP(getY() / 100.0, applyfrom.getTotalLuk(), 2.3, 3.5);
|
||||
} else if (sourceid == SuperGM.HEAL_PLUS_DISPEL) {
|
||||
hpchange += (applyfrom.getMaxHp() - applyfrom.getHp());
|
||||
hpchange += applyfrom.getCurrentMaxHp();
|
||||
}
|
||||
|
||||
return hpchange;
|
||||
@@ -1250,7 +1226,7 @@ public class MapleStatEffect {
|
||||
}
|
||||
}
|
||||
if (sourceid == SuperGM.HEAL_PLUS_DISPEL) {
|
||||
mpchange += (applyfrom.getMaxMp() - applyfrom.getMp());
|
||||
mpchange += applyfrom.getCurrentMaxMp();
|
||||
}
|
||||
|
||||
return mpchange;
|
||||
|
||||
@@ -132,12 +132,16 @@ public class MapleLifeFactory {
|
||||
stats.setRevives(revives);
|
||||
}
|
||||
decodeElementalString(stats, MapleDataTool.getString("elemAttr", monsterInfoData, ""));
|
||||
|
||||
MapleMonsterInformationProvider mi = MapleMonsterInformationProvider.getInstance();
|
||||
MapleData monsterSkillInfoData = monsterInfoData.getChildByPath("skill");
|
||||
if (monsterSkillInfoData != null) {
|
||||
int i = 0;
|
||||
List<Pair<Integer, Integer>> skills = new ArrayList<>();
|
||||
while (monsterSkillInfoData.getChildByPath(Integer.toString(i)) != null) {
|
||||
skills.add(new Pair<>(Integer.valueOf(MapleDataTool.getInt(i + "/skill", monsterSkillInfoData, 0)), Integer.valueOf(MapleDataTool.getInt(i + "/level", monsterSkillInfoData, 0))));
|
||||
int skillId = MapleDataTool.getInt(i + "/skill", monsterSkillInfoData, 0);
|
||||
int skillLv = MapleDataTool.getInt(i + "/level", monsterSkillInfoData, 0);
|
||||
skills.add(new Pair<>(skillId, skillLv));
|
||||
|
||||
MapleData monsterSkillData = monsterData.getChildByPath("skill" + (i + 1));
|
||||
if (monsterSkillData != null) {
|
||||
@@ -146,7 +150,8 @@ public class MapleLifeFactory {
|
||||
animationTime += MapleDataTool.getIntConvert("delay", effectEntry, 0);
|
||||
}
|
||||
|
||||
MapleMonsterInformationProvider.getInstance().setMobSkillAnimationTime(mid, i, animationTime);
|
||||
MobSkill skill = MobSkillFactory.getMobSkill(skillId, skillLv);
|
||||
mi.setMobSkillAnimationTime(skill, animationTime);
|
||||
}
|
||||
|
||||
i++;
|
||||
@@ -162,7 +167,10 @@ public class MapleLifeFactory {
|
||||
animationTime += MapleDataTool.getIntConvert("delay", effectEntry, 0);
|
||||
}
|
||||
|
||||
MapleMonsterInformationProvider.getInstance().setMobAttackAnimationTime(mid, i, animationTime);
|
||||
int mpCon = MapleDataTool.getIntConvert("info/conMP", monsterAttackData, 0);
|
||||
int coolTime = MapleDataTool.getIntConvert("info/attackAfter", monsterAttackData, 0);
|
||||
mi.setMobAttackInfo(mid, i, mpCon, coolTime);
|
||||
mi.setMobAttackAnimationTime(mid, i, animationTime);
|
||||
i++;
|
||||
}
|
||||
|
||||
|
||||
@@ -79,7 +79,6 @@ public class MapleMonster extends AbstractLoadedMapleLife {
|
||||
private AtomicInteger hp = new AtomicInteger(1);
|
||||
private AtomicLong maxHpPlusHeal = new AtomicLong(1);
|
||||
private int mp;
|
||||
private long nextBasicSkillTime;
|
||||
private WeakReference<MapleCharacter> controller = new WeakReference<>(null);
|
||||
private boolean controllerHasAggro, controllerKnowsAboutAggro;
|
||||
private Collection<MonsterListener> listeners = new LinkedList<>();
|
||||
@@ -91,6 +90,7 @@ public class MapleMonster extends AbstractLoadedMapleLife {
|
||||
private boolean dropsDisabled = false;
|
||||
private List<Pair<Integer, Integer>> usedSkills = new ArrayList<>();
|
||||
private Map<Pair<Integer, Integer>, Integer> skillsUsed = new HashMap<>();
|
||||
private Set<Integer> usedAttacks = new HashSet<>();
|
||||
private List<Integer> stolenItems = new ArrayList<>();
|
||||
private int team;
|
||||
private int parentMobOid = 0;
|
||||
@@ -240,16 +240,16 @@ public class MapleMonster extends AbstractLoadedMapleLife {
|
||||
applyAndGetHpDamage(Integer.MAX_VALUE, false);
|
||||
}
|
||||
|
||||
public boolean applyAnimationIfRoaming(int attackPos, int skillPos) { // roam: not casting attack or skill animations
|
||||
private boolean applyAnimationIfRoaming(int attackPos, MobSkill skill) { // roam: not casting attack or skill animations
|
||||
if(!animationLock.tryLock()) return false;
|
||||
|
||||
try {
|
||||
long animationTime;
|
||||
|
||||
if(skillPos < 0) {
|
||||
if(skill == null) {
|
||||
animationTime = MapleMonsterInformationProvider.getInstance().getMobAttackAnimationTime(this.getId(), attackPos);
|
||||
} else {
|
||||
animationTime = MapleMonsterInformationProvider.getInstance().getMobSkillAnimationTime(this.getId(), skillPos);
|
||||
animationTime = MapleMonsterInformationProvider.getInstance().getMobSkillAnimationTime(skill);
|
||||
}
|
||||
|
||||
if(animationTime > 0) {
|
||||
@@ -1238,12 +1238,36 @@ public class MapleMonster extends AbstractLoadedMapleLife {
|
||||
public boolean hasSkill(int skillId, int level) {
|
||||
return stats.hasSkill(skillId, level);
|
||||
}
|
||||
|
||||
|
||||
public boolean canUseSkill(MobSkill toUse) {
|
||||
if (toUse == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (toUse.getSkillId() == 200) {
|
||||
int i = 0;
|
||||
for (MapleMapObject mo : getMap().getMapObjects()) {
|
||||
if (mo.getType() == MapleMapObjectType.MONSTER) {
|
||||
i++;
|
||||
}
|
||||
}
|
||||
if (i > 100) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (toUse.getLimit() > 0) {
|
||||
monsterLock.lock();
|
||||
try {
|
||||
Integer times = this.skillsUsed.get(new Pair<>(toUse.getSkillId(), toUse.getSkillLevel()));
|
||||
if (times != null && times >= toUse.getLimit()) {
|
||||
return false;
|
||||
}
|
||||
} finally {
|
||||
monsterLock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
monsterLock.lock();
|
||||
try {
|
||||
for (Pair<Integer, Integer> skill : usedSkills) {
|
||||
@@ -1251,41 +1275,32 @@ public class MapleMonster extends AbstractLoadedMapleLife {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
int mpCon = toUse.getMpCon();
|
||||
if (mp < mpCon) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!this.applyAnimationIfRoaming(-1, toUse)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
this.usedSkill(toUse);
|
||||
} finally {
|
||||
monsterLock.unlock();
|
||||
}
|
||||
|
||||
if (toUse.getLimit() > 0) {
|
||||
monsterLock.lock();
|
||||
try {
|
||||
if (this.skillsUsed.containsKey(new Pair<>(toUse.getSkillId(), toUse.getSkillLevel()))) {
|
||||
int times = this.skillsUsed.get(new Pair<>(toUse.getSkillId(), toUse.getSkillLevel()));
|
||||
if (times >= toUse.getLimit()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
monsterLock.unlock();
|
||||
}
|
||||
}
|
||||
if (toUse.getSkillId() == 200) {
|
||||
Collection<MapleMapObject> mmo = getMap().getMapObjects();
|
||||
int i = 0;
|
||||
for (MapleMapObject mo : mmo) {
|
||||
if (mo.getType() == MapleMapObjectType.MONSTER) {
|
||||
i++;
|
||||
}
|
||||
}
|
||||
if (i > 100) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void usedSkill(final int skillId, final int level, long cooltime) {
|
||||
private void usedSkill(MobSkill skill) {
|
||||
final int skillId = skill.getSkillId(), level = skill.getSkillLevel();
|
||||
long cooltime = skill.getCoolTime();
|
||||
|
||||
monsterLock.lock();
|
||||
try {
|
||||
mp -= skill.getMpCon();
|
||||
|
||||
this.usedSkills.add(new Pair<>(skillId, level));
|
||||
if (this.skillsUsed.containsKey(new Pair<>(skillId, level))) {
|
||||
int times = this.skillsUsed.get(new Pair<>(skillId, level)) + 1;
|
||||
@@ -1310,7 +1325,7 @@ public class MapleMonster extends AbstractLoadedMapleLife {
|
||||
mmap.getChannelServer().registerMobClearSkillAction(mmap.getId(), r, cooltime);
|
||||
}
|
||||
|
||||
public void clearSkill(int skillId, int level) {
|
||||
private void clearSkill(int skillId, int level) {
|
||||
monsterLock.lock();
|
||||
try {
|
||||
int index = -1;
|
||||
@@ -1327,13 +1342,63 @@ public class MapleMonster extends AbstractLoadedMapleLife {
|
||||
monsterLock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
public long getNextBasicSkillTime() {
|
||||
return nextBasicSkillTime;
|
||||
|
||||
public int canUseAttack(int attackPos) {
|
||||
monsterLock.lock();
|
||||
try {
|
||||
if (usedAttacks.contains(attackPos)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
Pair<Integer, Integer> attackInfo = MapleMonsterInformationProvider.getInstance().getMobAttackInfo(this.getId(), attackPos);
|
||||
if (attackInfo == null) {
|
||||
return usedAttacks.isEmpty() ? 0 : -1;
|
||||
}
|
||||
|
||||
int mpCon = attackInfo.getLeft();
|
||||
if (mp < mpCon) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!this.applyAnimationIfRoaming(attackPos, null)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
usedAttack(attackPos, mpCon, attackInfo.getRight());
|
||||
return 1;
|
||||
} finally {
|
||||
monsterLock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
public void setNextBasicSkillTime(long time) {
|
||||
nextBasicSkillTime = time + 4200;
|
||||
private void usedAttack(final int attackPos, int mpCon, int cooltime) {
|
||||
monsterLock.lock();
|
||||
try {
|
||||
mp -= mpCon;
|
||||
usedAttacks.add(attackPos);
|
||||
|
||||
final MapleMonster mons = this;
|
||||
MapleMap mmap = mons.getMap();
|
||||
Runnable r = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mons.clearAttack(attackPos);
|
||||
}
|
||||
};
|
||||
|
||||
mmap.getChannelServer().registerMobClearSkillAction(mmap.getId(), r, cooltime);
|
||||
} finally {
|
||||
monsterLock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
private void clearAttack(int attackPos) {
|
||||
monsterLock.lock();
|
||||
try {
|
||||
usedAttacks.remove(attackPos);
|
||||
} finally {
|
||||
monsterLock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
public int getNoSkills() {
|
||||
|
||||
@@ -60,7 +60,9 @@ public class MapleMonsterInformationProvider {
|
||||
private final Map<Integer, List<MonsterDropEntry>> extraMultiEquipDrops = new HashMap<>();
|
||||
|
||||
private final Map<Pair<Integer, Integer>, Integer> mobAttackAnimationTime = new HashMap<>();
|
||||
private final Map<Pair<Integer, Integer>, Integer> mobSkillAnimationTime = new HashMap<>();
|
||||
private final Map<MobSkill, Integer> mobSkillAnimationTime = new HashMap<>();
|
||||
|
||||
private final Map<Integer, Pair<Integer, Integer>> mobAttackInfo = new HashMap<>();
|
||||
|
||||
protected MapleMonsterInformationProvider() {
|
||||
retrieveGlobal();
|
||||
@@ -237,14 +239,23 @@ public class MapleMonsterInformationProvider {
|
||||
return time == null ? 0 : time;
|
||||
}
|
||||
|
||||
public final void setMobSkillAnimationTime(int monsterId, int skillPos, int animationTime) {
|
||||
mobSkillAnimationTime.put(new Pair<>(monsterId, skillPos), animationTime);
|
||||
public final void setMobSkillAnimationTime(MobSkill skill, int animationTime) {
|
||||
mobSkillAnimationTime.put(skill, animationTime);
|
||||
}
|
||||
|
||||
public final Integer getMobSkillAnimationTime(int monsterId, int skillPos) {
|
||||
Integer time = mobSkillAnimationTime.get(new Pair<>(monsterId, skillPos));
|
||||
public final Integer getMobSkillAnimationTime(MobSkill skill) {
|
||||
Integer time = mobSkillAnimationTime.get(skill);
|
||||
return time == null ? 0 : time;
|
||||
}
|
||||
|
||||
public final void setMobAttackInfo(int monsterId, int attackPos, int mpCon, int coolTime) {
|
||||
mobAttackInfo.put((monsterId << 3) + attackPos, new Pair<>(mpCon, coolTime));
|
||||
}
|
||||
|
||||
public final Pair<Integer, Integer> getMobAttackInfo(int monsterId, int attackPos) {
|
||||
if (attackPos < 0 || attackPos > 7) return null;
|
||||
return mobAttackInfo.get((monsterId << 3) + attackPos);
|
||||
}
|
||||
|
||||
public static ArrayList<Pair<Integer, String>> getMobsIDsFromName(String search) {
|
||||
MapleDataProvider dataProvider = MapleDataProviderFactory.getDataProvider(new File("wz/String.wz"));
|
||||
|
||||
@@ -323,8 +323,6 @@ public class MobSkill {
|
||||
player.giveDebuff(disease, this);
|
||||
}
|
||||
}
|
||||
monster.usedSkill(skillId, skillLevel, cooltime);
|
||||
monster.setMp(monster.getMp() - getMpCon());
|
||||
}
|
||||
|
||||
private List<MapleCharacter> getPlayersInRange(MapleMonster monster, MapleCharacter player) {
|
||||
|
||||
@@ -861,7 +861,7 @@ public class MapleMap {
|
||||
}
|
||||
|
||||
private void registerItemDrop(MapleMapItem mdrop) {
|
||||
droppedItems.put(mdrop, !everlast ? System.currentTimeMillis() + ServerConstants.ITEM_EXPIRE_TIME : Long.MAX_VALUE);
|
||||
droppedItems.put(mdrop, !everlast ? Server.getInstance().getCurrentTime() + ServerConstants.ITEM_EXPIRE_TIME : Long.MAX_VALUE);
|
||||
}
|
||||
|
||||
private void unregisterItemDrop(MapleMapItem mdrop) {
|
||||
@@ -878,7 +878,7 @@ public class MapleMap {
|
||||
|
||||
objectRLock.lock();
|
||||
try {
|
||||
long timeNow = System.currentTimeMillis();
|
||||
long timeNow = Server.getInstance().getCurrentTime();
|
||||
|
||||
for(Entry<MapleMapItem, Long> it : droppedItems.entrySet()) {
|
||||
if(it.getValue() < timeNow) {
|
||||
@@ -1018,7 +1018,7 @@ public class MapleMap {
|
||||
|
||||
private void spawnDrop(final Item idrop, final Point dropPos, final MapleMapObject dropper, final MapleCharacter chr, final byte droptype, final short questid) {
|
||||
final MapleMapItem mdrop = new MapleMapItem(idrop, dropPos, dropper, chr, chr.getClient(), droptype, false, questid);
|
||||
mdrop.setDropTime(System.currentTimeMillis());
|
||||
mdrop.setDropTime(Server.getInstance().getCurrentTime());
|
||||
spawnAndAddRangedMapObject(mdrop, new DelayedPacketCreation() {
|
||||
@Override
|
||||
public void sendPackets(MapleClient c) {
|
||||
@@ -1042,7 +1042,7 @@ public class MapleMap {
|
||||
public final void spawnMesoDrop(final int meso, final Point position, final MapleMapObject dropper, final MapleCharacter owner, final boolean playerDrop, final byte droptype) {
|
||||
final Point droppos = calcDropPos(position, position);
|
||||
final MapleMapItem mdrop = new MapleMapItem(meso, droppos, dropper, owner, owner.getClient(), droptype, playerDrop);
|
||||
mdrop.setDropTime(System.currentTimeMillis());
|
||||
mdrop.setDropTime(Server.getInstance().getCurrentTime());
|
||||
|
||||
spawnAndAddRangedMapObject(mdrop, new DelayedPacketCreation() {
|
||||
@Override
|
||||
@@ -1904,7 +1904,7 @@ public class MapleMap {
|
||||
}
|
||||
|
||||
spawnedMonstersOnMap.incrementAndGet();
|
||||
applyRemoveAfter(monster);
|
||||
applyRemoveAfter(monster); // thanks LightRyuzaki for pointing issues with spawned CWKPQ mobs not applying this
|
||||
}
|
||||
|
||||
public void spawnDojoMonster(final MapleMonster monster) {
|
||||
@@ -2050,10 +2050,10 @@ public class MapleMap {
|
||||
List<MapleMapObject> players = getMapObjectsInBox(mist.getBox(), Collections.singletonList(MapleMapObjectType.PLAYER));
|
||||
for (MapleMapObject mo : players) {
|
||||
if (mist.makeChanceResult()) {
|
||||
MapleCharacter chr = (MapleCharacter) mo;
|
||||
if (mist.getOwner().getId() == chr.getId() || mist.getOwner().getParty() != null && mist.getOwner().getParty().containsMembers(chr.getMPC())) {
|
||||
chr.addMP((int) mist.getSourceSkill().getEffect(chr.getSkillLevel(mist.getSourceSkill().getId())).getX() * chr.getMp() / 100);
|
||||
}
|
||||
MapleCharacter chr = (MapleCharacter) mo;
|
||||
if (mist.getOwner().getId() == chr.getId() || mist.getOwner().getParty() != null && mist.getOwner().getParty().containsMembers(chr.getMPC())) {
|
||||
chr.addMP((int) mist.getSourceSkill().getEffect(chr.getSkillLevel(mist.getSourceSkill().getId())).getX() * chr.getMp() / 100);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2099,7 +2099,7 @@ public class MapleMap {
|
||||
public final void spawnItemDrop(final MapleMapObject dropper, final MapleCharacter owner, final Item item, Point pos, final byte dropType, final boolean playerDrop) {
|
||||
final Point droppos = calcDropPos(pos, pos);
|
||||
final MapleMapItem mdrop = new MapleMapItem(item, droppos, dropper, owner, owner.getClient(), dropType, playerDrop);
|
||||
mdrop.setDropTime(System.currentTimeMillis());
|
||||
mdrop.setDropTime(Server.getInstance().getCurrentTime());
|
||||
|
||||
spawnAndAddRangedMapObject(mdrop, new DelayedPacketCreation() {
|
||||
@Override
|
||||
@@ -2636,11 +2636,11 @@ public class MapleMap {
|
||||
monster.setControllerKnowsAboutAggro(false);
|
||||
updateMonsterController(monster);
|
||||
}
|
||||
chr.leaveMap();
|
||||
|
||||
chr.leaveMap();
|
||||
for (MapleSummon summon : new ArrayList<>(chr.getSummonsValues())) {
|
||||
if (summon.isStationary()) {
|
||||
chr.cancelBuffStats(MapleBuffStat.PUPPET);
|
||||
chr.cancelEffectFromBuffStat(MapleBuffStat.PUPPET);
|
||||
} else {
|
||||
removeMapObject(summon);
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ package server.quest.actions;
|
||||
|
||||
import client.MapleCharacter;
|
||||
import constants.ServerConstants;
|
||||
import net.server.world.World;
|
||||
import provider.MapleData;
|
||||
import provider.MapleDataTool;
|
||||
import server.quest.MapleQuest;
|
||||
@@ -58,7 +59,8 @@ public class ExpAction extends MapleQuestAction {
|
||||
if(!ServerConstants.USE_QUEST_RATE) {
|
||||
chr.gainExp(gain * chr.getExpRate(), true, true);
|
||||
} else {
|
||||
chr.gainExp(gain * ServerConstants.EXP_RATE * ServerConstants.QUEST_RATE, true, true);
|
||||
World w = chr.getClient().getWorldServer();
|
||||
chr.gainExp(gain * w.getExpRate() * w.getQuestRate(), true, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ package server.quest.actions;
|
||||
|
||||
import client.MapleCharacter;
|
||||
import constants.ServerConstants;
|
||||
import net.server.world.World;
|
||||
import provider.MapleData;
|
||||
import provider.MapleDataTool;
|
||||
import server.quest.MapleQuest;
|
||||
@@ -59,7 +60,8 @@ public class MesoAction extends MapleQuestAction {
|
||||
if(!ServerConstants.USE_QUEST_RATE) {
|
||||
chr.gainMeso(gain * chr.getMesoRate(), true, false, true);
|
||||
} else {
|
||||
chr.gainMeso(gain * ServerConstants.MESO_RATE * ServerConstants.QUEST_RATE, true, false, true);
|
||||
World w = chr.getClient().getWorldServer();
|
||||
chr.gainMeso(gain * w.getMesoRate() * w.getQuestRate(), true, false, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user