New PQ: Boss Rush PQ + Ellin/PiratePQ bug fixes
Introducing Boss Rush PQ. Corrected a few issues regarding rewardings in PiratePQ and EllinPQ and implemented a standardized way to script PQs.
This commit is contained in:
@@ -48,8 +48,6 @@ 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;
|
||||
@@ -272,13 +270,14 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
|
||||
private PartyQuest partyQuest = null;
|
||||
private boolean loggedIn = false;
|
||||
private MapleDragon dragon = null;
|
||||
private boolean useCS = false; //chaos scroll upon crafting item.
|
||||
private boolean useCS; //chaos scroll upon crafting item.
|
||||
private long useDuey;
|
||||
private long petLootCd;
|
||||
private int newWarpMap = -1;
|
||||
private Lock sLock = new ReentrantLock(true);
|
||||
|
||||
private MapleCharacter() {
|
||||
useCS = false;
|
||||
|
||||
setStance(0);
|
||||
inventory = new MapleInventory[MapleInventoryType.values().length];
|
||||
savedLocations = new SavedLocation[SavedLocationType.values().length];
|
||||
@@ -553,14 +552,9 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
|
||||
|
||||
return MaxMP;
|
||||
}
|
||||
|
||||
|
||||
public void addSummon(int id, MapleSummon summon) {
|
||||
sLock.lock();
|
||||
try {
|
||||
summons.put(id, summon);
|
||||
} finally {
|
||||
sLock.unlock();
|
||||
}
|
||||
summons.put(id, summon);
|
||||
}
|
||||
|
||||
public void addVisibleMapObject(MapleMapObject mo) {
|
||||
@@ -1091,16 +1085,22 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
|
||||
return target;
|
||||
}
|
||||
|
||||
// for use ONLY inside OnUserEnter map scripts that requires players changing map even before entering it.
|
||||
// for use ONLY inside OnUserEnter map scripts that requires a player to change map while still moving between maps.
|
||||
public void warpAhead(int map) {
|
||||
newWarpMap = map;
|
||||
}
|
||||
|
||||
private void eventChangedMap(int map) {
|
||||
if (getEventInstance() != null) getEventInstance().changedMap(MapleCharacter.this, map);
|
||||
}
|
||||
|
||||
public void changeMap(int map) {
|
||||
changeMap(map, 0);
|
||||
}
|
||||
|
||||
public void changeMap(int map, int portal) {
|
||||
eventChangedMap(map);
|
||||
|
||||
MapleMap warpMap;
|
||||
if (getEventInstance() != null) {
|
||||
warpMap = getEventInstance().getMapInstance(map);
|
||||
@@ -1112,6 +1112,8 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
|
||||
}
|
||||
|
||||
public void changeMap(int map, String portal) {
|
||||
eventChangedMap(map);
|
||||
|
||||
MapleMap warpMap;
|
||||
if (getEventInstance() != null) {
|
||||
warpMap = getEventInstance().getMapInstance(map);
|
||||
@@ -1123,6 +1125,8 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
|
||||
}
|
||||
|
||||
public void changeMap(int map, MaplePortal portal) {
|
||||
eventChangedMap(map);
|
||||
|
||||
MapleMap warpMap;
|
||||
if (getEventInstance() != null) {
|
||||
warpMap = getEventInstance().getMapInstance(map);
|
||||
@@ -1369,27 +1373,22 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
|
||||
} else if (stat == MapleBuffStat.SUMMON || stat == MapleBuffStat.PUPPET) {
|
||||
int summonId = mbsvh.effect.getSourceId();
|
||||
|
||||
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);
|
||||
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;
|
||||
}
|
||||
if (summon.getSkill() == DarkKnight.BEHOLDER) {
|
||||
if (beholderHealingSchedule != null) {
|
||||
beholderHealingSchedule.cancel(false);
|
||||
beholderHealingSchedule = null;
|
||||
}
|
||||
if (beholderBuffSchedule != null) {
|
||||
beholderBuffSchedule.cancel(false);
|
||||
beholderBuffSchedule = null;
|
||||
}
|
||||
if (beholderBuffSchedule != null) {
|
||||
beholderBuffSchedule.cancel(false);
|
||||
beholderBuffSchedule = null;
|
||||
}
|
||||
} finally {
|
||||
sLock.unlock();
|
||||
}
|
||||
} else if (stat == MapleBuffStat.DRAGONBLOOD) {
|
||||
dragonBloodSchedule.cancel(false);
|
||||
@@ -2530,48 +2529,23 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
|
||||
}
|
||||
|
||||
public Collection<MapleSummon> getSummonsValues() {
|
||||
sLock.lock();
|
||||
try {
|
||||
return summons.values();
|
||||
} finally {
|
||||
sLock.unlock();
|
||||
}
|
||||
return summons.values();
|
||||
}
|
||||
|
||||
public void clearSummons() {
|
||||
sLock.lock();
|
||||
try {
|
||||
summons.clear();
|
||||
} finally {
|
||||
sLock.unlock();
|
||||
}
|
||||
summons.clear();
|
||||
}
|
||||
|
||||
public MapleSummon getSummonByKey(int id) {
|
||||
sLock.lock();
|
||||
try {
|
||||
return summons.get(id);
|
||||
} finally {
|
||||
sLock.unlock();
|
||||
}
|
||||
return summons.get(id);
|
||||
}
|
||||
|
||||
public boolean isSummonsEmpty() {
|
||||
sLock.lock();
|
||||
try {
|
||||
return summons.isEmpty();
|
||||
} finally {
|
||||
sLock.unlock();
|
||||
}
|
||||
return summons.isEmpty();
|
||||
}
|
||||
|
||||
public boolean containsSummon(MapleSummon summon) {
|
||||
sLock.lock();
|
||||
try {
|
||||
return summons.containsValue(summon);
|
||||
} finally {
|
||||
sLock.unlock();
|
||||
}
|
||||
return summons.containsValue(summon);
|
||||
}
|
||||
|
||||
public int getTotalStr() {
|
||||
|
||||
@@ -333,6 +333,12 @@ public class Commands {
|
||||
player.message("@whodrops <item name>: Displays monsters that drop an item given an item name.");
|
||||
player.message("@uptime: Shows how long Solaxia has been online.");
|
||||
player.message("@bosshp: Displays the remaining HP of the bosses on your map.");
|
||||
if(ServerConstants.USE_DEBUG) {
|
||||
player.message("@debugpos: Displays the coordinates on the map the player is currently located.");
|
||||
player.message("@debugmapcount: Displays the current number of registered players in the map the player is located.");
|
||||
player.message("@debugevent: Displays the name of the event in which the player is currently registered.");
|
||||
player.message("@debugreactors: Displays current info for all reactors on the map the the player is currently located.");
|
||||
}
|
||||
break;
|
||||
case "time":
|
||||
DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss");
|
||||
@@ -652,7 +658,7 @@ public class Commands {
|
||||
|
||||
case "debugevent":
|
||||
if(ServerConstants.USE_DEBUG) {
|
||||
if(player.getEventInstance() == null) player.dropMessage("Player currently not in a event.");
|
||||
if(player.getEventInstance() == null) player.dropMessage("Player currently not in an event.");
|
||||
else player.dropMessage("Current event name: " + player.getEventInstance().getName() + ".");
|
||||
}
|
||||
break;
|
||||
@@ -700,18 +706,18 @@ public class Commands {
|
||||
}
|
||||
if (sub.length > 2) {
|
||||
for (int i = 0; i < Integer.parseInt(sub[2]); i++) {
|
||||
player.getMap().spawnMonsterOnGroudBelow(MapleLifeFactory.getMonster(Integer.parseInt(sub[1])), player.getPosition());
|
||||
player.getMap().spawnMonsterOnGroundBelow(MapleLifeFactory.getMonster(Integer.parseInt(sub[1])), player.getPosition());
|
||||
}
|
||||
} else {
|
||||
player.getMap().spawnMonsterOnGroudBelow(MapleLifeFactory.getMonster(Integer.parseInt(sub[1])), player.getPosition());
|
||||
player.getMap().spawnMonsterOnGroundBelow(MapleLifeFactory.getMonster(Integer.parseInt(sub[1])), player.getPosition());
|
||||
}
|
||||
} else if (sub[0].equals("bomb")) {
|
||||
if (sub.length > 1){
|
||||
MapleCharacter victim = c.getWorldServer().getPlayerStorage().getCharacterByName(sub[1]);
|
||||
victim.getMap().spawnMonsterOnGroudBelow(MapleLifeFactory.getMonster(9300166), victim.getPosition());
|
||||
victim.getMap().spawnMonsterOnGroundBelow(MapleLifeFactory.getMonster(9300166), victim.getPosition());
|
||||
Server.getInstance().broadcastGMMessage(MaplePacketCreator.serverNotice(5, player.getName() + " used !bomb on " + victim.getName()));
|
||||
} else {
|
||||
player.getMap().spawnMonsterOnGroudBelow(MapleLifeFactory.getMonster(9300166), player.getPosition());
|
||||
player.getMap().spawnMonsterOnGroundBelow(MapleLifeFactory.getMonster(9300166), player.getPosition());
|
||||
}
|
||||
} else if (sub[0].equals("mutemap")) {
|
||||
if(player.getMap().isMuted()) {
|
||||
@@ -1189,9 +1195,9 @@ public class Commands {
|
||||
}
|
||||
player.dropMessage("There are a total of " + total + " players online.");
|
||||
} else if (sub[0].equals("pap")) {
|
||||
player.getMap().spawnMonsterOnGroudBelow(MapleLifeFactory.getMonster(8500001), player.getPosition());
|
||||
player.getMap().spawnMonsterOnGroundBelow(MapleLifeFactory.getMonster(8500001), player.getPosition());
|
||||
} else if (sub[0].equals("pianus")) {
|
||||
player.getMap().spawnMonsterOnGroudBelow(MapleLifeFactory.getMonster(8510000), player.getPosition());
|
||||
player.getMap().spawnMonsterOnGroundBelow(MapleLifeFactory.getMonster(8510000), player.getPosition());
|
||||
} else if (sub[0].equalsIgnoreCase("search")) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (sub.length > 2) {
|
||||
@@ -1338,7 +1344,7 @@ public class Commands {
|
||||
}
|
||||
break;
|
||||
case "horntail":
|
||||
player.getMap().spawnMonsterOnGroudBelow(MapleLifeFactory.getMonster(8810026), player.getPosition());
|
||||
player.getMap().spawnMonsterOnGroundBelow(MapleLifeFactory.getMonster(8810026), player.getPosition());
|
||||
break;
|
||||
case "packet":
|
||||
player.getMap().broadcastMessage(MaplePacketCreator.customPacket(joinStringFrom(sub, 1)));
|
||||
@@ -1490,7 +1496,7 @@ public class Commands {
|
||||
case "zakum":
|
||||
player.getMap().spawnFakeMonsterOnGroundBelow(MapleLifeFactory.getMonster(8800000), player.getPosition());
|
||||
for (int x = 8800003; x < 8800011; x++) {
|
||||
player.getMap().spawnMonsterOnGroudBelow(MapleLifeFactory.getMonster(x), player.getPosition());
|
||||
player.getMap().spawnMonsterOnGroundBelow(MapleLifeFactory.getMonster(x), player.getPosition());
|
||||
}
|
||||
break;
|
||||
case "clearquestcache":
|
||||
|
||||
@@ -9,11 +9,11 @@ public class ServerConstants {
|
||||
public static String[] WORLD_NAMES = {"Scania", "Bera", "Broa", "Windia", "Khaini", "Bellocan", "Mardia", "Kradia", "Yellonde", "Demethos", "Galicia", "El Nido", "Zenith", "Arcenia", "Kastia", "Judis", "Plana", "Kalluna", "Stius", "Croa", "Medere"};
|
||||
|
||||
// Login Configuration
|
||||
public static final int CHANNEL_LOAD = 100;//Players per channel
|
||||
public static final long RANKING_INTERVAL = 60 * 60 * 1000;//60 minutes, 3600000
|
||||
public static final int CHANNEL_LOAD = 100; //Players per channel
|
||||
public static final long RANKING_INTERVAL = 60 * 60 * 1000; //60 minutes, 3600000
|
||||
public static final boolean ENABLE_PIC = false;
|
||||
//Event Configuration
|
||||
public static final boolean PERFECT_PITCH = true; //for lvl 30 or above, each lvlup player gains 1 perfect pitch.
|
||||
public static final boolean PERFECT_PITCH = true; //for lvl 30 or above, each lvlup player gains 1 perfect pitch.
|
||||
// IP Configuration
|
||||
public static String HOST;
|
||||
//Database Configuration
|
||||
@@ -25,7 +25,7 @@ public class ServerConstants {
|
||||
public static boolean SHUTDOWNHOOK;
|
||||
//Gameplay Configurations
|
||||
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; //will enable some text prints and new commands in the client oriented for debugging.
|
||||
public static final boolean USE_MTS = false;
|
||||
public static final boolean USE_FAMILY_SYSTEM = false;
|
||||
public static final boolean USE_DUEY = true;
|
||||
@@ -57,7 +57,7 @@ public class ServerConstants {
|
||||
public static final double PET_AUTOHP_RATIO = 0.99; //will automatically consume potions until given ratio of the MaxHP/MaxMP is reached.
|
||||
public static final double PET_AUTOMP_RATIO = 0.99;
|
||||
|
||||
//Should bosses use 1HP,1MP attacks in dojo?
|
||||
//Should bosses really use 1HP,1MP attacks in dojo?
|
||||
public static final boolean USE_DEADLY_DOJO = false;
|
||||
|
||||
//Rates
|
||||
|
||||
@@ -56,7 +56,7 @@ public final class AdminCommandHandler extends AbstractMaplePacketHandler {
|
||||
for (int z = 0; z < toSpawn.length; z++) {
|
||||
int[] toSpawnChild = toSpawn[z];
|
||||
if (Randomizer.nextInt(101) <= toSpawnChild[1]) {
|
||||
c.getPlayer().getMap().spawnMonsterOnGroudBelow(MapleLifeFactory.getMonster(toSpawnChild[0]), c.getPlayer().getPosition());
|
||||
c.getPlayer().getMap().spawnMonsterOnGroundBelow(MapleLifeFactory.getMonster(toSpawnChild[0]), c.getPlayer().getPosition());
|
||||
}
|
||||
}
|
||||
c.announce(MaplePacketCreator.enableActions());
|
||||
@@ -143,7 +143,7 @@ public final class AdminCommandHandler extends AbstractMaplePacketHandler {
|
||||
int mobId = slea.readInt();
|
||||
int quantity = slea.readInt();
|
||||
for (int i = 0; i < quantity; i++) {
|
||||
c.getPlayer().getMap().spawnMonsterOnGroudBelow(MapleLifeFactory.getMonster(mobId), c.getPlayer().getPosition());
|
||||
c.getPlayer().getMap().spawnMonsterOnGroundBelow(MapleLifeFactory.getMonster(mobId), c.getPlayer().getPosition());
|
||||
}
|
||||
break;
|
||||
case 0x18: // Maple & Mobhp
|
||||
|
||||
@@ -55,7 +55,7 @@ public final class UseSummonBag extends AbstractMaplePacketHandler {
|
||||
for (int z = 0; z < toSpawn.length; z++) {
|
||||
int[] toSpawnChild = toSpawn[z];
|
||||
if (Randomizer.nextInt(101) <= toSpawnChild[1]) {
|
||||
c.getPlayer().getMap().spawnMonsterOnGroudBelow(MapleLifeFactory.getMonster(toSpawnChild[0]), c.getPlayer().getPosition());
|
||||
c.getPlayer().getMap().spawnMonsterOnGroundBelow(MapleLifeFactory.getMonster(toSpawnChild[0]), c.getPlayer().getPosition());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ import java.util.List;
|
||||
public class MapleParty {
|
||||
private MaplePartyCharacter leader;
|
||||
private List<MaplePartyCharacter> members = new LinkedList<MaplePartyCharacter>();
|
||||
private List<MaplePartyCharacter> pqMembers = null;
|
||||
private int id;
|
||||
|
||||
public MapleParty(int id, MaplePartyCharacter chrfor) {
|
||||
@@ -74,6 +75,19 @@ public class MapleParty {
|
||||
return Collections.unmodifiableList(members);
|
||||
}
|
||||
|
||||
public List<MaplePartyCharacter> getPartyMembers() {
|
||||
return members;
|
||||
}
|
||||
|
||||
// used whenever entering PQs: will draw every party member that can attempt a target PQ while ingnoring those unfit.
|
||||
public Collection<MaplePartyCharacter> getEligibleMembers() {
|
||||
return Collections.unmodifiableList(pqMembers);
|
||||
}
|
||||
|
||||
public void setEligibleMembers(List<MaplePartyCharacter> eliParty) {
|
||||
pqMembers = eliParty;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
@@ -85,7 +99,7 @@ public class MapleParty {
|
||||
public MaplePartyCharacter getLeader() {
|
||||
return leader;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
|
||||
@@ -79,6 +79,10 @@ public class MaplePartyCharacter {
|
||||
public void setChannel(int channel) {
|
||||
this.channel = channel;
|
||||
}
|
||||
|
||||
public boolean isLeader() {
|
||||
return getPlayer().isPartyLeader();
|
||||
}
|
||||
|
||||
public boolean isOnline() {
|
||||
return online;
|
||||
|
||||
@@ -93,15 +93,15 @@ public class AbstractPlayerInteraction {
|
||||
}
|
||||
|
||||
public void warp(int map) {
|
||||
getPlayer().changeMap(getWarpMap(map), getWarpMap(map).getPortal(0));
|
||||
getPlayer().changeMap(map, 0);
|
||||
}
|
||||
|
||||
public void warp(int map, int portal) {
|
||||
getPlayer().changeMap(getWarpMap(map), getWarpMap(map).getPortal(portal));
|
||||
getPlayer().changeMap(map, portal);
|
||||
}
|
||||
|
||||
public void warp(int map, String portal) {
|
||||
getPlayer().changeMap(getWarpMap(map), getWarpMap(map).getPortal(portal));
|
||||
getPlayer().changeMap(map, portal);
|
||||
}
|
||||
|
||||
public void warpMap(int map) {
|
||||
@@ -161,6 +161,15 @@ public class AbstractPlayerInteraction {
|
||||
public EventManager getEventManager(String event) {
|
||||
return getClient().getEventManager(event);
|
||||
}
|
||||
|
||||
public void clearPQ(int toMap) {
|
||||
clearPQ(getWarpMap(toMap));
|
||||
}
|
||||
|
||||
public void clearPQ(MapleMap toMap) {
|
||||
if(getPlayer().getEventInstance() != null)
|
||||
getPlayer().getEventInstance().getEm().clearPQ(getPlayer().getEventInstance(), toMap);
|
||||
}
|
||||
|
||||
public MapleInventory getInventory(MapleInventoryType type) {
|
||||
return getPlayer().getInventory(type);
|
||||
@@ -556,14 +565,17 @@ public class AbstractPlayerInteraction {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void giveCharacterExp(int amount, MapleCharacter chr) {
|
||||
chr.gainExp((amount * chr.getExpRate()), true, true);
|
||||
}
|
||||
|
||||
public void givePartyExp(int amount, List<MapleCharacter> party) {
|
||||
for (MapleCharacter chr : party) {
|
||||
chr.gainExp((amount * chr.getExpRate()), true, true);
|
||||
giveCharacterExp(amount, chr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void givePartyExp(String PQ) {
|
||||
givePartyExp(PQ, true);
|
||||
}
|
||||
|
||||
@@ -83,6 +83,28 @@ public class EventInstanceManager {
|
||||
public EventManager getEm() {
|
||||
return em;
|
||||
}
|
||||
|
||||
public void giveEventPlayersExp(int gain) {
|
||||
giveEventPlayersExp(gain, -1);
|
||||
}
|
||||
|
||||
public void giveEventPlayersExp(int gain, int mapId) {
|
||||
rL.lock();
|
||||
try {
|
||||
if(mapId == -1) {
|
||||
for(MapleCharacter mc: chars) {
|
||||
mc.gainExp(gain * mc.getExpRate(), true, true);
|
||||
}
|
||||
}
|
||||
else {
|
||||
for(MapleCharacter mc: chars) {
|
||||
if(mc.getMapId() == mapId) mc.gainExp(gain * mc.getExpRate(), true, true);
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
rL.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
public void registerPlayer(MapleCharacter chr) {
|
||||
if (chr == null || !chr.isLoggedin()){
|
||||
@@ -141,7 +163,7 @@ public class EventInstanceManager {
|
||||
}
|
||||
|
||||
public void registerParty(MapleParty party, MapleMap map) {
|
||||
for (MaplePartyCharacter pc : party.getMembers()) {
|
||||
for (MaplePartyCharacter pc : party.getEligibleMembers()) {
|
||||
MapleCharacter c = map.getCharacterById(pc.getId());
|
||||
registerPlayer(c);
|
||||
}
|
||||
@@ -197,6 +219,14 @@ public class EventInstanceManager {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void changedMap(MapleCharacter chr, int mapId) {
|
||||
try {
|
||||
em.getIv().invokeFunction("changedMap", this, chr, mapId);
|
||||
} catch (ScriptException | NoSuchMethodException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void monsterKilled(MapleMonster mob) {
|
||||
mobs.remove(mob);
|
||||
@@ -418,7 +448,7 @@ public class EventInstanceManager {
|
||||
|
||||
rL.lock();
|
||||
try {
|
||||
if (chars != null && chars.size() <= size) {
|
||||
if (chars != null && chars.size() < size) {
|
||||
for (MapleCharacter chr : chars) {
|
||||
if (chr == null) {
|
||||
continue;
|
||||
|
||||
@@ -35,6 +35,7 @@ import javax.script.ScriptException;
|
||||
|
||||
import net.server.channel.Channel;
|
||||
import net.server.world.MapleParty;
|
||||
import net.server.world.MaplePartyCharacter;
|
||||
import server.TimerManager;
|
||||
import server.expeditions.MapleExpedition;
|
||||
import server.maps.MapleMap;
|
||||
@@ -42,6 +43,10 @@ import server.life.MapleMonster;
|
||||
import server.life.MapleLifeFactory;
|
||||
|
||||
import client.MapleCharacter;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import java.lang.reflect.Array;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -86,7 +91,8 @@ public class EventManager {
|
||||
}
|
||||
|
||||
public void cancelSchedule() {
|
||||
schedule.cancel(true);
|
||||
if(schedule != null)
|
||||
schedule.cancel(true);
|
||||
}
|
||||
|
||||
public ScheduledFuture<?> scheduleAtTimestamp(final String methodName, long timestamp) {
|
||||
@@ -173,6 +179,7 @@ public class EventManager {
|
||||
try {
|
||||
EventInstanceManager eim = (EventInstanceManager) (iv.invokeFunction("setup", (Object) null));
|
||||
eim.registerParty(party, map);
|
||||
party.setEligibleMembers(null);
|
||||
} catch (ScriptException | NoSuchMethodException ex) {
|
||||
Logger.getLogger(EventManager.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
@@ -183,6 +190,7 @@ public class EventManager {
|
||||
try {
|
||||
EventInstanceManager eim = (EventInstanceManager) (iv.invokeFunction("setup", difficulty, party.getLeader().getId()));
|
||||
eim.registerParty(party, map);
|
||||
party.setEligibleMembers(null);
|
||||
} catch (ScriptException | NoSuchMethodException ex) {
|
||||
Logger.getLogger(EventManager.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
@@ -198,6 +206,33 @@ public class EventManager {
|
||||
}
|
||||
}
|
||||
|
||||
public List<MaplePartyCharacter> getEligibleParty(MapleParty party) {
|
||||
if (party == null) {
|
||||
return(new ArrayList<>());
|
||||
}
|
||||
try {
|
||||
Object p = iv.invokeFunction("getEligibleParty", party.getPartyMembers());
|
||||
|
||||
if(p != null) {
|
||||
List<MaplePartyCharacter> lmpc = new ArrayList<>((List<MaplePartyCharacter>) p);
|
||||
party.setEligibleMembers(lmpc);
|
||||
return lmpc;
|
||||
}
|
||||
} catch (ScriptException | NoSuchMethodException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
|
||||
return(new ArrayList<>());
|
||||
}
|
||||
|
||||
public void clearPQ(EventInstanceManager eim, MapleMap toMap) {
|
||||
try {
|
||||
iv.invokeFunction("clearPQ", eim, toMap);
|
||||
} catch (ScriptException | NoSuchMethodException ex) {
|
||||
Logger.getLogger(EventManager.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
|
||||
public MapleMonster getMonster(int mid) {
|
||||
return(MapleLifeFactory.getMonster(mid));
|
||||
}
|
||||
|
||||
@@ -218,7 +218,7 @@ public class NPCConversationManager extends AbstractPlayerInteraction {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public int getMeso() {
|
||||
return getPlayer().getMeso();
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ public class ReactorActionManager extends AbstractPlayerInteraction {
|
||||
int range = maxMeso - minMeso;
|
||||
int displayDrop = (int) (Math.random() * range) + minMeso;
|
||||
int mesoDrop = (displayDrop * client.getWorldServer().getMesoRate());
|
||||
reactor.getMap().spawnMesoDrop(mesoDrop, dropPos, reactor, client.getPlayer(), false, (byte) 0);
|
||||
reactor.getMap().spawnMesoDrop(mesoDrop, dropPos, reactor, client.getPlayer(), false, (byte) 2);
|
||||
} else {
|
||||
Item drop;
|
||||
MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();
|
||||
@@ -129,7 +129,7 @@ public class ReactorActionManager extends AbstractPlayerInteraction {
|
||||
|
||||
private void spawnMonster(int id, int qty, Point pos) {
|
||||
for (int i = 0; i < qty; i++) {
|
||||
reactor.getMap().spawnMonsterOnGroudBelow(MapleLifeFactory.getMonster(id), pos);
|
||||
reactor.getMap().spawnMonsterOnGroundBelow(MapleLifeFactory.getMonster(id), pos);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -47,6 +47,23 @@ public class ReactorScriptManager extends AbstractScriptManager {
|
||||
public synchronized static ReactorScriptManager getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
public void onHit(MapleClient c, MapleReactor reactor) {
|
||||
try {
|
||||
ReactorActionManager rm = new ReactorActionManager(c, reactor);
|
||||
Invocable iv = getInvocable("reactor/" + reactor.getId() + ".js", c);
|
||||
if (iv == null) {
|
||||
return;
|
||||
}
|
||||
engine.put("rm", rm);
|
||||
iv.invokeFunction("hit");
|
||||
} catch(final NoSuchMethodException e) {
|
||||
//do nothing, hit is OPTIONAL
|
||||
}
|
||||
catch (final ScriptException | NullPointerException e) {
|
||||
FilePrinter.printError(FilePrinter.REACTOR + reactor.getId() + ".txt", e);
|
||||
}
|
||||
}
|
||||
|
||||
public void act(MapleClient c, MapleReactor reactor) {
|
||||
try {
|
||||
|
||||
@@ -1001,15 +1001,11 @@ public class MapleMap {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void spawnMonsterOnGroudBelow(int id, int x, int y) {
|
||||
public void spawnMonsterOnGroundBelow(int id, int x, int y) {
|
||||
MapleMonster mob = MapleLifeFactory.getMonster(id);
|
||||
spawnMonsterOnGroundBelow(mob, new Point(x, y));
|
||||
}
|
||||
|
||||
public void spawnMonsterOnGroudBelow(MapleMonster mob, Point pos) {
|
||||
spawnMonsterOnGroundBelow(mob, pos);
|
||||
}
|
||||
|
||||
public void spawnMonsterOnGroundBelow(MapleMonster mob, Point pos) {
|
||||
Point spos = new Point(pos.x, pos.y - 1);
|
||||
spos = calcPointBelow(spos);
|
||||
@@ -1642,13 +1638,15 @@ public class MapleMap {
|
||||
}
|
||||
chr.leaveMap();
|
||||
chr.cancelMapTimeLimitTask();
|
||||
for (MapleSummon summon : chr.getSummonsValues()) {
|
||||
|
||||
for (MapleSummon summon : new ArrayList<>(chr.getSummonsValues())) {
|
||||
if (summon.isStationary()) {
|
||||
chr.cancelBuffStats(MapleBuffStat.PUPPET);
|
||||
} else {
|
||||
removeMapObject(summon);
|
||||
}
|
||||
}
|
||||
|
||||
if (chr.getDragon() != null) {
|
||||
removeMapObject(chr.getDragon());
|
||||
if (chr.isHidden()) {
|
||||
|
||||
@@ -174,8 +174,9 @@ public class MapleReactor extends AbstractMapleMapObject {
|
||||
return;
|
||||
}
|
||||
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));
|
||||
int reactorType = stats.getType(state);
|
||||
ReactorScriptManager.getInstance().onHit(c, this);
|
||||
|
||||
int reactorType = stats.getType(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?
|
||||
@@ -212,7 +213,6 @@ public class MapleReactor extends AbstractMapleMapObject {
|
||||
map.broadcastMessage(MaplePacketCreator.triggerReactor(this, stance));
|
||||
ReactorScriptManager.getInstance().act(c, this);
|
||||
setShouldCollect(true);
|
||||
System.out.println("ehh");
|
||||
}
|
||||
} catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
|
||||
@@ -47,7 +47,7 @@ public class ExpAction extends MapleQuestAction {
|
||||
|
||||
@Override
|
||||
public void run(MapleCharacter chr, Integer extSelection) {
|
||||
if (chr.isBeginnerJob()) {
|
||||
if (chr.isBeginnerJob() && chr.getLevel() < 10) {
|
||||
chr.gainExp(exp, true, true);
|
||||
} else {
|
||||
chr.gainExp(exp * chr.getExpRate(), true, true);
|
||||
|
||||
Reference in New Issue
Block a user