Guild PQ + fixed negative EXP error

Implemented Guild PQ. Fixed a problem introduced earlier where negative
EXP would be deemed as "integer overflow", provoking many game breaking
issues as result.
This commit is contained in:
ronancpl
2017-06-18 03:19:53 -03:00
parent 81f9226286
commit 42fe74955d
135 changed files with 822 additions and 564 deletions

View File

@@ -131,13 +131,7 @@ public class AbstractPlayerInteraction {
}
public MapleMap getWarpMap(int map) {
MapleMap target;
if (getPlayer().getEventInstance() == null) {
target = c.getChannelServer().getMapFactory().getMap(map);
} else {
target = getPlayer().getEventInstance().getMapInstance(map);
}
return target;
return getPlayer().getWarpMap(map);
}
public MapleMap getMap(int map) {
@@ -529,11 +523,15 @@ public class AbstractPlayerInteraction {
return getPlayer().getParty();
}
public boolean isLeader() {
return isPartyLeader();
}
public boolean isGuildLeader() {
return getPlayer().isGuildLeader();
}
public boolean isLeader() {
public boolean isPartyLeader() {
if(getParty() == null)
return false;

View File

@@ -952,7 +952,11 @@ public class EventInstanceManager {
}
public final void showWrongEffect() {
MapleMap map = getMapInstance(getLeader().getMapId());
showWrongEffect(getLeader().getMapId());
}
public final void showWrongEffect(int mapId) {
MapleMap map = getMapInstance(mapId);
map.broadcastMessage(MaplePacketCreator.showEffect("quest/party/wrong_kor"));
map.broadcastMessage(MaplePacketCreator.playSound("Party1/Failed"));
}
@@ -962,7 +966,11 @@ public class EventInstanceManager {
}
public final void showClearEffect(boolean hasGate) {
MapleMap map = getMapInstance(getLeader().getMapId());
showClearEffect(hasGate, getLeader().getMapId());
}
public final void showClearEffect(boolean hasGate, int mapId) {
MapleMap map = getMapInstance(mapId);
map.broadcastMessage(MaplePacketCreator.showEffect("quest/party/clear"));
map.broadcastMessage(MaplePacketCreator.playSound("Party1/Clear"));
if(hasGate) {

View File

@@ -145,9 +145,17 @@ public class EventManager {
}, timestamp);
}
public World getWorldServer() {
return wserv;
}
public Channel getChannelServer() {
return cserv;
}
public Invocable getIv() {
return iv;
}
public EventInstanceManager getInstance(String name) {
return instances.get(name);
@@ -173,10 +181,6 @@ public class EventManager {
}, lobbyDelay * 1000);
}
public Invocable getIv() {
return iv;
}
public void setProperty(String key, String value) {
props.setProperty(key, value);
}
@@ -298,8 +302,8 @@ public class EventManager {
return startInstance(-1, chr);
}
public boolean startInstance(int lobbyId, MapleCharacter chr) {
return startInstance(lobbyId, chr, chr, 1);
public boolean startInstance(int lobbyId, MapleCharacter leader) {
return startInstance(lobbyId, null, leader, 1);
}
public boolean startInstance(int lobbyId, MapleCharacter chr, MapleCharacter leader, int difficulty) {
@@ -321,7 +325,7 @@ public class EventManager {
instanceLocks.put(eim.getName(), lobbyId);
eim.setLeader(leader);
eim.registerPlayer(chr);
if(chr != null) eim.registerPlayer(chr);
iv.invokeFunction("afterSetup", eim);
} catch (ScriptException | NoSuchMethodException ex) {
Logger.getLogger(EventManager.class.getName()).log(Level.SEVERE, null, ex);
@@ -502,7 +506,8 @@ public class EventManager {
private void exportReadyGuild(Integer guildId) {
MapleGuild mg = server.getGuild(guildId);
String callout = "Your guild has been registered to attend to the Sharenian Guild Quest at channel " + this.getChannelServer().getId()
+ " and JUST STARTED THE STRATEGY PHASE. After 3 minutes, no more guild members will be allowed to join the effort.";
+ " and HAS JUST STARTED THE STRATEGY PHASE. After 3 minutes, no more guild members will be allowed to join the effort."
+ " Check out Shuang at the excavation site in Perion for more info.";
mg.dropMessage(0, callout);
}

View File

@@ -118,6 +118,7 @@ public class NPCScriptManager extends AbstractScriptManager {
public void dispose(NPCConversationManager cm) {
MapleClient c = cm.getClient();
c.getPlayer().setCS(false);
c.getPlayer().setNpcCooldown(System.currentTimeMillis());
cms.remove(c);
scripts.remove(c);

View File

@@ -148,6 +148,7 @@ public class QuestScriptManager extends AbstractScriptManager {
public void dispose(QuestActionManager qm, MapleClient c) {
qms.remove(c);
scripts.remove(c);
c.getPlayer().setNpcCooldown(System.currentTimeMillis());
resetContext("quest/" + qm.getQuest() + ".js", c);
}