Hit Reactor animation fix + deny spawn points
Fixed reactor sometimes not animating between state changes and introduced mechanic to deny spawning mobs at spawn points.
This commit is contained in:
@@ -152,3 +152,6 @@ Adi
|
|||||||
|
|
||||||
11 - 12 Abril 2017,
|
11 - 12 Abril 2017,
|
||||||
Implementação do PiratePQ.
|
Implementação do PiratePQ.
|
||||||
|
|
||||||
|
17 Abril 2017,
|
||||||
|
Correção de bugs envolvendo reactors no PiratePQ, e potencialmente em outros pontos também.
|
||||||
@@ -3,6 +3,21 @@
|
|||||||
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
|
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
|
||||||
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
|
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
|
||||||
<group>
|
<group>
|
||||||
|
<file>file:/C:/Nexon/MapleSolaxia/src/scripting/reactor/ReactorActionManager.java</file>
|
||||||
|
<file>file:/C:/Nexon/MapleSolaxia/scripts/reactor/2519003.js</file>
|
||||||
|
<file>file:/C:/Nexon/MapleSolaxia/src/tools/data/output/GenericLittleEndianWriter.java</file>
|
||||||
|
<file>file:/C:/Nexon/MapleSolaxia/scripts/reactor/2519002.js</file>
|
||||||
|
<file>file:/C:/Nexon/MapleSolaxia/scripts/reactor/2519001.js</file>
|
||||||
|
<file>file:/C:/Nexon/MapleSolaxia/src/server/maps/MapleMapFactory.java</file>
|
||||||
|
<file>file:/C:/Nexon/MapleSolaxia/src/client/command/Commands.java</file>
|
||||||
|
<file>file:/C:/Nexon/MapleSolaxia/src/client/MapleCharacter.java</file>
|
||||||
|
<file>file:/C:/Nexon/MapleSolaxia/src/tools/MaplePacketCreator.java</file>
|
||||||
|
<file>file:/C:/Nexon/MapleSolaxia/scripts/reactor/2519000.js</file>
|
||||||
|
<file>file:/C:/Nexon/MapleSolaxia/src/server/life/SpawnPoint.java</file>
|
||||||
|
<file>file:/C:/Nexon/MapleSolaxia/src/server/maps/MapleReactorStats.java</file>
|
||||||
|
<file>file:/C:/Nexon/MapleSolaxia/src/scripting/reactor/ReactorScriptManager.java</file>
|
||||||
|
<file>file:/C:/Nexon/MapleSolaxia/src/constants/ServerConstants.java</file>
|
||||||
|
<file>file:/C:/Nexon/MapleSolaxia/src/server/maps/MapleReactor.java</file>
|
||||||
<file>file:/C:/Nexon/MapleSolaxia/src/server/maps/MapleMap.java</file>
|
<file>file:/C:/Nexon/MapleSolaxia/src/server/maps/MapleMap.java</file>
|
||||||
</group>
|
</group>
|
||||||
</open-files>
|
</open-files>
|
||||||
|
|||||||
@@ -23,6 +23,13 @@
|
|||||||
*@author Ronan
|
*@author Ronan
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
importPackage(Packages.tools);
|
||||||
|
importPackage(java.awt);
|
||||||
|
|
||||||
function act() {
|
function act() {
|
||||||
rm.getPlayer().getMap().setAllowSpawnPointInRange(false, rm.getReactor().getPosition(), 120.0);
|
var denyWidth = 320, denyHeight = 150;
|
||||||
|
var denyPos = rm.getReactor().getPosition();
|
||||||
|
var denyArea = new Rectangle(denyPos.getX() - denyWidth / 2, denyPos.getY() - denyHeight / 2, denyWidth, denyHeight);
|
||||||
|
|
||||||
|
rm.getReactor().getMap().setAllowSpawnPointInBox(false, denyArea);
|
||||||
}
|
}
|
||||||
@@ -23,6 +23,13 @@
|
|||||||
*@author Ronan
|
*@author Ronan
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
importPackage(Packages.tools);
|
||||||
|
importPackage(java.awt);
|
||||||
|
|
||||||
function act() {
|
function act() {
|
||||||
rm.getPlayer().getMap().setAllowSpawnPointInRange(false, rm.getReactor().getPosition(), 120.0);
|
var denyWidth = 320, denyHeight = 150;
|
||||||
|
var denyPos = rm.getReactor().getPosition();
|
||||||
|
var denyArea = new Rectangle(denyPos.getX() - denyWidth / 2, denyPos.getY() - denyHeight / 2, denyWidth, denyHeight);
|
||||||
|
|
||||||
|
rm.getReactor().getMap().setAllowSpawnPointInBox(false, denyArea);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,13 @@
|
|||||||
*@author Ronan
|
*@author Ronan
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
importPackage(Packages.tools);
|
||||||
|
importPackage(java.awt);
|
||||||
|
|
||||||
function act() {
|
function act() {
|
||||||
rm.getPlayer().getMap().setAllowSpawnPointInRange(false, rm.getReactor().getPosition(), 120.0);
|
var denyWidth = 320, denyHeight = 150;
|
||||||
|
var denyPos = rm.getReactor().getPosition();
|
||||||
|
var denyArea = new Rectangle(denyPos.getX() - denyWidth / 2, denyPos.getY() - denyHeight / 2, denyWidth, denyHeight);
|
||||||
|
|
||||||
|
rm.getReactor().getMap().setAllowSpawnPointInBox(false, denyArea);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,13 @@
|
|||||||
*@author Ronan
|
*@author Ronan
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
importPackage(Packages.tools);
|
||||||
|
importPackage(java.awt);
|
||||||
|
|
||||||
function act() {
|
function act() {
|
||||||
rm.getPlayer().getMap().setAllowSpawnPointInRange(false, rm.getReactor().getPosition(), 120.0);
|
var denyWidth = 320, denyHeight = 150;
|
||||||
|
var denyPos = rm.getReactor().getPosition();
|
||||||
|
var denyArea = new Rectangle(denyPos.getX() - denyWidth / 2, denyPos.getY() - denyHeight / 2, denyWidth, denyHeight);
|
||||||
|
|
||||||
|
rm.getReactor().getMap().setAllowSpawnPointInBox(false, denyArea);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -636,6 +636,14 @@ public class Commands {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
//debug only
|
||||||
|
case "map":
|
||||||
|
if(ServerConstants.USE_DEBUG) {
|
||||||
|
player.dropMessage("Current map position: (" + player.getPosition().getX() + ", " + player.getPosition().getY() + ").");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if (player.gmLevel() == 0) {
|
if (player.gmLevel() == 0) {
|
||||||
player.yellowMessage("Player Command " + heading + sub[0] + " does not exist, see @help for a list of commands.");
|
player.yellowMessage("Player Command " + heading + sub[0] + " does not exist, see @help for a list of commands.");
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ public class ServerConstants {
|
|||||||
public static boolean JAVA_8;
|
public static boolean JAVA_8;
|
||||||
public static boolean SHUTDOWNHOOK;
|
public static boolean SHUTDOWNHOOK;
|
||||||
//Gameplay Configurations
|
//Gameplay Configurations
|
||||||
public static final boolean USE_MAXRANGE = true; //will send and receive packets from all events of a map.
|
public static final boolean USE_MAXRANGE = true; //will send and receive packets from all events of a map, rather than those of only view range.
|
||||||
public static final boolean USE_DEBUG = true;
|
public static final boolean USE_DEBUG = true;
|
||||||
public static final boolean USE_MTS = false;
|
public static final boolean USE_MTS = false;
|
||||||
public static final boolean USE_FAMILY_SYSTEM = false;
|
public static final boolean USE_FAMILY_SYSTEM = false;
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ public final class ReactorHitHandler extends AbstractMaplePacketHandler {
|
|||||||
int skillid = slea.readInt();
|
int skillid = slea.readInt();
|
||||||
MapleReactor reactor = c.getPlayer().getMap().getReactorByOid(oid);
|
MapleReactor reactor = c.getPlayer().getMap().getReactorByOid(oid);
|
||||||
if (reactor != null && reactor.isAlive()) {
|
if (reactor != null && reactor.isAlive()) {
|
||||||
reactor.hitReactor(charPos, stance, skillid,c);
|
reactor.hitReactor(charPos, stance, skillid, c, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ public class SpawnPoint {
|
|||||||
private long nextPossibleSpawn;
|
private long nextPossibleSpawn;
|
||||||
private int mobInterval = 5000;
|
private int mobInterval = 5000;
|
||||||
private AtomicInteger spawnedMonsters = new AtomicInteger(0);
|
private AtomicInteger spawnedMonsters = new AtomicInteger(0);
|
||||||
private boolean immobile;
|
private boolean immobile, denySpawn = false;
|
||||||
|
|
||||||
public SpawnPoint(final MapleMonster monster, Point pos, boolean immobile, int mobTime, int mobInterval, int team) {
|
public SpawnPoint(final MapleMonster monster, Point pos, boolean immobile, int mobTime, int mobInterval, int team) {
|
||||||
this.monster = monster.getId();
|
this.monster = monster.getId();
|
||||||
@@ -50,11 +50,15 @@ public class SpawnPoint {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setDenySpawn(boolean val) {
|
public void setDenySpawn(boolean val) {
|
||||||
spawnedMonsters.set((val == false) ? 0 : 1);
|
denySpawn = val;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getDenySpawn() {
|
||||||
|
return denySpawn;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean shouldSpawn() {
|
public boolean shouldSpawn() {
|
||||||
if (mobTime < 0 || spawnedMonsters.get() > 0) {
|
if (denySpawn || mobTime < 0 || spawnedMonsters.get() > 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -290,7 +290,7 @@ public class MapleMap {
|
|||||||
this.mapobjects.put(curOID, mapobject);
|
this.mapobjects.put(curOID, mapobject);
|
||||||
for (MapleCharacter chr : characters) {
|
for (MapleCharacter chr : characters) {
|
||||||
if (condition == null || condition.canSpawn(chr)) {
|
if (condition == null || condition.canSpawn(chr)) {
|
||||||
if (chr.getPosition().distanceSq(mapobject.getPosition()) <= 722500) {
|
if (chr.getPosition().distanceSq(mapobject.getPosition()) <= getRangedDistance()) {
|
||||||
packetbakery.sendPackets(chr.getClient());
|
packetbakery.sendPackets(chr.getClient());
|
||||||
chr.addVisibleMapObject(mapobject);
|
chr.addVisibleMapObject(mapobject);
|
||||||
}
|
}
|
||||||
@@ -310,7 +310,7 @@ public class MapleMap {
|
|||||||
mapobject.setObjectId(curOID);
|
mapobject.setObjectId(curOID);
|
||||||
for (MapleCharacter chr : characters) {
|
for (MapleCharacter chr : characters) {
|
||||||
if (condition == null || condition.canSpawn(chr)) {
|
if (condition == null || condition.canSpawn(chr)) {
|
||||||
if (chr.getPosition().distanceSq(mapobject.getPosition()) <= 722500) {
|
if (chr.getPosition().distanceSq(mapobject.getPosition()) <= getRangedDistance()) {
|
||||||
packetbakery.sendPackets(chr.getClient());
|
packetbakery.sendPackets(chr.getClient());
|
||||||
chr.addVisibleMapObject(mapobject);
|
chr.addVisibleMapObject(mapobject);
|
||||||
}
|
}
|
||||||
@@ -796,7 +796,14 @@ public class MapleMap {
|
|||||||
broadcastMessage(MaplePacketCreator.destroyReactor(reactor));
|
broadcastMessage(MaplePacketCreator.destroyReactor(reactor));
|
||||||
reactor.setAlive(false);
|
reactor.setAlive(false);
|
||||||
removeMapObject(reactor);
|
removeMapObject(reactor);
|
||||||
reactor.setTimerActive(false);
|
|
||||||
|
reactor.lockReactor();
|
||||||
|
try {
|
||||||
|
reactor.setShouldCollect(true);
|
||||||
|
} finally {
|
||||||
|
reactor.unlockReactor();
|
||||||
|
}
|
||||||
|
|
||||||
if (reactor.getDelay() > 0) {
|
if (reactor.getDelay() > 0) {
|
||||||
tMan.schedule(new Runnable() {
|
tMan.schedule(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
@@ -814,7 +821,14 @@ public class MapleMap {
|
|||||||
if (o.getType() == MapleMapObjectType.REACTOR) {
|
if (o.getType() == MapleMapObjectType.REACTOR) {
|
||||||
final MapleReactor r = ((MapleReactor) o);
|
final MapleReactor r = ((MapleReactor) o);
|
||||||
r.setState((byte) 0);
|
r.setState((byte) 0);
|
||||||
r.setTimerActive(false);
|
|
||||||
|
r.lockReactor();
|
||||||
|
try {
|
||||||
|
r.setShouldCollect(true);
|
||||||
|
} finally {
|
||||||
|
r.unlockReactor();
|
||||||
|
}
|
||||||
|
|
||||||
broadcastMessage(MaplePacketCreator.triggerReactor(r, 0));
|
broadcastMessage(MaplePacketCreator.triggerReactor(r, 0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1314,16 +1328,13 @@ public class MapleMap {
|
|||||||
if (react.getReactItem((byte) 0).getLeft() == item.getItemId() && react.getReactItem((byte) 0).getRight() == item.getQuantity()) {
|
if (react.getReactItem((byte) 0).getLeft() == item.getItemId() && react.getReactItem((byte) 0).getRight() == item.getQuantity()) {
|
||||||
|
|
||||||
if (react.getArea().contains(drop.getPosition())) {
|
if (react.getArea().contains(drop.getPosition())) {
|
||||||
if (!react.isTimerActive()) {
|
|
||||||
TimerManager.getInstance().schedule(new ActivateItemReactor(drop, react, c), 5000);
|
TimerManager.getInstance().schedule(new ActivateItemReactor(drop, react, c), 5000);
|
||||||
react.setTimerActive(true);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public final List<MapleMapObject> getAllReactor() {
|
public final List<MapleMapObject> getAllReactor() {
|
||||||
return getMapObjectsInRange(new Point(0, 0), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.REACTOR));
|
return getMapObjectsInRange(new Point(0, 0), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.REACTOR));
|
||||||
@@ -1658,7 +1669,7 @@ public class MapleMap {
|
|||||||
* @param ranged
|
* @param ranged
|
||||||
*/
|
*/
|
||||||
public void broadcastMessage(MapleCharacter source, final byte[] packet, boolean repeatToSource, boolean ranged) {
|
public void broadcastMessage(MapleCharacter source, final byte[] packet, boolean repeatToSource, boolean ranged) {
|
||||||
broadcastMessage(repeatToSource ? null : source, packet, ranged ? 722500 : Double.POSITIVE_INFINITY, source.getPosition());
|
broadcastMessage(repeatToSource ? null : source, packet, ranged ? getRangedDistance() : Double.POSITIVE_INFINITY, source.getPosition());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1878,11 +1889,11 @@ public class MapleMap {
|
|||||||
|
|
||||||
private void updateMapObjectVisibility(MapleCharacter chr, MapleMapObject mo) {
|
private void updateMapObjectVisibility(MapleCharacter chr, MapleMapObject mo) {
|
||||||
if (!chr.isMapObjectVisible(mo)) { // monster entered view range
|
if (!chr.isMapObjectVisible(mo)) { // monster entered view range
|
||||||
if (mo.getType() == MapleMapObjectType.SUMMON || mo.getPosition().distanceSq(chr.getPosition()) <= 722500) {
|
if (mo.getType() == MapleMapObjectType.SUMMON || mo.getPosition().distanceSq(chr.getPosition()) <= getRangedDistance()) {
|
||||||
chr.addVisibleMapObject(mo);
|
chr.addVisibleMapObject(mo);
|
||||||
mo.sendSpawnData(chr.getClient());
|
mo.sendSpawnData(chr.getClient());
|
||||||
}
|
}
|
||||||
} else if (mo.getType() != MapleMapObjectType.SUMMON && mo.getPosition().distanceSq(chr.getPosition()) > 722500) {
|
} else if (mo.getType() != MapleMapObjectType.SUMMON && mo.getPosition().distanceSq(chr.getPosition()) > getRangedDistance()) {
|
||||||
chr.removeVisibleMapObject(mo);
|
chr.removeVisibleMapObject(mo);
|
||||||
mo.sendDestroyData(chr.getClient());
|
mo.sendDestroyData(chr.getClient());
|
||||||
}
|
}
|
||||||
@@ -2081,17 +2092,21 @@ public class MapleMap {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (mapitem != null && mapitem == getMapObject(mapitem.getObjectId())) {
|
reactor.lockReactor();
|
||||||
|
try {
|
||||||
|
if (reactor.getShouldCollect() == true && mapitem != null && mapitem == getMapObject(mapitem.getObjectId())) {
|
||||||
mapitem.itemLock.lock();
|
mapitem.itemLock.lock();
|
||||||
try {
|
try {
|
||||||
TimerManager tMan = TimerManager.getInstance();
|
TimerManager tMan = TimerManager.getInstance();
|
||||||
if (mapitem.isPickedUp()) {
|
if (mapitem.isPickedUp()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
reactor.setShouldCollect(false);
|
||||||
MapleMap.this.broadcastMessage(MaplePacketCreator.removeItemFromMap(mapitem.getObjectId(), 0, 0), mapitem.getPosition());
|
MapleMap.this.broadcastMessage(MaplePacketCreator.removeItemFromMap(mapitem.getObjectId(), 0, 0), mapitem.getPosition());
|
||||||
MapleMap.this.removeMapObject(mapitem);
|
MapleMap.this.removeMapObject(mapitem);
|
||||||
reactor.hitReactor(c);
|
reactor.hitReactor(c, true);
|
||||||
reactor.setTimerActive(false);
|
|
||||||
if (reactor.getDelay() > 0) {
|
if (reactor.getDelay() > 0) {
|
||||||
tMan.schedule(new Runnable() {
|
tMan.schedule(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
@@ -2106,6 +2121,10 @@ public class MapleMap {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
finally {
|
||||||
|
reactor.unlockReactor();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void instanceMapFirstSpawn(int difficulty, boolean isPq) {
|
public void instanceMapFirstSpawn(int difficulty, boolean isPq) {
|
||||||
@@ -2168,6 +2187,15 @@ public class MapleMap {
|
|||||||
chrRLock.unlock();
|
chrRLock.unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
System.out.println("----------------------------------");
|
||||||
|
for (SpawnPoint spawnPoint : monsterSpawn) {
|
||||||
|
System.out.println("sp " + spawnPoint.getPosition().getX() + ", " + spawnPoint.getPosition().getY() + ": " + spawnPoint.getDenySpawn());
|
||||||
|
}
|
||||||
|
System.out.println("try " + monsterSpawn.size() + " - " + spawnedMonstersOnMap.get());
|
||||||
|
System.out.println("----------------------------------");
|
||||||
|
*/
|
||||||
|
|
||||||
short numShouldSpawn = (short) ((monsterSpawn.size() - spawnedMonstersOnMap.get()));//Fking lol'd
|
short numShouldSpawn = (short) ((monsterSpawn.size() - spawnedMonstersOnMap.get()));//Fking lol'd
|
||||||
if (numShouldSpawn > 0) {
|
if (numShouldSpawn > 0) {
|
||||||
List<SpawnPoint> randomSpawn = new ArrayList<>(monsterSpawn);
|
List<SpawnPoint> randomSpawn = new ArrayList<>(monsterSpawn);
|
||||||
|
|||||||
@@ -26,6 +26,8 @@ import constants.ServerConstants;
|
|||||||
|
|
||||||
import java.awt.Rectangle;
|
import java.awt.Rectangle;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.concurrent.locks.Lock;
|
||||||
|
import java.util.concurrent.locks.ReentrantLock;
|
||||||
|
|
||||||
import scripting.reactor.ReactorScriptManager;
|
import scripting.reactor.ReactorScriptManager;
|
||||||
import server.TimerManager;
|
import server.TimerManager;
|
||||||
@@ -43,8 +45,9 @@ public class MapleReactor extends AbstractMapleMapObject {
|
|||||||
private int delay;
|
private int delay;
|
||||||
private MapleMap map;
|
private MapleMap map;
|
||||||
private String name;
|
private String name;
|
||||||
private boolean timerActive;
|
|
||||||
private boolean alive;
|
private boolean alive;
|
||||||
|
private boolean shouldCollect = true;
|
||||||
|
private Lock reactorLock = new ReentrantLock(true);
|
||||||
|
|
||||||
public MapleReactor(MapleReactorStats stats, int rid) {
|
public MapleReactor(MapleReactorStats stats, int rid) {
|
||||||
this.stats = stats;
|
this.stats = stats;
|
||||||
@@ -52,12 +55,20 @@ public class MapleReactor extends AbstractMapleMapObject {
|
|||||||
alive = true;
|
alive = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTimerActive(boolean active) {
|
public void setShouldCollect(boolean collect) {
|
||||||
this.timerActive = active;
|
this.shouldCollect = collect;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isTimerActive() {
|
public boolean getShouldCollect() {
|
||||||
return timerActive;
|
return shouldCollect;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void lockReactor() {
|
||||||
|
reactorLock.lock();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void unlockReactor() {
|
||||||
|
reactorLock.unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setState(byte state) {
|
public void setState(byte state) {
|
||||||
@@ -68,6 +79,10 @@ public class MapleReactor extends AbstractMapleMapObject {
|
|||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public MapleReactorStats getStats() {
|
||||||
|
return stats;
|
||||||
|
}
|
||||||
|
|
||||||
public int getId() {
|
public int getId() {
|
||||||
return rid;
|
return rid;
|
||||||
}
|
}
|
||||||
@@ -129,7 +144,13 @@ public class MapleReactor extends AbstractMapleMapObject {
|
|||||||
|
|
||||||
public void forceHitReactor(final byte newState) {
|
public void forceHitReactor(final byte newState) {
|
||||||
setState((byte) newState);
|
setState((byte) newState);
|
||||||
setTimerActive(false);
|
try {
|
||||||
|
this.lockReactor();
|
||||||
|
this.setShouldCollect(true);
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
this.unlockReactor();
|
||||||
|
}
|
||||||
map.broadcastMessage(MaplePacketCreator.triggerReactor(this, (short) 0));
|
map.broadcastMessage(MaplePacketCreator.triggerReactor(this, (short) 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -137,23 +158,25 @@ public class MapleReactor extends AbstractMapleMapObject {
|
|||||||
TimerManager.getInstance().schedule(new Runnable() {
|
TimerManager.getInstance().schedule(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
hitReactor(c);
|
hitReactor(c, false);
|
||||||
}
|
}
|
||||||
}, delay);
|
}, delay);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void hitReactor(MapleClient c) {
|
public void hitReactor(MapleClient c, boolean itemDrop) {
|
||||||
hitReactor(0, (short) 0, 0, c);
|
hitReactor(0, (short) 0, 0, c, itemDrop);
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized void hitReactor(int charPos, short stance, int skillid, MapleClient c) {
|
public synchronized void hitReactor(int charPos, short stance, int skillid, MapleClient c, boolean itemDrop) {
|
||||||
try {
|
try {
|
||||||
if(!this.isAlive()) {
|
if(!this.isAlive()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(ServerConstants.USE_DEBUG == true) c.getPlayer().dropMessage(5, "Hitted REACTOR " + this.getId() + " with POS " + charPos + " , STANCE " + stance + " , SkillID " + skillid);
|
if(ServerConstants.USE_DEBUG == true) c.getPlayer().dropMessage(5, "Hitted REACTOR " + this.getId() + " with POS " + charPos + " , STANCE " + stance + " , SkillID " + skillid + " , STATE " + stats.getType(state) + " STATESIZE " + stats.getStateSize(state));
|
||||||
if (stats.getType(state) < 999 && stats.getType(state) != -1) {//type 2 = only hit from right (kerning swamp plants), 00 is air left 02 is ground left
|
int reactorType = stats.getType(state);
|
||||||
if (!(stats.getType(state) == 2 && (stance == 0 || stance == 2))) { //get next state
|
|
||||||
|
if (reactorType < 999 && reactorType != -1) {//type 2 = only hit from right (kerning swamp plants), 00 is air left 02 is ground left
|
||||||
|
if (!(reactorType == 2 && (stance == 0 || stance == 2))) { //get next state
|
||||||
for (byte b = 0; b < stats.getStateSize(state); b++) {//YAY?
|
for (byte b = 0; b < stats.getStateSize(state); b++) {//YAY?
|
||||||
List<Integer> activeSkills = stats.getActiveSkills(state, b);
|
List<Integer> activeSkills = stats.getActiveSkills(state, b);
|
||||||
if (activeSkills != null) {
|
if (activeSkills != null) {
|
||||||
@@ -161,7 +184,7 @@ public class MapleReactor extends AbstractMapleMapObject {
|
|||||||
}
|
}
|
||||||
state = stats.getNextState(state, b);
|
state = stats.getNextState(state, b);
|
||||||
if (stats.getNextState(state, b) == -1) {//end of reactor
|
if (stats.getNextState(state, b) == -1) {//end of reactor
|
||||||
if (stats.getType(state) < 100) {//reactor broken
|
if (reactorType < 100) {//reactor broken
|
||||||
if (delay > 0) {
|
if (delay > 0) {
|
||||||
map.destroyReactor(getObjectId());
|
map.destroyReactor(getObjectId());
|
||||||
} else {//trigger as normal
|
} else {//trigger as normal
|
||||||
@@ -171,11 +194,11 @@ public class MapleReactor extends AbstractMapleMapObject {
|
|||||||
map.broadcastMessage(MaplePacketCreator.triggerReactor(this, stance));
|
map.broadcastMessage(MaplePacketCreator.triggerReactor(this, stance));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(ServerConstants.USE_DEBUG == true) c.getPlayer().dropMessage(5, "REACTOR " + this.getId() + " activated");
|
|
||||||
ReactorScriptManager.getInstance().act(c, this);
|
ReactorScriptManager.getInstance().act(c, this);
|
||||||
} else { //reactor not broken yet
|
} 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));
|
map.broadcastMessage(MaplePacketCreator.triggerReactor(this, stance));
|
||||||
if (state == stats.getNextState(state, b)) {//current state = next state, looping reactor
|
if (state == stats.getNextState(state, b) || itemDrop) {//current state = next state, looping reactor
|
||||||
ReactorScriptManager.getInstance().act(c, this);
|
ReactorScriptManager.getInstance().act(c, this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,8 +67,8 @@
|
|||||||
</imgdir>
|
</imgdir>
|
||||||
</imgdir>
|
</imgdir>
|
||||||
<imgdir name="1">
|
<imgdir name="1">
|
||||||
<canvas name="0" width="1" height="1">
|
<canvas name="0" width="100" height="121">
|
||||||
<vector name="origin" x="0" y="0"/>
|
<vector name="origin" x="49" y="121"/>
|
||||||
</canvas>
|
</canvas>
|
||||||
</imgdir>
|
</imgdir>
|
||||||
<string name="action" value="davyScript0"/>
|
<string name="action" value="davyScript0"/>
|
||||||
|
|||||||
@@ -67,8 +67,8 @@
|
|||||||
</imgdir>
|
</imgdir>
|
||||||
</imgdir>
|
</imgdir>
|
||||||
<imgdir name="1">
|
<imgdir name="1">
|
||||||
<canvas name="0" width="1" height="1">
|
<canvas name="0" width="92" height="124">
|
||||||
<vector name="origin" x="0" y="0"/>
|
<vector name="origin" x="47" y="124"/>
|
||||||
</canvas>
|
</canvas>
|
||||||
</imgdir>
|
</imgdir>
|
||||||
<string name="action" value="davyScript1"/>
|
<string name="action" value="davyScript1"/>
|
||||||
|
|||||||
@@ -2,7 +2,74 @@
|
|||||||
<imgdir name="2519002.img">
|
<imgdir name="2519002.img">
|
||||||
<imgdir name="info">
|
<imgdir name="info">
|
||||||
<string name="info" value="해적선 문"/>
|
<string name="info" value="해적선 문"/>
|
||||||
<string name="link" value="2519000"/>
|
|
||||||
</imgdir>
|
</imgdir>
|
||||||
<string name="action" value="davyScript2"/>
|
<string name="action" value="davyScript2"/>
|
||||||
|
<imgdir name="0">
|
||||||
|
<canvas name="0" width="100" height="121">
|
||||||
|
<vector name="origin" x="49" y="121"/>
|
||||||
|
<int name="z" value="0"/>
|
||||||
|
</canvas>
|
||||||
|
<imgdir name="event">
|
||||||
|
<imgdir name="0">
|
||||||
|
<int name="type" value="100"/>
|
||||||
|
<int name="state" value="1"/>
|
||||||
|
<string name="0" value="4001117"/>
|
||||||
|
<int name="1" value="1"/>
|
||||||
|
<vector name="lt" x="-27" y="-21"/>
|
||||||
|
<vector name="rb" x="31" y="7"/>
|
||||||
|
</imgdir>
|
||||||
|
</imgdir>
|
||||||
|
<imgdir name="hit">
|
||||||
|
<canvas name="0" width="100" height="121">
|
||||||
|
<vector name="origin" x="49" y="121"/>
|
||||||
|
<int name="z" value="0"/>
|
||||||
|
<int name="delay" value="130"/>
|
||||||
|
</canvas>
|
||||||
|
<canvas name="1" width="100" height="121">
|
||||||
|
<vector name="origin" x="49" y="121"/>
|
||||||
|
<int name="z" value="0"/>
|
||||||
|
<int name="delay" value="130"/>
|
||||||
|
</canvas>
|
||||||
|
<canvas name="2" width="100" height="121">
|
||||||
|
<vector name="origin" x="49" y="121"/>
|
||||||
|
<int name="z" value="0"/>
|
||||||
|
<int name="delay" value="130"/>
|
||||||
|
</canvas>
|
||||||
|
<canvas name="3" width="100" height="121">
|
||||||
|
<vector name="origin" x="49" y="121"/>
|
||||||
|
<int name="z" value="0"/>
|
||||||
|
<int name="delay" value="130"/>
|
||||||
|
</canvas>
|
||||||
|
<canvas name="4" width="100" height="121">
|
||||||
|
<vector name="origin" x="49" y="121"/>
|
||||||
|
<int name="z" value="0"/>
|
||||||
|
<int name="delay" value="130"/>
|
||||||
|
</canvas>
|
||||||
|
<canvas name="5" width="100" height="121">
|
||||||
|
<vector name="origin" x="49" y="121"/>
|
||||||
|
<int name="z" value="0"/>
|
||||||
|
<int name="delay" value="130"/>
|
||||||
|
</canvas>
|
||||||
|
<canvas name="6" width="100" height="121">
|
||||||
|
<vector name="origin" x="49" y="121"/>
|
||||||
|
<int name="z" value="0"/>
|
||||||
|
<int name="delay" value="130"/>
|
||||||
|
</canvas>
|
||||||
|
<canvas name="7" width="100" height="121">
|
||||||
|
<vector name="origin" x="49" y="121"/>
|
||||||
|
<int name="z" value="0"/>
|
||||||
|
<int name="delay" value="130"/>
|
||||||
|
</canvas>
|
||||||
|
<canvas name="8" width="100" height="121">
|
||||||
|
<vector name="origin" x="49" y="121"/>
|
||||||
|
<int name="z" value="0"/>
|
||||||
|
<int name="delay" value="130"/>
|
||||||
|
</canvas>
|
||||||
|
</imgdir>
|
||||||
|
</imgdir>
|
||||||
|
<imgdir name="1">
|
||||||
|
<canvas name="0" width="100" height="121">
|
||||||
|
<vector name="origin" x="49" y="121"/>
|
||||||
|
</canvas>
|
||||||
|
</imgdir>
|
||||||
</imgdir>
|
</imgdir>
|
||||||
|
|||||||
@@ -2,7 +2,74 @@
|
|||||||
<imgdir name="2519003.img">
|
<imgdir name="2519003.img">
|
||||||
<imgdir name="info">
|
<imgdir name="info">
|
||||||
<string name="info" value="해적선 문"/>
|
<string name="info" value="해적선 문"/>
|
||||||
<string name="link" value="2519001"/>
|
|
||||||
</imgdir>
|
</imgdir>
|
||||||
<string name="action" value="davyScript3"/>
|
<string name="action" value="davyScript3"/>
|
||||||
|
<imgdir name="0">
|
||||||
|
<canvas name="0" width="92" height="124">
|
||||||
|
<vector name="origin" x="47" y="124"/>
|
||||||
|
<int name="z" value="0"/>
|
||||||
|
</canvas>
|
||||||
|
<imgdir name="event">
|
||||||
|
<imgdir name="0">
|
||||||
|
<int name="type" value="100"/>
|
||||||
|
<int name="state" value="1"/>
|
||||||
|
<string name="0" value="4001117"/>
|
||||||
|
<int name="1" value="1"/>
|
||||||
|
<vector name="lt" x="-27" y="-21"/>
|
||||||
|
<vector name="rb" x="31" y="7"/>
|
||||||
|
</imgdir>
|
||||||
|
</imgdir>
|
||||||
|
<imgdir name="hit">
|
||||||
|
<canvas name="0" width="92" height="124">
|
||||||
|
<vector name="origin" x="47" y="124"/>
|
||||||
|
<int name="z" value="0"/>
|
||||||
|
<int name="delay" value="100"/>
|
||||||
|
</canvas>
|
||||||
|
<canvas name="1" width="92" height="124">
|
||||||
|
<vector name="origin" x="47" y="124"/>
|
||||||
|
<int name="z" value="0"/>
|
||||||
|
<int name="delay" value="100"/>
|
||||||
|
</canvas>
|
||||||
|
<canvas name="2" width="92" height="124">
|
||||||
|
<vector name="origin" x="47" y="124"/>
|
||||||
|
<int name="z" value="0"/>
|
||||||
|
<int name="delay" value="100"/>
|
||||||
|
</canvas>
|
||||||
|
<canvas name="3" width="92" height="124">
|
||||||
|
<vector name="origin" x="47" y="124"/>
|
||||||
|
<int name="z" value="0"/>
|
||||||
|
<int name="delay" value="100"/>
|
||||||
|
</canvas>
|
||||||
|
<canvas name="4" width="92" height="124">
|
||||||
|
<vector name="origin" x="47" y="124"/>
|
||||||
|
<int name="z" value="0"/>
|
||||||
|
<int name="delay" value="100"/>
|
||||||
|
</canvas>
|
||||||
|
<canvas name="5" width="92" height="124">
|
||||||
|
<vector name="origin" x="47" y="124"/>
|
||||||
|
<int name="z" value="0"/>
|
||||||
|
<int name="delay" value="100"/>
|
||||||
|
</canvas>
|
||||||
|
<canvas name="6" width="92" height="124">
|
||||||
|
<vector name="origin" x="47" y="124"/>
|
||||||
|
<int name="z" value="0"/>
|
||||||
|
<int name="delay" value="100"/>
|
||||||
|
</canvas>
|
||||||
|
<canvas name="7" width="92" height="124">
|
||||||
|
<vector name="origin" x="47" y="124"/>
|
||||||
|
<int name="z" value="0"/>
|
||||||
|
<int name="delay" value="100"/>
|
||||||
|
</canvas>
|
||||||
|
<canvas name="8" width="92" height="124">
|
||||||
|
<vector name="origin" x="47" y="124"/>
|
||||||
|
<int name="z" value="0"/>
|
||||||
|
<int name="delay" value="100"/>
|
||||||
|
</canvas>
|
||||||
|
</imgdir>
|
||||||
|
</imgdir>
|
||||||
|
<imgdir name="1">
|
||||||
|
<canvas name="0" width="92" height="124">
|
||||||
|
<vector name="origin" x="47" y="124"/>
|
||||||
|
</canvas>
|
||||||
|
</imgdir>
|
||||||
</imgdir>
|
</imgdir>
|
||||||
|
|||||||
Reference in New Issue
Block a user