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:
@@ -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));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user