Ludibrium Maze PQ

Implemented Ludibrium Maze PQ.
This commit is contained in:
ronancpl
2017-05-15 15:52:24 -03:00
parent b26469301d
commit a56312ddd3
35 changed files with 8081 additions and 8015 deletions

View File

@@ -182,6 +182,10 @@ public class AbstractPlayerInteraction {
public boolean haveItem(int itemid, int quantity) {
return getPlayer().getItemQuantity(itemid, false) >= quantity;
}
public int getItemQuantity(int itemid) {
return getPlayer().getItemQuantity(itemid, false);
}
public boolean canHold(int itemid) {
return canHold(itemid, 1);

View File

@@ -552,7 +552,7 @@ public class EventInstanceManager {
return (chr.getParty().getLeaderId() == chr.getId());
}
public final MapleMap setInstanceMap(final int mapid) { //gets instance map from the channelserv
public final MapleMap getInstanceMap(final int mapid) { //gets instance map from the channelserv
if (disposed) {
return getMapFactory().getMap(mapid);
}

View File

@@ -183,6 +183,15 @@ public class EventManager {
return Integer.parseInt(props.getProperty(key));
}
private boolean getLockLobby(int lobbyId) {
l.lock();
try {
return openedLobbys.get(lobbyId);
} finally {
l.unlock();
}
}
private void setLockLobby(int lobbyId, boolean lock) {
l.lock();
try {
@@ -243,10 +252,14 @@ public class EventManager {
//Expedition method: starts an expedition
public boolean startInstance(int lobbyId, MapleExpedition exped) {
try {
if(lobbyId > -1) {
if(lobbyId == -1) {
lobbyId = availableLobbyInstance();
if(lobbyId == -1) return false;
}
else {
if(getLockLobby(lobbyId)) return false;
startLobbyInstance(lobbyId);
}
EventInstanceManager eim = (EventInstanceManager) (iv.invokeFunction("setup", (Object) null));
if(eim == null) {
@@ -271,10 +284,14 @@ public class EventManager {
public boolean startInstance(int lobbyId, MapleCharacter chr) {
try {
if(lobbyId > -1) {
if(lobbyId == -1) {
lobbyId = availableLobbyInstance();
if(lobbyId == -1) return false;
}
else {
if(getLockLobby(lobbyId)) return false;
startLobbyInstance(lobbyId);
}
EventInstanceManager eim = (EventInstanceManager) (iv.invokeFunction("setup", (Object) null));
if(eim == null) {
@@ -298,10 +315,14 @@ public class EventManager {
public boolean startInstance(int lobbyId, MapleParty party, MapleMap map) {
try {
if(lobbyId > -1) {
if(lobbyId == -1) {
lobbyId = availableLobbyInstance();
if(lobbyId == -1) return false;
}
else {
if(getLockLobby(lobbyId)) return false;
startLobbyInstance(lobbyId);
}
EventInstanceManager eim = (EventInstanceManager) (iv.invokeFunction("setup", (Object) null));
if(eim == null) {
@@ -326,10 +347,14 @@ public class EventManager {
public boolean startInstance(int lobbyId, MapleParty party, MapleMap map, int difficulty) {
try {
if(lobbyId > -1) {
if(lobbyId == -1) {
lobbyId = availableLobbyInstance();
if(lobbyId == -1) return false;
}
else {
if(getLockLobby(lobbyId)) return false;
startLobbyInstance(lobbyId);
}
EventInstanceManager eim = (EventInstanceManager) (iv.invokeFunction("setup", difficulty, (lobbyId > -1) ? lobbyId : party.getLeaderId()));
if(eim == null) {
@@ -354,10 +379,14 @@ public class EventManager {
public boolean startInstance(int lobbyId, EventInstanceManager eim, String leader) {
try {
if(lobbyId > -1) {
if(lobbyId == -1) {
lobbyId = availableLobbyInstance();
if(lobbyId == -1) return false;
}
else {
if(getLockLobby(lobbyId)) return false;
startLobbyInstance(lobbyId);
}
if(eim == null) {
if(lobbyId > -1) setLockLobby(lobbyId, false);