Implemented EllinPQ + some bug fixes
Implemented EllinPQ, adjusted several drop rates and data, fixes some bugs at quests at client-side.
This commit is contained in:
@@ -48,6 +48,8 @@ import java.util.Set;
|
||||
//import java.util.TimeZone;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
import java.util.concurrent.locks.Lock;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import net.server.PlayerBuffValueHolder;
|
||||
@@ -274,6 +276,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
|
||||
private long useDuey;
|
||||
private long petLootCd;
|
||||
private int newWarpMap = -1;
|
||||
private Lock sLock = new ReentrantLock(true);
|
||||
|
||||
private MapleCharacter() {
|
||||
setStance(0);
|
||||
@@ -552,7 +555,12 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
|
||||
}
|
||||
|
||||
public void addSummon(int id, MapleSummon summon) {
|
||||
summons.put(id, summon);
|
||||
sLock.lock();
|
||||
try {
|
||||
summons.put(id, summon);
|
||||
} finally {
|
||||
sLock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
public void addVisibleMapObject(MapleMapObject mo) {
|
||||
@@ -1360,22 +1368,28 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
|
||||
}
|
||||
} else if (stat == MapleBuffStat.SUMMON || stat == MapleBuffStat.PUPPET) {
|
||||
int summonId = mbsvh.effect.getSourceId();
|
||||
MapleSummon summon = summons.get(summonId);
|
||||
if (summon != null) {
|
||||
getMap().broadcastMessage(MaplePacketCreator.removeSummon(summon, true), summon.getPosition());
|
||||
getMap().removeMapObject(summon);
|
||||
removeVisibleMapObject(summon);
|
||||
summons.remove(summonId);
|
||||
}
|
||||
if (summon.getSkill() == DarkKnight.BEHOLDER) {
|
||||
if (beholderHealingSchedule != null) {
|
||||
beholderHealingSchedule.cancel(false);
|
||||
beholderHealingSchedule = null;
|
||||
|
||||
sLock.lock();
|
||||
try {
|
||||
MapleSummon summon = summons.get(summonId);
|
||||
if (summon != null) {
|
||||
getMap().broadcastMessage(MaplePacketCreator.removeSummon(summon, true), summon.getPosition());
|
||||
getMap().removeMapObject(summon);
|
||||
removeVisibleMapObject(summon);
|
||||
summons.remove(summonId);
|
||||
}
|
||||
if (beholderBuffSchedule != null) {
|
||||
beholderBuffSchedule.cancel(false);
|
||||
beholderBuffSchedule = null;
|
||||
if (summon.getSkill() == DarkKnight.BEHOLDER) {
|
||||
if (beholderHealingSchedule != null) {
|
||||
beholderHealingSchedule.cancel(false);
|
||||
beholderHealingSchedule = null;
|
||||
}
|
||||
if (beholderBuffSchedule != null) {
|
||||
beholderBuffSchedule.cancel(false);
|
||||
beholderBuffSchedule = null;
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
sLock.unlock();
|
||||
}
|
||||
} else if (stat == MapleBuffStat.DRAGONBLOOD) {
|
||||
dragonBloodSchedule.cancel(false);
|
||||
@@ -1725,7 +1739,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
|
||||
return ret;
|
||||
}
|
||||
|
||||
public List<Pair<MapleBuffStat, Integer>> getAllStatups() {
|
||||
public List<Pair<MapleBuffStat, Integer>> getAllStatups() {
|
||||
List<Pair<MapleBuffStat, Integer>> ret = new ArrayList<>();
|
||||
for (MapleBuffStat mbs : effects.keySet()) {
|
||||
MapleBuffStatValueHolder mbsvh = effects.get(mbs);
|
||||
@@ -1827,6 +1841,8 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
|
||||
private List<MapleBuffStat> getBuffStats(MapleStatEffect effect, long startTime) {
|
||||
List<MapleBuffStat> stats = new ArrayList<>();
|
||||
for (Entry<MapleBuffStat, MapleBuffStatValueHolder> stateffect : effects.entrySet()) {
|
||||
if(stateffect.getValue() == null) continue;
|
||||
|
||||
if (stateffect.getValue().effect.sameSource(effect) && (startTime == -1 || startTime == stateffect.getValue().startTime)) {
|
||||
stats.add(stateffect.getKey());
|
||||
}
|
||||
@@ -2284,6 +2300,18 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
|
||||
public int getPartyId() {
|
||||
return (party != null ? party.getId() : -1);
|
||||
}
|
||||
|
||||
public List<MapleCharacter> getPartyMembers() {
|
||||
List<MapleCharacter> list = new LinkedList<>();
|
||||
|
||||
if(party != null) {
|
||||
for(MaplePartyCharacter partyMembers: party.getMembers()) {
|
||||
list.add(partyMembers.getPlayer());
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public MaplePlayerShop getPlayerShop() {
|
||||
return playerShop;
|
||||
@@ -2500,9 +2528,50 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
|
||||
public int getStr() {
|
||||
return str;
|
||||
}
|
||||
|
||||
public Map<Integer, MapleSummon> getSummons() {
|
||||
return summons;
|
||||
|
||||
public Collection<MapleSummon> getSummonsValues() {
|
||||
sLock.lock();
|
||||
try {
|
||||
return summons.values();
|
||||
} finally {
|
||||
sLock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
public void clearSummons() {
|
||||
sLock.lock();
|
||||
try {
|
||||
summons.clear();
|
||||
} finally {
|
||||
sLock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
public MapleSummon getSummonByKey(int id) {
|
||||
sLock.lock();
|
||||
try {
|
||||
return summons.get(id);
|
||||
} finally {
|
||||
sLock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isSummonsEmpty() {
|
||||
sLock.lock();
|
||||
try {
|
||||
return summons.isEmpty();
|
||||
} finally {
|
||||
sLock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean containsSummon(MapleSummon summon) {
|
||||
sLock.lock();
|
||||
try {
|
||||
return summons.containsValue(summon);
|
||||
} finally {
|
||||
sLock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
public int getTotalStr() {
|
||||
@@ -4908,7 +4977,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean skillisCooling(int skillId) {
|
||||
public boolean skillIsCooling(int skillId) {
|
||||
return coolDowns.containsKey(Integer.valueOf(skillId));
|
||||
}
|
||||
|
||||
@@ -5403,8 +5472,8 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((itemName.contains("Reverse") && nEquip.getItemLevel() < 4) || itemName.contains("Timeless") && nEquip.getItemLevel() < 6) {
|
||||
nEquip.gainItemExp(client, mobexp, itemName.contains("Timeless"));
|
||||
if ((nEquip.getItemLevel() < ServerConstants.USE_EQUIPMNT_LVLUP) && (itemName.contains("Reverse") && nEquip.getItemLevel() < 4) || itemName.contains("Timeless") && nEquip.getItemLevel() < 6) {
|
||||
nEquip.gainItemExp(client, mobexp, itemName.contains("Reverse"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -638,17 +638,34 @@ public class Commands {
|
||||
break;
|
||||
|
||||
//debug only
|
||||
case "map":
|
||||
case "debugpos":
|
||||
if(ServerConstants.USE_DEBUG) {
|
||||
player.dropMessage("Current map position: (" + player.getPosition().getX() + ", " + player.getPosition().getY() + ").");
|
||||
break;
|
||||
}
|
||||
case "mapcount":
|
||||
break;
|
||||
|
||||
case "debugmapcount":
|
||||
if(ServerConstants.USE_DEBUG) {
|
||||
player.dropMessage("Current map count: (" + player.getMap().getAllPlayers().size() + ").");
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case "debugevent":
|
||||
if(ServerConstants.USE_DEBUG) {
|
||||
if(player.getEventInstance() == null) player.dropMessage("Player currently not in a event.");
|
||||
else player.dropMessage("Current event name: " + player.getEventInstance().getName() + ".");
|
||||
}
|
||||
break;
|
||||
|
||||
case "debugreactors":
|
||||
if(ServerConstants.USE_DEBUG) {
|
||||
player.dropMessage("Current reactor states on map " + player.getMapId() + ":");
|
||||
for(Pair p: player.getMap().reportReactorStates()) {
|
||||
player.dropMessage("Reactor id: " + p.getLeft() + " -> State: " + p.getRight() + ".");
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
if (player.gmLevel() == 0) {
|
||||
player.yellowMessage("Player Command " + heading + sub[0] + " does not exist, see @help for a list of commands.");
|
||||
|
||||
@@ -312,14 +312,14 @@ public class Equip extends Item {
|
||||
return (int) itemExp;
|
||||
}
|
||||
|
||||
public void gainItemExp(MapleClient c, int gain, boolean timeless) {
|
||||
int expneeded = timeless ? (10 * itemLevel + 70) : (5 * itemLevel + 65);
|
||||
public void gainItemExp(MapleClient c, int gain, boolean reverse) {
|
||||
int expneeded = !reverse ? (10 * itemLevel + 70) : (5 * itemLevel + 65);
|
||||
float modifier = 364 / expneeded;
|
||||
float exp = (expneeded / (1000000 * modifier * modifier)) * gain;
|
||||
itemExp += exp;
|
||||
if (itemExp >= 364) {
|
||||
itemExp = (itemExp - 364);
|
||||
gainLevel(c, timeless);
|
||||
gainLevel(c, !reverse);
|
||||
} else {
|
||||
c.getPlayer().forceUpdateItem(this);
|
||||
}
|
||||
|
||||
@@ -49,8 +49,9 @@ public class ServerConstants {
|
||||
//public static final boolean USE_ULTRA_THREE_SNAILS = true;
|
||||
public static final boolean USE_ADD_SLOTS_BY_LEVEL = true; //slots are added each 20 levels.
|
||||
public static final boolean USE_ADD_RATES_BY_LEVEL = true; //rates are added each 20 levels.
|
||||
public static final int FAME_GAIN_BY_QUEST = 4; //fame gain each N quest completes, set 0 to disable.
|
||||
public static final int SCROLL_CHANCE_RATE = 10; //number of tries for success on a scroll, set 0 for default.
|
||||
public static final int USE_EQUIPMNT_LVLUP = 7; //all equips lvlup at max level as N, set 0 to disable.
|
||||
public static final int FAME_GAIN_BY_QUEST = 4; //fame gain each N quest completes, set 0 to disable.
|
||||
public static final int SCROLL_CHANCE_RATE = 10; //number of tries for success on a scroll, set 0 for default.
|
||||
|
||||
//Pet auto-pot recovery rates
|
||||
public static final double PET_AUTOHP_RATIO = 0.99; //will automatically consume potions until given ratio of the MaxHP/MaxMP is reached.
|
||||
|
||||
@@ -75,8 +75,8 @@ public class AutoAssignHandler extends AbstractMaplePacketHandler {
|
||||
//c.getPlayer().message("----------------------------------------SDL: " + eqpStr + eqpDex + eqpLuk + " BASE STATS --> STR: " + chr.getStr() + " DEX: " + chr.getDex() + " INT: " + chr.getInt() + " LUK: " + chr.getLuk());
|
||||
//c.getPlayer().message("SUM EQUIP STATS -> STR: " + str + " DEX: " + dex + " LUK: " + luk + " INT: " + int_);
|
||||
|
||||
//---------- Ronan Lana's AUTOASSIGN -------------
|
||||
//this method excels for possibility to assign APs properly and not blocking the requirements when swapping one guaranteed equipment.
|
||||
// ---------- Ronan Lana's AUTOASSIGN -------------
|
||||
// This method excels for assigning APs in such a way to cover all equipments AP requirements.
|
||||
if (chr.getRemainingAp() < 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ public final class BeholderHandler extends AbstractMaplePacketHandler {//Summon
|
||||
@Override
|
||||
public final void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) {
|
||||
//System.out.println(slea.toString());
|
||||
Collection<MapleSummon> summons = c.getPlayer().getSummons().values();
|
||||
Collection<MapleSummon> summons = c.getPlayer().getSummonsValues();
|
||||
int oid = slea.readInt();
|
||||
MapleSummon summon = null;
|
||||
for (MapleSummon sum : summons) {
|
||||
@@ -53,7 +53,7 @@ public final class BeholderHandler extends AbstractMaplePacketHandler {//Summon
|
||||
slea.readByte(); //Not sure.
|
||||
} //show to others here
|
||||
} else {
|
||||
c.getPlayer().getSummons().clear();
|
||||
c.getPlayer().clearSummons();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -145,7 +145,7 @@ public final class CloseRangeDamageHandler extends AbstractDealDamageHandler {
|
||||
Skill skill = SkillFactory.getSkill(attack.skill);
|
||||
MapleStatEffect effect_ = skill.getEffect(player.getSkillLevel(skill));
|
||||
if (effect_.getCooldown() > 0) {
|
||||
if (player.skillisCooling(attack.skill)) {
|
||||
if (player.skillIsCooling(attack.skill)) {
|
||||
return;
|
||||
} else {
|
||||
c.announce(MaplePacketCreator.skillCooldown(attack.skill, effect_.getCooldown()));
|
||||
|
||||
@@ -38,7 +38,7 @@ public final class DamageSummonHandler extends AbstractMaplePacketHandler {
|
||||
int monsterIdFrom = slea.readInt();
|
||||
if (SkillFactory.getSkill(skillid) != null) {
|
||||
MapleCharacter player = c.getPlayer();
|
||||
MapleSummon summon = player.getSummons().get(skillid);
|
||||
MapleSummon summon = player.getSummonByKey(skillid);
|
||||
if (summon != null) {
|
||||
summon.addHP(-damage);
|
||||
if (summon.getHP() <= 0) {
|
||||
|
||||
@@ -67,7 +67,7 @@ public final class MagicDamageHandler extends AbstractDealDamageHandler {
|
||||
Skill skill = SkillFactory.getSkill(attack.skill);
|
||||
MapleStatEffect effect_ = skill.getEffect(player.getSkillLevel(skill));
|
||||
if (effect_.getCooldown() > 0) {
|
||||
if (player.skillisCooling(attack.skill)) {
|
||||
if (player.skillIsCooling(attack.skill)) {
|
||||
return;
|
||||
} else {
|
||||
c.announce(MaplePacketCreator.skillCooldown(attack.skill, effect_.getCooldown()));
|
||||
|
||||
@@ -38,7 +38,7 @@ public final class MoveSummonHandler extends AbstractMovementPacketHandler {
|
||||
Point startPos = new Point(slea.readShort(), slea.readShort());
|
||||
List<LifeMovementFragment> res = parseMovement(slea);
|
||||
MapleCharacter player = c.getPlayer();
|
||||
Collection<MapleSummon> summons = player.getSummons().values();
|
||||
Collection<MapleSummon> summons = player.getSummonsValues();
|
||||
MapleSummon summon = null;
|
||||
for (MapleSummon sum : summons) {
|
||||
if (sum.getObjectId() == oid) {
|
||||
|
||||
@@ -198,7 +198,7 @@ public final class RangedAttackHandler extends AbstractDealDamageHandler {
|
||||
Skill skill = SkillFactory.getSkill(attack.skill);
|
||||
MapleStatEffect effect_ = skill.getEffect(player.getSkillLevel(skill));
|
||||
if (effect_.getCooldown() > 0) {
|
||||
if (player.skillisCooling(attack.skill)) {
|
||||
if (player.skillIsCooling(attack.skill)) {
|
||||
return;
|
||||
} else {
|
||||
c.announce(MaplePacketCreator.skillCooldown(attack.skill, effect_.getCooldown()));
|
||||
|
||||
@@ -41,7 +41,7 @@ public final class ReactorHitHandler extends AbstractMaplePacketHandler {
|
||||
int skillid = slea.readInt();
|
||||
MapleReactor reactor = c.getPlayer().getMap().getReactorByOid(oid);
|
||||
if (reactor != null && reactor.isAlive()) {
|
||||
reactor.hitReactor(charPos, stance, skillid, c, false);
|
||||
reactor.hitReactor(charPos, stance, skillid, c);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ public final class SpecialMoveHandler extends AbstractMaplePacketHandler {
|
||||
|
||||
MapleStatEffect effect = skill.getEffect(skillLevel);
|
||||
if (effect.getCooldown() > 0) {
|
||||
if (chr.skillisCooling(skillid)) {
|
||||
if (chr.skillIsCooling(skillid)) {
|
||||
return;
|
||||
} else if (skillid != Corsair.BATTLE_SHIP) {
|
||||
c.announce(MaplePacketCreator.skillCooldown(skillid, effect.getCooldown()));
|
||||
|
||||
@@ -63,7 +63,7 @@ public final class SummonDamageHandler extends AbstractMaplePacketHandler {
|
||||
return;
|
||||
}
|
||||
MapleSummon summon = null;
|
||||
for (MapleSummon sum : player.getSummons().values()) {
|
||||
for (MapleSummon sum : player.getSummonsValues()) {
|
||||
if (sum.getObjectId() == oid) {
|
||||
summon = sum;
|
||||
}
|
||||
|
||||
@@ -46,6 +46,9 @@ import server.maps.MapleMap;
|
||||
import server.maps.MapleMapFactory;
|
||||
import tools.DatabaseConnection;
|
||||
import client.MapleCharacter;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -67,6 +70,7 @@ public class EventInstanceManager {
|
||||
private final ReentrantReadWriteLock mutex = new ReentrantReadWriteLock();
|
||||
private final ReadLock rL = mutex.readLock();
|
||||
private final WriteLock wL = mutex.writeLock();
|
||||
private ScheduledFuture<?> event_schedule = null;
|
||||
private boolean disposed = false;
|
||||
|
||||
public EventInstanceManager(EventManager em, String name) {
|
||||
@@ -114,8 +118,18 @@ public class EventInstanceManager {
|
||||
}
|
||||
|
||||
public void startEventTimer(long time) {
|
||||
timeStarted = System.currentTimeMillis();
|
||||
timeStarted = System.currentTimeMillis();
|
||||
eventTime = time;
|
||||
|
||||
event_schedule = TimerManager.getInstance().schedule(new Runnable() {
|
||||
public void run() {
|
||||
try {
|
||||
em.getIv().invokeFunction("scheduledTimeout", EventInstanceManager.this);
|
||||
} catch (ScriptException | NoSuchMethodException ex) {
|
||||
Logger.getLogger(EventManager.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
}, time);
|
||||
}
|
||||
|
||||
public boolean isTimerStarted() {
|
||||
@@ -186,6 +200,11 @@ public class EventInstanceManager {
|
||||
|
||||
public void monsterKilled(MapleMonster mob) {
|
||||
mobs.remove(mob);
|
||||
try {
|
||||
em.getIv().invokeFunction("monsterKilled", mob, this);
|
||||
} catch (ScriptException | NoSuchMethodException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
if (mobs.isEmpty()) {
|
||||
try {
|
||||
em.getIv().invokeFunction("allMonstersDead", this);
|
||||
@@ -268,6 +287,8 @@ public class EventInstanceManager {
|
||||
} finally {
|
||||
wL.unlock();
|
||||
}
|
||||
|
||||
event_schedule.cancel(true);
|
||||
|
||||
mobs.clear();
|
||||
killCount.clear();
|
||||
|
||||
@@ -58,8 +58,12 @@ public class ReactorActionManager extends AbstractPlayerInteraction {
|
||||
public void dropItems(boolean meso, int mesoChance, int minMeso, int maxMeso) {
|
||||
dropItems(meso, mesoChance, minMeso, maxMeso, 0);
|
||||
}
|
||||
|
||||
|
||||
public void dropItems(boolean meso, int mesoChance, int minMeso, int maxMeso, int minItems) {
|
||||
dropItems((int)reactor.getPosition().getX(), (int)reactor.getPosition().getY(), meso, mesoChance, minMeso, maxMeso, minItems);
|
||||
}
|
||||
|
||||
public void dropItems(int posX, int posY, boolean meso, int mesoChance, int minMeso, int maxMeso, int minItems) {
|
||||
List<ReactorDropEntry> chances = getDropChances();
|
||||
List<ReactorDropEntry> items = new LinkedList<>();
|
||||
int numItems = 0;
|
||||
@@ -79,8 +83,10 @@ public class ReactorActionManager extends AbstractPlayerInteraction {
|
||||
numItems++;
|
||||
}
|
||||
java.util.Collections.shuffle(items);
|
||||
final Point dropPos = reactor.getPosition();
|
||||
|
||||
final Point dropPos = new Point(posX, posY);
|
||||
dropPos.x -= (12 * numItems);
|
||||
|
||||
for (ReactorDropEntry d : items) {
|
||||
if (d.itemId == 0) {
|
||||
int range = maxMeso - minMeso;
|
||||
@@ -98,7 +104,6 @@ public class ReactorActionManager extends AbstractPlayerInteraction {
|
||||
reactor.getMap().spawnItemDrop(reactor, getPlayer(), drop, dropPos, false, false);
|
||||
}
|
||||
dropPos.x += 25;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -223,7 +223,15 @@ public class MapleMap {
|
||||
for (MapleMapObject o : mapobjects.values()) {
|
||||
if (o.getType() == MapleMapObjectType.REACTOR) {
|
||||
if (((MapleReactor) o).getState() < 1) {
|
||||
((MapleReactor) o).setState((byte) 1);
|
||||
MapleReactor mr = (MapleReactor) o;
|
||||
mr.lockReactor();
|
||||
try {
|
||||
mr.setState((byte) 1);
|
||||
mr.setShouldCollect(true);
|
||||
} finally {
|
||||
mr.unlockReactor();
|
||||
}
|
||||
|
||||
broadcastMessage(MaplePacketCreator.triggerReactor((MapleReactor) o, 1));
|
||||
}
|
||||
}
|
||||
@@ -511,6 +519,16 @@ public class MapleMap {
|
||||
return count;
|
||||
}
|
||||
|
||||
public List<Pair> reportReactorStates() {
|
||||
List<Pair> list = new LinkedList<>();
|
||||
|
||||
for (MapleMapObject m : getMapObjectsInRange(new Point(0, 0), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.REACTOR))) {
|
||||
MapleReactor mr = (MapleReactor) m;
|
||||
list.add(new Pair(mr.getId(), mr.getState()));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public int countAllMonsters() {
|
||||
return getMapObjectsInRange(new Point(0, 0), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.MONSTER)).size();
|
||||
}
|
||||
@@ -797,13 +815,6 @@ public class MapleMap {
|
||||
reactor.setAlive(false);
|
||||
removeMapObject(reactor);
|
||||
|
||||
reactor.lockReactor();
|
||||
try {
|
||||
reactor.setShouldCollect(true);
|
||||
} finally {
|
||||
reactor.unlockReactor();
|
||||
}
|
||||
|
||||
if (reactor.getDelay() > 0) {
|
||||
tMan.schedule(new Runnable() {
|
||||
@Override
|
||||
@@ -820,10 +831,10 @@ public class MapleMap {
|
||||
for (MapleMapObject o : mapobjects.values()) {
|
||||
if (o.getType() == MapleMapObjectType.REACTOR) {
|
||||
final MapleReactor r = ((MapleReactor) o);
|
||||
r.setState((byte) 0);
|
||||
|
||||
r.lockReactor();
|
||||
try {
|
||||
r.setState((byte) 0);
|
||||
r.setShouldCollect(true);
|
||||
} finally {
|
||||
r.unlockReactor();
|
||||
@@ -1213,8 +1224,15 @@ public class MapleMap {
|
||||
}
|
||||
|
||||
private void respawnReactor(final MapleReactor reactor) {
|
||||
reactor.setState((byte) 0);
|
||||
reactor.setAlive(true);
|
||||
reactor.lockReactor();
|
||||
try {
|
||||
reactor.setShouldCollect(true);
|
||||
reactor.setState((byte) 0);
|
||||
reactor.setAlive(true);
|
||||
} finally {
|
||||
reactor.unlockReactor();
|
||||
}
|
||||
|
||||
spawnReactor(reactor);
|
||||
}
|
||||
|
||||
@@ -1533,7 +1551,7 @@ public class MapleMap {
|
||||
|
||||
MapleStatEffect summonStat = chr.getStatForBuff(MapleBuffStat.SUMMON);
|
||||
if (summonStat != null) {
|
||||
MapleSummon summon = chr.getSummons().get(summonStat.getSourceId());
|
||||
MapleSummon summon = chr.getSummonByKey(summonStat.getSourceId());
|
||||
summon.setPosition(chr.getPosition());
|
||||
chr.getMap().spawnSummon(summon);
|
||||
updateMapObjectVisibility(chr, summon);
|
||||
@@ -1624,7 +1642,7 @@ public class MapleMap {
|
||||
}
|
||||
chr.leaveMap();
|
||||
chr.cancelMapTimeLimitTask();
|
||||
for (MapleSummon summon : chr.getSummons().values()) {
|
||||
for (MapleSummon summon : chr.getSummonsValues()) {
|
||||
if (summon.isStationary()) {
|
||||
chr.cancelBuffStats(MapleBuffStat.PUPPET);
|
||||
} else {
|
||||
@@ -1734,7 +1752,7 @@ public class MapleMap {
|
||||
if (o.getType() == MapleMapObjectType.SUMMON) {
|
||||
MapleSummon summon = (MapleSummon) o;
|
||||
if (summon.getOwner() == chr) {
|
||||
if (chr.getSummons().isEmpty() || !chr.getSummons().containsValue(summon)) {
|
||||
if (chr.isSummonsEmpty() || !chr.containsSummon(summon)) {
|
||||
objectWLock.lock();
|
||||
try {
|
||||
mapobjects.remove(o);
|
||||
@@ -2105,13 +2123,19 @@ public class MapleMap {
|
||||
reactor.setShouldCollect(false);
|
||||
MapleMap.this.broadcastMessage(MaplePacketCreator.removeItemFromMap(mapitem.getObjectId(), 0, 0), mapitem.getPosition());
|
||||
MapleMap.this.removeMapObject(mapitem);
|
||||
reactor.hitReactor(c, true);
|
||||
reactor.hitReactor(c);
|
||||
|
||||
if (reactor.getDelay() > 0) {
|
||||
tMan.schedule(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
reactor.setState((byte) 0);
|
||||
reactor.lockReactor();
|
||||
try {
|
||||
reactor.setState((byte) 0);
|
||||
reactor.setShouldCollect(true);
|
||||
} finally {
|
||||
reactor.unlockReactor();
|
||||
}
|
||||
broadcastMessage(MaplePacketCreator.triggerReactor(reactor, 0));
|
||||
}
|
||||
}, reactor.getDelay());
|
||||
@@ -2120,8 +2144,7 @@ public class MapleMap {
|
||||
mapitem.itemLock.unlock();
|
||||
}
|
||||
}
|
||||
}
|
||||
finally {
|
||||
} finally {
|
||||
reactor.unlockReactor();
|
||||
}
|
||||
}
|
||||
@@ -2560,12 +2583,12 @@ public class MapleMap {
|
||||
resetMapObjects();
|
||||
}
|
||||
|
||||
public void resetPQ(int difficulty) {
|
||||
resetMapObjects(difficulty, true);
|
||||
public void resetPQ() {
|
||||
resetPQ(1);
|
||||
}
|
||||
|
||||
public void resetPQ() {
|
||||
resetMapObjects(1, true);
|
||||
public void resetPQ(int difficulty) {
|
||||
resetMapObjects(difficulty, true);
|
||||
}
|
||||
|
||||
public void resetMapObjects(int difficulty, boolean isPq) {
|
||||
|
||||
@@ -255,6 +255,7 @@ public class MapleMapFactory {
|
||||
myReactor.setPosition(new Point(x, y));
|
||||
myReactor.setDelay(MapleDataTool.getInt(reactor.getChildByPath("reactorTime")) * 1000);
|
||||
myReactor.setState((byte) 0);
|
||||
myReactor.setShouldCollect(true);
|
||||
myReactor.setName(MapleDataTool.getString(reactor.getChildByPath("name"), ""));
|
||||
return myReactor;
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ import constants.ServerConstants;
|
||||
|
||||
import java.awt.Rectangle;
|
||||
import java.util.List;
|
||||
|
||||
import java.util.concurrent.locks.Lock;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
@@ -46,7 +47,7 @@ public class MapleReactor extends AbstractMapleMapObject {
|
||||
private MapleMap map;
|
||||
private String name;
|
||||
private boolean alive;
|
||||
private boolean shouldCollect = true;
|
||||
private boolean shouldCollect;
|
||||
private Lock reactorLock = new ReentrantLock(true);
|
||||
|
||||
public MapleReactor(MapleReactorStats stats, int rid) {
|
||||
@@ -143,14 +144,14 @@ public class MapleReactor extends AbstractMapleMapObject {
|
||||
}
|
||||
|
||||
public void forceHitReactor(final byte newState) {
|
||||
setState((byte) newState);
|
||||
this.lockReactor();
|
||||
try {
|
||||
this.lockReactor();
|
||||
setState((byte) newState);
|
||||
this.setShouldCollect(true);
|
||||
}
|
||||
finally {
|
||||
} finally {
|
||||
this.unlockReactor();
|
||||
}
|
||||
|
||||
map.broadcastMessage(MaplePacketCreator.triggerReactor(this, (short) 0));
|
||||
}
|
||||
|
||||
@@ -158,16 +159,16 @@ public class MapleReactor extends AbstractMapleMapObject {
|
||||
TimerManager.getInstance().schedule(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
hitReactor(c, false);
|
||||
hitReactor(c);
|
||||
}
|
||||
}, delay);
|
||||
}
|
||||
|
||||
public void hitReactor(MapleClient c, boolean itemDrop) {
|
||||
hitReactor(0, (short) 0, 0, c, itemDrop);
|
||||
public void hitReactor(MapleClient c) {
|
||||
hitReactor(0, (short) 0, 0, c);
|
||||
}
|
||||
|
||||
public synchronized void hitReactor(int charPos, short stance, int skillid, MapleClient c, boolean itemDrop) {
|
||||
public synchronized void hitReactor(int charPos, short stance, int skillid, MapleClient c) {
|
||||
try {
|
||||
if(!this.isAlive()) {
|
||||
return;
|
||||
@@ -196,11 +197,12 @@ public class MapleReactor extends AbstractMapleMapObject {
|
||||
|
||||
ReactorScriptManager.getInstance().act(c, this);
|
||||
} else { //reactor not broken yet
|
||||
if (itemDrop) state++; // Duh, if the reactor is triggered by itemdrop, go directly to next state (in this case, instead of staying at 1, it goes to 2)! :)
|
||||
map.broadcastMessage(MaplePacketCreator.triggerReactor(this, stance));
|
||||
if (state == stats.getNextState(state, b) || itemDrop) {//current state = next state, looping reactor
|
||||
if (state == stats.getNextState(state, b)) {//current state = next state, looping reactor
|
||||
ReactorScriptManager.getInstance().act(c, this);
|
||||
}
|
||||
|
||||
setShouldCollect(true); // refresh collectability on item drop-based reactors
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -209,6 +211,8 @@ public class MapleReactor extends AbstractMapleMapObject {
|
||||
state++;
|
||||
map.broadcastMessage(MaplePacketCreator.triggerReactor(this, stance));
|
||||
ReactorScriptManager.getInstance().act(c, this);
|
||||
setShouldCollect(true);
|
||||
System.out.println("ehh");
|
||||
}
|
||||
} catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
|
||||
Reference in New Issue
Block a user