Maplers' Well-known Battlegrounds
Fulfilled merge of Drago's AriantPQ PR #438 into the source! Adjusted MCPQ map limits predicted within battlefield's map info node. Added max number-of-players option when creating a AriantPQ lobby. Added party creation check when trying to create one inside the AriantPQ rooms. Adjusted several AriantPQ mechanics, in order to either improve the existent features or make those that was still unavailable work seamlessly (score update, ariant batlle points).
This commit is contained in:
@@ -116,6 +116,10 @@ public class MapleItemInformationProvider {
|
||||
protected Map<Integer, Boolean> karmaCache = new HashMap<>();
|
||||
protected Map<Integer, Integer> triggerItemCache = new HashMap<>();
|
||||
protected Map<Integer, Integer> expCache = new HashMap<>();
|
||||
protected Map<Integer, Integer> createItem = new HashMap<>();
|
||||
protected Map<Integer, Integer> mobItem = new HashMap<>();
|
||||
protected Map<Integer, Integer> useDelay = new HashMap<>();
|
||||
protected Map<Integer, Integer> mobHP = new HashMap<>();
|
||||
protected Map<Integer, Integer> levelCache = new HashMap<>();
|
||||
protected Map<Integer, Pair<Integer, List<RewardItem>>> rewardCache = new HashMap<>();
|
||||
protected List<Pair<Integer, String>> itemNameCache = new ArrayList<>();
|
||||
@@ -150,40 +154,6 @@ public class MapleItemInformationProvider {
|
||||
isPartyQuestItemCache.put(0, false);
|
||||
}
|
||||
|
||||
// public MapleInventoryType getInventoryType(int itemId) {
|
||||
// if (inventoryTypeCache.containsKey(itemId)) {
|
||||
// return inventoryTypeCache.get(itemId);
|
||||
// }
|
||||
// MapleInventoryType ret;
|
||||
// String idStr = "0" + String.valueOf(itemId);
|
||||
// MapleDataDirectoryEntry root = itemData.getRoot();
|
||||
// for (MapleDataDirectoryEntry topDir : root.getSubdirectories()) {
|
||||
// for (MapleDataFileEntry iFile : topDir.getFiles()) {
|
||||
// if (iFile.getName().equals(idStr.substring(0, 4) + ".img")) {
|
||||
// ret = MapleInventoryType.getByWZName(topDir.getName());
|
||||
// inventoryTypeCache.put(itemId, ret);
|
||||
// return ret;
|
||||
// } else if (iFile.getName().equals(idStr.substring(1) + ".img")) {
|
||||
// ret = MapleInventoryType.getByWZName(topDir.getName());
|
||||
// inventoryTypeCache.put(itemId, ret);
|
||||
// return ret;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// root = equipData.getRoot();
|
||||
// for (MapleDataDirectoryEntry topDir : root.getSubdirectories()) {
|
||||
// for (MapleDataFileEntry iFile : topDir.getFiles()) {
|
||||
// if (iFile.getName().equals(idStr + ".img")) {
|
||||
// ret = MapleInventoryType.EQUIP;
|
||||
// inventoryTypeCache.put(itemId, ret);
|
||||
// return ret;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// ret = MapleInventoryType.UNDEFINED;
|
||||
// inventoryTypeCache.put(itemId, ret);
|
||||
// return ret;
|
||||
// }
|
||||
|
||||
public List<Pair<Integer, String>> getAllItems() {
|
||||
if (!itemNameCache.isEmpty()) {
|
||||
@@ -1176,7 +1146,10 @@ public class MapleItemInformationProvider {
|
||||
if (item == null) {
|
||||
return null;
|
||||
}
|
||||
MapleData spec = item.getChildByPath("spec");
|
||||
MapleData spec = item.getChildByPath("specEx");
|
||||
if (spec == null) {
|
||||
spec = item.getChildByPath("spec");
|
||||
}
|
||||
ret = MapleStatEffect.loadItemEffectFromData(spec, itemId);
|
||||
itemEffects.put(Integer.valueOf(itemId), ret);
|
||||
}
|
||||
@@ -1479,6 +1452,46 @@ public class MapleItemInformationProvider {
|
||||
return triggerItem;
|
||||
}
|
||||
}
|
||||
|
||||
public int getCreateItem(int itemId) {
|
||||
if (createItem.containsKey(itemId)) {
|
||||
return createItem.get(itemId);
|
||||
} else {
|
||||
int itemFrom = MapleDataTool.getIntConvert("info/create", getItemData(itemId), 0);
|
||||
createItem.put(itemId, itemFrom);
|
||||
return itemFrom;
|
||||
}
|
||||
}
|
||||
|
||||
public int getMobItem(int itemId) {
|
||||
if (mobItem.containsKey(itemId)) {
|
||||
return mobItem.get(itemId);
|
||||
} else {
|
||||
int mobItemCatch = MapleDataTool.getIntConvert("info/mob", getItemData(itemId), 0);
|
||||
mobItem.put(itemId, mobItemCatch);
|
||||
return mobItemCatch;
|
||||
}
|
||||
}
|
||||
|
||||
public int getUseDelay(int itemId) {
|
||||
if (useDelay.containsKey(itemId)) {
|
||||
return useDelay.get(itemId);
|
||||
} else {
|
||||
int mobUseDelay = MapleDataTool.getIntConvert("info/useDelay", getItemData(itemId), 0);
|
||||
useDelay.put(itemId, mobUseDelay);
|
||||
return mobUseDelay;
|
||||
}
|
||||
}
|
||||
|
||||
public int getMobHP(int itemId) {
|
||||
if (mobHP.containsKey(itemId)) {
|
||||
return mobHP.get(itemId);
|
||||
} else {
|
||||
int mobHPItem = MapleDataTool.getIntConvert("info/mobHP", getItemData(itemId), 0);
|
||||
mobHP.put(itemId, mobHPItem);
|
||||
return mobHPItem;
|
||||
}
|
||||
}
|
||||
|
||||
public int getExpById(int itemId) {
|
||||
if (expCache.containsKey(itemId)) {
|
||||
|
||||
@@ -112,6 +112,8 @@ import constants.skills.WhiteKnight;
|
||||
import constants.skills.WindArcher;
|
||||
import net.server.world.MapleParty;
|
||||
import net.server.world.MaplePartyCharacter;
|
||||
import server.life.MobSkill;
|
||||
import server.life.MobSkillFactory;
|
||||
import server.partyquest.MapleCarnivalFactory;
|
||||
import server.partyquest.MapleCarnivalFactory.MCSkill;
|
||||
|
||||
@@ -125,10 +127,10 @@ public class MapleStatEffect {
|
||||
private short watk, matk, wdef, mdef, acc, avoid, speed, jump;
|
||||
private short hp, mp;
|
||||
private double hpR, mpR;
|
||||
private short mhpRRate, mmpRRate;
|
||||
private short mhpRRate, mmpRRate, mobSkill, mobSkillLevel;
|
||||
private byte mhpR, mmpR;
|
||||
private short mpCon, hpCon;
|
||||
private int duration;
|
||||
private int duration, target, barrier, mob;
|
||||
private boolean overTime, repeatEffect;
|
||||
private int sourceid;
|
||||
private int moveTo;
|
||||
@@ -208,6 +210,23 @@ public class MapleStatEffect {
|
||||
ret.fatigue = MapleDataTool.getInt("incFatigue", source, 0);
|
||||
ret.repeatEffect = MapleDataTool.getInt("repeatEffect", source, 0) > 0;
|
||||
|
||||
MapleData mdd = source.getChildByPath("0");
|
||||
if (mdd != null && mdd.getChildren().size() > 0) {
|
||||
ret.mobSkill = (short) MapleDataTool.getInt("mobSkill", mdd, 0);
|
||||
ret.mobSkillLevel = (short) MapleDataTool.getInt("level", mdd, 0);
|
||||
ret.target = MapleDataTool.getInt("target", mdd, 0);
|
||||
} else {
|
||||
ret.mobSkill = 0;
|
||||
ret.mobSkillLevel = 0;
|
||||
ret.target = 0;
|
||||
}
|
||||
|
||||
MapleData mdds = source.getChildByPath("mob");
|
||||
if (mdds != null) {
|
||||
if (mdds.getChildren()!= null && mdds.getChildren().size() > 0) {
|
||||
ret.mob = MapleDataTool.getInt("mob", mdds, 0);
|
||||
}
|
||||
}
|
||||
ret.sourceid = sourceid;
|
||||
ret.skill = skill;
|
||||
if (!ret.skill && ret.duration > -1) {
|
||||
@@ -228,9 +247,12 @@ public class MapleStatEffect {
|
||||
ret.speed = (short) MapleDataTool.getInt("speed", source, 0);
|
||||
ret.jump = (short) MapleDataTool.getInt("jump", source, 0);
|
||||
|
||||
ret.barrier = MapleDataTool.getInt("barrier", source, 0);
|
||||
addBuffStatPairToListIfNotZero(statups, MapleBuffStat.ARIANT_PQ_SHIELD, ret.barrier);
|
||||
|
||||
ret.mapProtection = mapProtection(sourceid);
|
||||
addBuffStatPairToListIfNotZero(statups, MapleBuffStat.MAP_PROTECTION, Integer.valueOf(ret.mapProtection));
|
||||
|
||||
|
||||
if (ret.overTime && ret.getSummonMovementType() == null) {
|
||||
if (!skill) {
|
||||
if (isPyramidBuff(sourceid)) {
|
||||
@@ -978,8 +1000,20 @@ public class MapleStatEffect {
|
||||
applyfrom.dispelDebuff(debuff);
|
||||
}
|
||||
}
|
||||
} else if (mobSkill > 0 && mobSkillLevel > 0) {
|
||||
MobSkill ms = MobSkillFactory.getMobSkill(mobSkill, mobSkillLevel);
|
||||
MapleDisease dis = MapleDisease.getBySkill(mobSkill);
|
||||
|
||||
if (target > 0) {
|
||||
for (MapleCharacter chr : applyto.getMap().getAllPlayers()) {
|
||||
if (chr.getId() != applyto.getId()) {
|
||||
chr.giveDebuff(dis, ms);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
applyto.giveDebuff(dis, ms);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1204,7 +1238,6 @@ public class MapleStatEffect {
|
||||
|
||||
localstatups = statups;
|
||||
}
|
||||
|
||||
buff = MaplePacketCreator.giveBuff(localsourceid, localDuration, localstatups);
|
||||
mbuff = MaplePacketCreator.showMonsterRiding(applyto.getId(), givemount);
|
||||
localDuration = duration;
|
||||
@@ -1219,6 +1252,9 @@ public class MapleStatEffect {
|
||||
} else if (isMorph()) {
|
||||
List<Pair<MapleBuffStat, Integer>> stat = Collections.singletonList(new Pair<>(MapleBuffStat.MORPH, Integer.valueOf(getMorph(applyto))));
|
||||
mbuff = MaplePacketCreator.giveForeignBuff(applyto.getId(), stat);
|
||||
} else if (isAriantShield()) {
|
||||
List<Pair<MapleBuffStat, Integer>> stat = Collections.singletonList(new Pair<>(MapleBuffStat.ARIANT_PQ_SHIELD, 1));
|
||||
mbuff = MaplePacketCreator.giveForeignBuff(applyto.getId(), stat);
|
||||
}
|
||||
|
||||
if (buff != null) {
|
||||
@@ -1455,6 +1491,10 @@ public class MapleStatEffect {
|
||||
public static boolean isExpIncrease(int sourceid) {
|
||||
return sourceid >= 2022450 && sourceid <= 2022452;
|
||||
}
|
||||
|
||||
public static boolean isAriantShield(int sourceid) {
|
||||
return sourceid == 2022269;
|
||||
}
|
||||
|
||||
private boolean isDs() {
|
||||
return skill && (sourceid == Rogue.DARK_SIGHT || sourceid == NightWalker.DARK_SIGHT);
|
||||
@@ -1487,6 +1527,11 @@ public class MapleStatEffect {
|
||||
private boolean isCouponBuff() {
|
||||
return isRateCoupon(sourceid);
|
||||
}
|
||||
|
||||
private boolean isAriantShield() {
|
||||
int itemid = sourceid;
|
||||
return isAriantShield(itemid);
|
||||
}
|
||||
|
||||
private boolean isMysticDoor() {
|
||||
return skill && sourceid == Priest.MYSTIC_DOOR;
|
||||
|
||||
@@ -41,6 +41,11 @@ import server.maps.MapleMap;
|
||||
import tools.LogHelper;
|
||||
import tools.MaplePacketCreator;
|
||||
import client.MapleCharacter;
|
||||
import java.util.Iterator;
|
||||
import java.util.Properties;
|
||||
import net.server.audit.locks.MonitoredLockType;
|
||||
import net.server.audit.locks.MonitoredReentrantLock;
|
||||
import net.server.audit.locks.factory.MonitoredReentrantLockFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -89,21 +94,38 @@ public class MapleExpedition {
|
||||
private Map<Integer, String> members = new ConcurrentHashMap<>();
|
||||
private List<Integer> banned = new CopyOnWriteArrayList<>();
|
||||
private long startTime;
|
||||
private Properties props = new Properties();
|
||||
private boolean silent;
|
||||
private int minSize, maxSize;
|
||||
private MonitoredReentrantLock pL = MonitoredReentrantLockFactory.createLock(MonitoredLockType.EIM_PARTY, true);
|
||||
|
||||
public MapleExpedition(MapleCharacter player, MapleExpeditionType met) {
|
||||
public MapleExpedition(MapleCharacter player, MapleExpeditionType met, boolean sil, int minPlayers, int maxPlayers) {
|
||||
leader = player;
|
||||
members.put(player.getId(), player.getName());
|
||||
startMap = player.getMap();
|
||||
type = met;
|
||||
silent = sil;
|
||||
minSize = (minPlayers != 0) ? minPlayers : type.getMinSize();
|
||||
maxSize = (maxPlayers != 0) ? maxPlayers : type.getMaxSize();
|
||||
bossLogs = new CopyOnWriteArrayList<>();
|
||||
beginRegistration();
|
||||
}
|
||||
|
||||
public int getMinSize() {
|
||||
return minSize;
|
||||
}
|
||||
|
||||
public int getMaxSize() {
|
||||
return maxSize;
|
||||
}
|
||||
|
||||
private void beginRegistration() {
|
||||
registering = true;
|
||||
leader.announce(MaplePacketCreator.getClock(type.getRegistrationTime() * 60));
|
||||
startMap.broadcastMessage(leader, MaplePacketCreator.serverNotice(6, "[Expedition] " + leader.getName() + " has been declared the expedition captain. Please register for the expedition."), false);
|
||||
leader.announce(MaplePacketCreator.serverNotice(6, "[Expedition] You have become the expedition captain. Gather enough people for your team then talk to the NPC to start."));
|
||||
if (!silent) {
|
||||
startMap.broadcastMessage(leader, MaplePacketCreator.serverNotice(6, "[Expedition] " + leader.getName() + " has been declared the expedition captain. Please register for the expedition."), false);
|
||||
leader.announce(MaplePacketCreator.serverNotice(6, "[Expedition] You have become the expedition captain. Gather enough people for your team then talk to the NPC to start."));
|
||||
}
|
||||
scheduleRegistrationEnd();
|
||||
}
|
||||
|
||||
@@ -115,8 +137,8 @@ public class MapleExpedition {
|
||||
@Override
|
||||
public void run() {
|
||||
if (registering){
|
||||
startMap.getChannelServer().getExpeditions().remove(exped);
|
||||
startMap.broadcastMessage(MaplePacketCreator.serverNotice(6, "[Expedition] The time limit has been reached. Expedition has been disbanded."));
|
||||
startMap.getChannelServer().removeExpedition(exped);
|
||||
if (!silent) startMap.broadcastMessage(MaplePacketCreator.serverNotice(6, "[Expedition] The time limit has been reached. Expedition has been disbanded."));
|
||||
|
||||
dispose(false);
|
||||
}
|
||||
@@ -134,11 +156,15 @@ public class MapleExpedition {
|
||||
LogHelper.logExpedition(this);
|
||||
}
|
||||
}
|
||||
|
||||
public void finishRegistration() {
|
||||
registering = false;
|
||||
}
|
||||
|
||||
public void start(){
|
||||
registering = false;
|
||||
finishRegistration();
|
||||
broadcastExped(MaplePacketCreator.removeClock());
|
||||
broadcastExped(MaplePacketCreator.serverNotice(6, "[Expedition] The expedition has started! Good luck, brave heroes!"));
|
||||
if (!silent) broadcastExped(MaplePacketCreator.serverNotice(6, "[Expedition] The expedition has started! Good luck, brave heroes!"));
|
||||
startTime = System.currentTimeMillis();
|
||||
Server.getInstance().broadcastGMMessage(startMap.getWorld(), MaplePacketCreator.serverNotice(6, "[Expedition] " + type.toString() + " Expedition started with leader: " + leader.getName()));
|
||||
}
|
||||
@@ -150,15 +176,32 @@ public class MapleExpedition {
|
||||
if (banned.contains(player.getId())){
|
||||
return "Sorry, you've been banned from this expedition by #b" + leader.getName() + "#k.";
|
||||
}
|
||||
if (members.size() >= type.getMaxSize()){ //Would be a miracle if anybody ever saw this
|
||||
if (members.size() >= this.getMaxSize()){ //Would be a miracle if anybody ever saw this
|
||||
return "Sorry, this expedition is full!";
|
||||
}
|
||||
|
||||
members.put(player.getId(), player.getName());
|
||||
player.announce(MaplePacketCreator.getClock((int)(startTime - System.currentTimeMillis()) / 1000));
|
||||
broadcastExped(MaplePacketCreator.serverNotice(6, "[Expedition] " + player.getName() + " has joined the expedition!"));
|
||||
if (!silent) broadcastExped(MaplePacketCreator.serverNotice(6, "[Expedition] " + player.getName() + " has joined the expedition!"));
|
||||
return "You have registered for the expedition successfully!";
|
||||
}
|
||||
|
||||
public int addMemberInt(MapleCharacter player) {
|
||||
if (!registering) {
|
||||
return 1; //"Sorry, this expedition is already underway. Registration is closed!";
|
||||
}
|
||||
if (banned.contains(player.getId())) {
|
||||
return 2; //"Sorry, you've been banned from this expedition by #b" + leader.getName() + "#k.";
|
||||
}
|
||||
if (members.size() >= this.getMaxSize()) { //Would be a miracle if anybody ever saw this
|
||||
return 3; //"Sorry, this expedition is full!";
|
||||
}
|
||||
|
||||
members.put(player.getId(), player.getName());
|
||||
player.announce(MaplePacketCreator.getClock((int) (startTime - System.currentTimeMillis()) / 1000));
|
||||
if (!silent) broadcastExped(MaplePacketCreator.serverNotice(6, "[Expedition] " + player.getName() + " has joined the expedition!"));
|
||||
return 0; //"You have registered for the expedition successfully!";
|
||||
}
|
||||
|
||||
private void broadcastExped(byte[] packet){
|
||||
for (MapleCharacter chr : getActiveMembers()){
|
||||
@@ -169,13 +212,62 @@ public class MapleExpedition {
|
||||
public boolean removeMember(MapleCharacter chr) {
|
||||
if(members.remove(chr.getId()) != null) {
|
||||
chr.announce(MaplePacketCreator.removeClock());
|
||||
broadcastExped(MaplePacketCreator.serverNotice(6, "[Expedition] " + chr.getName() + " has left the expedition."));
|
||||
chr.dropMessage(6, "[Expedition] You have left this expedition.");
|
||||
if (!silent) {
|
||||
broadcastExped(MaplePacketCreator.serverNotice(6, "[Expedition] " + chr.getName() + " has left the expedition."));
|
||||
chr.dropMessage(6, "[Expedition] You have left this expedition.");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void ban(Entry<Integer, String> chr) {
|
||||
int cid = chr.getKey();
|
||||
if (!banned.contains(cid)) {
|
||||
banned.add(cid);
|
||||
members.remove(cid);
|
||||
|
||||
if (!silent) broadcastExped(MaplePacketCreator.serverNotice(6, "[Expedition] " + chr.getValue() + " has been banned from the expedition."));
|
||||
|
||||
MapleCharacter player = startMap.getWorldServer().getPlayerStorage().getCharacterById(cid);
|
||||
if (player != null && player.isLoggedinWorld()) {
|
||||
player.announce(MaplePacketCreator.removeClock());
|
||||
if (!silent) player.dropMessage(6, "[Expedition] You have been banned from this expedition.");
|
||||
if (MapleExpeditionType.ARIANT.equals(type) || MapleExpeditionType.ARIANT1.equals(type) || MapleExpeditionType.ARIANT2.equals(type)) {
|
||||
player.changeMap(980010000);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void monsterKilled(MapleCharacter chr, MapleMonster mob) {
|
||||
for (int i = 0; i < EXPEDITION_BOSSES.length; i++) {
|
||||
if (mob.getId() == EXPEDITION_BOSSES[i]) { //If the monster killed was a boss
|
||||
String timeStamp = new SimpleDateFormat("HH:mm:ss").format(new Date());
|
||||
bossLogs.add(">" + mob.getName() + " was killed after " + LogHelper.getTimeString(startTime) + " - " + timeStamp + "\r\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setProperty(String key, String value) {
|
||||
pL.lock();
|
||||
try {
|
||||
props.setProperty(key, value);
|
||||
} finally {
|
||||
pL.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
public String getProperty(String key) {
|
||||
pL.lock();
|
||||
try {
|
||||
return props.getProperty(key);
|
||||
} finally {
|
||||
pL.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
public MapleExpeditionType getType() {
|
||||
return type;
|
||||
@@ -217,6 +309,56 @@ public class MapleExpedition {
|
||||
|
||||
return memberList;
|
||||
}
|
||||
|
||||
public final boolean isExpeditionTeamTogether() {
|
||||
List<MapleCharacter> chars = getActiveMembers();
|
||||
if(chars.size() <= 1) return true;
|
||||
|
||||
Iterator<MapleCharacter> iterator = chars.iterator();
|
||||
MapleCharacter mc = iterator.next();
|
||||
int mapId = mc.getMapId();
|
||||
|
||||
for (; iterator.hasNext();) {
|
||||
mc = iterator.next();
|
||||
if(mc.getMapId() != mapId) return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public final void warpExpeditionTeam(int warpFrom, int warpTo) {
|
||||
List<MapleCharacter> players = getActiveMembers();
|
||||
|
||||
for (MapleCharacter chr : players) {
|
||||
if(chr.getMapId() == warpFrom)
|
||||
chr.changeMap(warpTo);
|
||||
}
|
||||
}
|
||||
|
||||
public final void warpExpeditionTeam(int warpTo) {
|
||||
List<MapleCharacter> players = getActiveMembers();
|
||||
|
||||
for (MapleCharacter chr : players) {
|
||||
chr.changeMap(warpTo);
|
||||
}
|
||||
}
|
||||
|
||||
public final void warpExpeditionTeamToMapSpawnPoint(int warpFrom, int warpTo, int toSp) {
|
||||
List<MapleCharacter> players = getActiveMembers();
|
||||
|
||||
for (MapleCharacter chr : players) {
|
||||
if(chr.getMapId() == warpFrom)
|
||||
chr.changeMap(warpTo, toSp);
|
||||
}
|
||||
}
|
||||
|
||||
public final void warpExpeditionTeamToMapSpawnPoint(int warpTo, int toSp) {
|
||||
List<MapleCharacter> players = getActiveMembers();
|
||||
|
||||
for (MapleCharacter chr : players) {
|
||||
chr.changeMap(warpTo, toSp);
|
||||
}
|
||||
}
|
||||
|
||||
public MapleCharacter getLeader(){
|
||||
return leader;
|
||||
@@ -245,24 +387,7 @@ public class MapleExpedition {
|
||||
public boolean isInProgress(){
|
||||
return !registering;
|
||||
}
|
||||
|
||||
public void ban(Entry<Integer, String> chr) {
|
||||
int cid = chr.getKey();
|
||||
|
||||
if (!banned.contains(cid)) {
|
||||
banned.add(cid);
|
||||
members.remove(cid);
|
||||
|
||||
broadcastExped(MaplePacketCreator.serverNotice(6, "[Expedition] " + chr.getValue() + " has been banned from the expedition."));
|
||||
|
||||
MapleCharacter player = startMap.getWorldServer().getPlayerStorage().getCharacterById(cid);
|
||||
if (player != null && player.isLoggedinWorld()) {
|
||||
player.announce(MaplePacketCreator.removeClock());
|
||||
player.dropMessage(6, "[Expedition] You have been banned from this expedition.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public long getStartTime(){
|
||||
return startTime;
|
||||
}
|
||||
@@ -270,14 +395,4 @@ public class MapleExpedition {
|
||||
public List<String> getBossLogs(){
|
||||
return bossLogs;
|
||||
}
|
||||
|
||||
public void monsterKilled(MapleCharacter chr, MapleMonster mob) {
|
||||
for (int i = 0; i < EXPEDITION_BOSSES.length; i++){
|
||||
if (mob.getId() == EXPEDITION_BOSSES[i]){ //If the monster killed was a boss
|
||||
String timeStamp = new SimpleDateFormat("HH:mm:ss").format(new Date());
|
||||
bossLogs.add(">" + mob.getName() + " was killed after " + LogHelper.getTimeString(startTime) + " - " + timeStamp + "\r\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,6 +39,9 @@ public enum MapleExpeditionType {
|
||||
HORNTAIL(6, 30, 100, 255, 5),
|
||||
CHAOS_ZAKUM(6, 30, 120, 255, 5),
|
||||
CHAOS_HORNTAIL(6, 30, 120, 255, 5),
|
||||
ARIANT(2, 7, 20, 30, 5),
|
||||
ARIANT1(2, 7, 20, 30, 5),
|
||||
ARIANT2(2, 7, 20, 30, 5),
|
||||
PINKBEAN(6, 30, 120, 255, 5),
|
||||
CWKPQ(6, 30, 90, 255, 5); // CWKPQ min-level 90, found thanks to Cato
|
||||
|
||||
|
||||
@@ -22,8 +22,23 @@
|
||||
package server.life;
|
||||
|
||||
public enum Element {
|
||||
NEUTRAL, FIRE, ICE, LIGHTING, POISON, HOLY, DARK;
|
||||
NEUTRAL(0), PHYSICAL(1), FIRE(2, true), ICE(3, true), LIGHTING(4), POISON(5), HOLY(6, true), DARKNESS(7);
|
||||
|
||||
private int value;
|
||||
private boolean special = false;
|
||||
private Element(int v) {
|
||||
this.value = v;
|
||||
}
|
||||
|
||||
private Element(int v, boolean special) {
|
||||
this.value = v;
|
||||
this.special = special;
|
||||
}
|
||||
|
||||
public boolean isSpecial() {
|
||||
return special;
|
||||
}
|
||||
|
||||
public static Element getFromChar(char c) {
|
||||
switch (Character.toUpperCase(c)) {
|
||||
case 'F':
|
||||
@@ -37,10 +52,14 @@ public enum Element {
|
||||
case 'H':
|
||||
return HOLY;
|
||||
case 'D':
|
||||
return DARK;
|
||||
return DARKNESS;
|
||||
case 'P':
|
||||
return NEUTRAL;
|
||||
}
|
||||
throw new IllegalArgumentException("unknown elemnt char " + c);
|
||||
}
|
||||
|
||||
public int getValue() {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,9 +85,9 @@ import server.life.MonsterDropEntry;
|
||||
import server.life.MonsterGlobalDropEntry;
|
||||
import server.life.SpawnPoint;
|
||||
import scripting.event.EventInstanceManager;
|
||||
import server.expeditions.MapleExpedition;
|
||||
import server.expeditions.MapleExpeditionType;
|
||||
import server.life.MaplePlayerNPC;
|
||||
import server.life.MobSkill;
|
||||
import server.life.MobSkillFactory;
|
||||
import server.life.MonsterListener;
|
||||
import server.partyquest.GuardianSpawnPoint;
|
||||
import server.partyquest.MapleCarnivalFactory;
|
||||
@@ -166,6 +166,13 @@ public class MapleMap {
|
||||
private MapleSnowball snowball1 = null;
|
||||
private MapleCoconut coconut;
|
||||
|
||||
//CPQ
|
||||
private int maxMobs;
|
||||
private int maxReactors;
|
||||
private int deathCP;
|
||||
private int timeDefault;
|
||||
private int timeExpand;
|
||||
|
||||
//locks
|
||||
private ReadLock chrRLock;
|
||||
private WriteLock chrWLock;
|
||||
@@ -1009,6 +1016,17 @@ public class MapleMap {
|
||||
}
|
||||
}
|
||||
|
||||
public int getDroppedItemsCountById(int itemid) {
|
||||
int count = 0;
|
||||
for (MapleMapItem mmi : getDroppedItems()) {
|
||||
if (mmi.getItemId() == itemid) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
public void pickItemDrop(byte[] pickupPacket, MapleMapItem mdrop) { // mdrop must be already locked and not-pickedup checked by now
|
||||
broadcastMessage(pickupPacket, mdrop.getPosition());
|
||||
|
||||
@@ -1200,6 +1218,28 @@ public class MapleMap {
|
||||
return getMapObjectsInRange(new Point(0, 0), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.REACTOR));
|
||||
}
|
||||
|
||||
public final List<MapleMapObject> getMonsters() {
|
||||
return getMapObjectsInRange(new Point(0, 0), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.MONSTER));
|
||||
}
|
||||
|
||||
public final List<MapleReactor> getAllReactors() {
|
||||
List<MapleReactor> list = new LinkedList<>();
|
||||
for (MapleMapObject mmo : getReactors()) {
|
||||
list.add((MapleReactor) mmo);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public final List<MapleMonster> getAllMonsters() {
|
||||
List<MapleMonster> list = new LinkedList<>();
|
||||
for (MapleMapObject mmo : getMonsters()) {
|
||||
list.add((MapleMonster) mmo);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public int countItems() {
|
||||
return getMapObjectsInRange(new Point(0, 0), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.ITEM)).size();
|
||||
}
|
||||
@@ -1284,16 +1324,6 @@ public class MapleMap {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public List<MapleMonster> getMonsters() {
|
||||
List<MapleMonster> mobs = new ArrayList<>();
|
||||
for (MapleMapObject object : this.getMapObjects()) {
|
||||
if (object instanceof MapleMonster) {
|
||||
mobs.add((MapleMonster)object);
|
||||
}
|
||||
}
|
||||
return mobs;
|
||||
}
|
||||
|
||||
public void broadcastBalrogVictory(String leaderName) {
|
||||
getWorldServer().dropMessage(6, "[Victory] " + leaderName + "'s party has successfully defeated the Balrog! Praise to them, they finished with " + countAlivePlayers() + " players alive.");
|
||||
@@ -1429,7 +1459,7 @@ public class MapleMap {
|
||||
|
||||
public void killMonster(int mobId) {
|
||||
MapleCharacter chr = (MapleCharacter) getPlayers().get(0);
|
||||
List<MapleMonster> mobList = getMonsters();
|
||||
List<MapleMonster> mobList = getAllMonsters();
|
||||
|
||||
for (MapleMonster mob : mobList) {
|
||||
if (mob.getId() == mobId) {
|
||||
@@ -1443,7 +1473,7 @@ public class MapleMap {
|
||||
|
||||
if(!mapChars.isEmpty()) {
|
||||
MapleCharacter defaultChr = mapChars.entrySet().iterator().next().getValue();
|
||||
List<MapleMonster> mobList = getMonsters();
|
||||
List<MapleMonster> mobList = getAllMonsters();
|
||||
|
||||
for (MapleMonster mob : mobList) {
|
||||
if (mob.getId() == mobId) {
|
||||
@@ -2539,6 +2569,9 @@ public class MapleMap {
|
||||
if (mmd != null) {
|
||||
mmd.registerPlayer(chr);
|
||||
}
|
||||
} else if (GameConstants.isAriantColiseumArena(mapid)) {
|
||||
int pqTimer = (10 * 60 * 1000);
|
||||
chr.announce(MaplePacketCreator.getClock(pqTimer / 1000));
|
||||
}
|
||||
|
||||
MaplePet[] pets = chr.getPets();
|
||||
@@ -2738,13 +2771,13 @@ public class MapleMap {
|
||||
*/
|
||||
|
||||
public void addPlayerPuppet(MapleCharacter player) {
|
||||
for (MapleMonster mm : this.getMonsters()) {
|
||||
for (MapleMonster mm : this.getAllMonsters()) {
|
||||
mm.aggroAddPuppet(player);
|
||||
}
|
||||
}
|
||||
|
||||
public void removePlayerPuppet(MapleCharacter player) {
|
||||
for (MapleMonster mm : this.getMonsters()) {
|
||||
for (MapleMonster mm : this.getAllMonsters()) {
|
||||
mm.aggroRemovePuppet(player);
|
||||
}
|
||||
}
|
||||
@@ -4459,7 +4492,7 @@ public class MapleMap {
|
||||
}
|
||||
|
||||
public void dispose() {
|
||||
for(MapleMonster mm : this.getMonsters()) {
|
||||
for(MapleMonster mm : this.getAllMonsters()) {
|
||||
mm.dispose();
|
||||
}
|
||||
|
||||
@@ -4498,4 +4531,45 @@ public class MapleMap {
|
||||
chrWLock.unlock();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int getMaxMobs() {
|
||||
return maxMobs;
|
||||
}
|
||||
|
||||
public void setMaxMobs(int maxMobs) {
|
||||
this.maxMobs = maxMobs;
|
||||
}
|
||||
|
||||
public int getMaxReactors() {
|
||||
return maxReactors;
|
||||
}
|
||||
|
||||
public void setMaxReactors(int maxReactors) {
|
||||
this.maxReactors = maxReactors;
|
||||
}
|
||||
|
||||
public int getDeathCP() {
|
||||
return deathCP;
|
||||
}
|
||||
|
||||
public void setDeathCP(int deathCP) {
|
||||
this.deathCP = deathCP;
|
||||
}
|
||||
|
||||
public int getTimeDefault() {
|
||||
return timeDefault;
|
||||
}
|
||||
|
||||
public void setTimeDefault(int timeDefault) {
|
||||
this.timeDefault = timeDefault;
|
||||
}
|
||||
|
||||
public int getTimeExpand() {
|
||||
return timeExpand;
|
||||
}
|
||||
|
||||
public void setTimeExpand(int timeExpand) {
|
||||
this.timeExpand = timeExpand;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -94,12 +94,12 @@ public class MapleMapFactory {
|
||||
String type = MapleDataTool.getString(life.getChildByPath("type"));
|
||||
int team = MapleDataTool.getInt("team", life, -1);
|
||||
if (map.isCPQMap2() && type.equals("m")) {
|
||||
if((Integer.parseInt(life.getName()) % 2) == 0) {
|
||||
if ((Integer.parseInt(life.getName()) % 2) == 0) {
|
||||
team = 0;
|
||||
} else {
|
||||
team = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
int cy = MapleDataTool.getInt(life.getChildByPath("cy"));
|
||||
MapleData dF = life.getChildByPath("f");
|
||||
int f = (dF != null) ? MapleDataTool.getInt(dF) : 0;
|
||||
@@ -214,7 +214,7 @@ public class MapleMapFactory {
|
||||
MapleData timeMob = infoData.getChildByPath("timeMob");
|
||||
if (timeMob != null) {
|
||||
map.timeMob(MapleDataTool.getInt(timeMob.getChildByPath("id")),
|
||||
MapleDataTool.getString(timeMob.getChildByPath("message")));
|
||||
MapleDataTool.getString(timeMob.getChildByPath("message")));
|
||||
}
|
||||
|
||||
int bounds[] = new int[4];
|
||||
@@ -315,6 +315,11 @@ public class MapleMapFactory {
|
||||
if (map.isCPQMap()) {
|
||||
MapleData mcData = mapData.getChildByPath("monsterCarnival");
|
||||
if (mcData != null) {
|
||||
map.setDeathCP(MapleDataTool.getIntConvert("deathCP", mcData, 0));
|
||||
map.setMaxMobs(MapleDataTool.getIntConvert("mobGenMax", mcData, 0));
|
||||
map.setTimeDefault(MapleDataTool.getIntConvert("timeDefault", mcData, 0));
|
||||
map.setTimeExpand(MapleDataTool.getIntConvert("timeExpand", mcData, 0));
|
||||
map.setMaxReactors(MapleDataTool.getIntConvert("guardianGenMax", mcData, 0));
|
||||
MapleData guardianGenData = mcData.getChildByPath("guardianGenPos");
|
||||
for (MapleData node : guardianGenData.getChildren()) {
|
||||
GuardianSpawnPoint pt = new GuardianSpawnPoint(new Point(MapleDataTool.getIntConvert("x", node), MapleDataTool.getIntConvert("y", node)));
|
||||
@@ -322,18 +327,19 @@ public class MapleMapFactory {
|
||||
pt.setTaken(false);
|
||||
map.addGuardianSpawnPoint(pt);
|
||||
}
|
||||
}
|
||||
if (mcData.getChildByPath("skill") != null) {
|
||||
for (MapleData area : mcData.getChildByPath("skill")) {
|
||||
map.addSkillId(MapleDataTool.getInt(area));
|
||||
if (mcData.getChildByPath("skill") != null) {
|
||||
for (MapleData area : mcData.getChildByPath("skill")) {
|
||||
map.addSkillId(MapleDataTool.getInt(area));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (mcData.getChildByPath("mob") != null) {
|
||||
for (MapleData area : mcData.getChildByPath("mob")) {
|
||||
map.addMobSpawn(MapleDataTool.getInt(area.getChildByPath("id")), MapleDataTool.getInt(area.getChildByPath("spendCP")));
|
||||
|
||||
if (mcData.getChildByPath("mob") != null) {
|
||||
for (MapleData area : mcData.getChildByPath("mob")) {
|
||||
map.addMobSpawn(MapleDataTool.getInt(area.getChildByPath("id")), MapleDataTool.getInt(area.getChildByPath("spendCP")));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (mapData.getChildByPath("reactor") != null) {
|
||||
|
||||
@@ -0,0 +1,302 @@
|
||||
/*
|
||||
This file is part of the HeavenMS MapleStory Server
|
||||
Copyleft (L) 2016 - 2018 RonanLana
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation version 3 as published by
|
||||
the Free Software Foundation. You may not use, modify or distribute
|
||||
this program under any other version of the GNU Affero General Public
|
||||
License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package server.partyquest;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import client.MapleCharacter;
|
||||
import constants.GameConstants;
|
||||
import server.TimerManager;
|
||||
import server.expeditions.MapleExpedition;
|
||||
import server.expeditions.MapleExpeditionType;
|
||||
import server.maps.MapleMap;
|
||||
import tools.MaplePacketCreator;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Ronan
|
||||
*/
|
||||
public class AriantColiseum {
|
||||
|
||||
private MapleExpedition exped;
|
||||
private MapleMap map;
|
||||
|
||||
private Map<MapleCharacter, Integer> score;
|
||||
private Map<MapleCharacter, Integer> rewardTier;
|
||||
private boolean scoreDirty = false;
|
||||
|
||||
private ScheduledFuture<?> ariantUpdate;
|
||||
private ScheduledFuture<?> ariantFinish;
|
||||
private ScheduledFuture<?> ariantScoreboard;
|
||||
|
||||
private int lostShards = 0;
|
||||
|
||||
private boolean eventClear = false;
|
||||
|
||||
public AriantColiseum(MapleMap eventMap, MapleExpedition expedition) {
|
||||
exped = expedition;
|
||||
exped.finishRegistration();
|
||||
|
||||
map = eventMap;
|
||||
map.resetFully();
|
||||
|
||||
int pqTimer = 10 * 60 * 1000;
|
||||
int pqTimerBoard = (9 * 60 * 1000) + 50 * 1000;
|
||||
|
||||
List<MapleCharacter> players = exped.getActiveMembers();
|
||||
score = new HashMap<>();
|
||||
rewardTier = new HashMap<>();
|
||||
for (MapleCharacter mc : players) {
|
||||
mc.changeMap(map, 0);
|
||||
mc.setAriantColiseum(this);
|
||||
mc.updateAriantScore();
|
||||
rewardTier.put(mc, 0);
|
||||
}
|
||||
|
||||
for (MapleCharacter mc : players) {
|
||||
mc.announce(MaplePacketCreator.updateAriantPQRanking(score));
|
||||
}
|
||||
|
||||
setAriantScoreBoard(TimerManager.getInstance().schedule(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
showArenaResults();
|
||||
}
|
||||
}, pqTimerBoard));
|
||||
|
||||
setArenaFinish(TimerManager.getInstance().schedule(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
enterKingsRoom();
|
||||
}
|
||||
}, pqTimer));
|
||||
|
||||
setArenaUpdate(TimerManager.getInstance().register(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
broadcastAriantScoreUpdate();
|
||||
}
|
||||
}, 500, 500));
|
||||
}
|
||||
|
||||
private void setArenaUpdate(ScheduledFuture<?> ariantUpdate) {
|
||||
this.ariantUpdate = ariantUpdate;
|
||||
}
|
||||
|
||||
private void setArenaFinish(ScheduledFuture<?> arenaFinish) {
|
||||
this.ariantFinish = arenaFinish;
|
||||
}
|
||||
|
||||
private void setAriantScoreBoard(ScheduledFuture<?> ariantScore) {
|
||||
this.ariantScoreboard = ariantScore;
|
||||
}
|
||||
|
||||
private void cancelArenaUpdate() {
|
||||
if (ariantUpdate != null) {
|
||||
ariantUpdate.cancel(true);
|
||||
ariantUpdate = null;
|
||||
}
|
||||
}
|
||||
|
||||
private void cancelArenaFinish() {
|
||||
if (ariantFinish != null) {
|
||||
ariantFinish.cancel(true);
|
||||
ariantFinish = null;
|
||||
}
|
||||
}
|
||||
|
||||
private void cancelAriantScoreBoard() {
|
||||
if (ariantScoreboard != null) {
|
||||
ariantScoreboard.cancel(true);
|
||||
ariantScoreboard = null;
|
||||
}
|
||||
}
|
||||
|
||||
private void cancelAriantSchedules() {
|
||||
cancelArenaUpdate();
|
||||
cancelArenaFinish();
|
||||
cancelAriantScoreBoard();
|
||||
}
|
||||
|
||||
public int getAriantScore(MapleCharacter chr) {
|
||||
Integer chrScore = score.get(chr);
|
||||
return chrScore != null ? chrScore : 0;
|
||||
}
|
||||
|
||||
public void clearAriantScore(MapleCharacter chr) {
|
||||
score.remove(chr);
|
||||
}
|
||||
|
||||
public void updateAriantScore(MapleCharacter chr, int points) {
|
||||
if (map != null) {
|
||||
score.put(chr, points);
|
||||
scoreDirty = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void broadcastAriantScoreUpdate() {
|
||||
if (scoreDirty) {
|
||||
for (MapleCharacter chr : score.keySet()) {
|
||||
chr.announce(MaplePacketCreator.updateAriantPQRanking(score));
|
||||
}
|
||||
scoreDirty = false;
|
||||
}
|
||||
}
|
||||
|
||||
public int getAriantRewardTier(MapleCharacter chr) {
|
||||
Integer reward = rewardTier.get(chr);
|
||||
return reward != null ? reward : 0;
|
||||
}
|
||||
|
||||
public void clearAriantRewardTier(MapleCharacter chr) {
|
||||
rewardTier.remove(chr);
|
||||
}
|
||||
|
||||
public void addLostShards(int quantity) {
|
||||
lostShards += quantity;
|
||||
}
|
||||
|
||||
public void leaveArena(MapleCharacter chr) {
|
||||
if (!(eventClear && GameConstants.isAriantColiseumArena(chr.getMapId()))) {
|
||||
leaveArenaInternal(chr);
|
||||
}
|
||||
}
|
||||
|
||||
private synchronized void leaveArenaInternal(MapleCharacter chr) {
|
||||
if (exped != null) {
|
||||
if (exped.removeMember(chr)) {
|
||||
int minSize = eventClear ? 1 : 2;
|
||||
if (exped.getActiveMembers().size() < minSize) {
|
||||
dispose();
|
||||
}
|
||||
chr.setAriantColiseum(null);
|
||||
|
||||
int shards = chr.countItem(4031868);
|
||||
chr.getClient().getAbstractPlayerInteraction().removeAll(4031868);
|
||||
chr.updateAriantScore(shards);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void playerDisconnected(MapleCharacter chr) {
|
||||
leaveArenaInternal(chr);
|
||||
}
|
||||
|
||||
private void showArenaResults() {
|
||||
eventClear = true;
|
||||
|
||||
if (map != null) {
|
||||
map.broadcastMessage(MaplePacketCreator.showAriantScoreBoard());
|
||||
map.killAllMonsters();
|
||||
|
||||
distributeAriantPoints();
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isUnfairMatch(Integer winnerScore, Integer secondScore, Integer lostShardsScore, List<Integer> runnerupsScore) {
|
||||
if (winnerScore <= 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
double runnerupsScoreCount = 0;
|
||||
for (Integer i : runnerupsScore) {
|
||||
runnerupsScoreCount += i;
|
||||
}
|
||||
|
||||
runnerupsScoreCount += lostShardsScore;
|
||||
secondScore += lostShardsScore;
|
||||
|
||||
double matchRes = runnerupsScoreCount / winnerScore;
|
||||
double runnerupRes = ((double) secondScore) / winnerScore;
|
||||
|
||||
return matchRes < 0.81770726891980117713114871015349 && (runnerupsScoreCount < 7 || runnerupRes < 0.5929);
|
||||
}
|
||||
|
||||
public void distributeAriantPoints() {
|
||||
Integer firstTop = -1, secondTop = -1;
|
||||
MapleCharacter winner = null;
|
||||
List<Integer> runnerups = new ArrayList<>();
|
||||
|
||||
for (Entry<MapleCharacter, Integer> e : score.entrySet()) {
|
||||
Integer s = e.getValue();
|
||||
if (s > firstTop) {
|
||||
secondTop = firstTop;
|
||||
firstTop = s;
|
||||
winner = e.getKey();
|
||||
} else if (s > secondTop) {
|
||||
secondTop = s;
|
||||
}
|
||||
|
||||
runnerups.add(s);
|
||||
rewardTier.put(e.getKey(), (int) Math.floor(s / 10));
|
||||
}
|
||||
|
||||
runnerups.remove(firstTop);
|
||||
if (isUnfairMatch(firstTop, secondTop, map.getDroppedItemsCountById(4031868) + lostShards, runnerups)) {
|
||||
rewardTier.put(winner, 1);
|
||||
}
|
||||
}
|
||||
|
||||
private MapleExpeditionType getExpeditionType() {
|
||||
MapleExpeditionType type;
|
||||
if (map.getId() == 980010101) {
|
||||
type = MapleExpeditionType.ARIANT;
|
||||
} else if (map.getId() == 980010201) {
|
||||
type = MapleExpeditionType.ARIANT1;
|
||||
} else {
|
||||
type = MapleExpeditionType.ARIANT2;
|
||||
}
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
private void enterKingsRoom() {
|
||||
map.getChannelServer().removeExpedition(exped);
|
||||
cancelAriantSchedules();
|
||||
|
||||
for (MapleCharacter chr : map.getAllPlayers()) {
|
||||
chr.changeMap(980010010, 0);
|
||||
}
|
||||
}
|
||||
|
||||
private synchronized void dispose() {
|
||||
if (exped != null) {
|
||||
exped.dispose(false);
|
||||
|
||||
for (MapleCharacter chr : exped.getActiveMembers()) {
|
||||
chr.setAriantColiseum(null);
|
||||
chr.changeMap(980010000, 0);
|
||||
}
|
||||
|
||||
map.getWorldServer().registerTimedMapObject(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
score.clear();
|
||||
exped = null;
|
||||
map = null;
|
||||
}
|
||||
}, 5 * 60 * 1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package server.partyquest;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import client.MapleCharacter;
|
||||
import constants.LanguageConstants;
|
||||
@@ -9,13 +10,15 @@ import net.server.channel.Channel;
|
||||
import net.server.world.MapleParty;
|
||||
import net.server.world.MaplePartyCharacter;
|
||||
import server.TimerManager;
|
||||
import server.life.MapleMonster;
|
||||
import server.maps.MapleMap;
|
||||
import server.maps.MapleMapObject;
|
||||
import server.maps.MapleReactor;
|
||||
import tools.MaplePacketCreator;
|
||||
|
||||
/**
|
||||
* @author Drago/Dragohe4rt
|
||||
*/
|
||||
|
||||
public class MonsterCarnival {
|
||||
|
||||
public static int D = 3;
|
||||
@@ -27,7 +30,7 @@ public class MonsterCarnival {
|
||||
private MapleMap map;
|
||||
private ScheduledFuture<?> timer, effectTimer, respawnTask;
|
||||
private long startTime = 0;
|
||||
private int summonsR = 8, summonsB = 8, room = 0;
|
||||
private int summonsR = 0, summonsB = 0, room = 0;
|
||||
private MapleCharacter leader1, leader2, Grupo1, Grupo2;
|
||||
private int redCP, blueCP, redTotalCP, blueTotalCP, redTimeupCP, blueTimeupCP;
|
||||
private boolean cpq1;
|
||||
@@ -94,13 +97,13 @@ public class MonsterCarnival {
|
||||
public void run() {
|
||||
timeUp();
|
||||
}
|
||||
}, 10 * 60 * 1000);
|
||||
}, (map.getTimeDefault() - 10) * 1000);
|
||||
effectTimer = TimerManager.getInstance().schedule(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
complete();
|
||||
}
|
||||
}, 10 * 60 * 1000 - 10 * 1000);
|
||||
}, map.getTimeDefault() * 1000 - 10 * 1000);
|
||||
respawnTask = TimerManager.getInstance().register(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
@@ -160,20 +163,42 @@ public class MonsterCarnival {
|
||||
dispose(false);
|
||||
}
|
||||
|
||||
public void summonR() {
|
||||
this.summonsR--;
|
||||
}
|
||||
|
||||
public boolean canSummonR() {
|
||||
return this.summonsR > 0;
|
||||
return summonsR < map.getMaxMobs();
|
||||
}
|
||||
|
||||
public void summonB() {
|
||||
this.summonsB--;
|
||||
|
||||
public void summonR() {
|
||||
summonsR++;
|
||||
}
|
||||
|
||||
public boolean canSummonB() {
|
||||
return this.summonsB > 0;
|
||||
return summonsB < map.getMaxMobs();
|
||||
}
|
||||
|
||||
public void summonB() {
|
||||
summonsB++;
|
||||
}
|
||||
|
||||
public boolean canGuardianR() {
|
||||
int teamReactors = 0;
|
||||
for (MapleReactor react : map.getAllReactors()) {
|
||||
if (react.getName().substring(0, 1).contentEquals("0")) {
|
||||
teamReactors += 1;
|
||||
}
|
||||
}
|
||||
|
||||
return teamReactors < map.getMaxReactors();
|
||||
}
|
||||
|
||||
public boolean canGuardianB() {
|
||||
int teamReactors = 0;
|
||||
for (MapleReactor react : map.getAllReactors()) {
|
||||
if (react.getName().substring(0, 1).contentEquals("1")) {
|
||||
teamReactors += 1;
|
||||
}
|
||||
}
|
||||
|
||||
return teamReactors < map.getMaxReactors();
|
||||
}
|
||||
|
||||
protected void dispose(boolean warpout) {
|
||||
@@ -337,13 +362,14 @@ public class MonsterCarnival {
|
||||
public void run() {
|
||||
timeUp();
|
||||
}
|
||||
}, 3 * 60 * 1000);
|
||||
}, map.getTimeExpand() * 1000);
|
||||
effectTimer = TimerManager.getInstance().schedule(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
complete();
|
||||
}
|
||||
}, 3 * 60 * 1000 - 10 * 1000); // thanks Vcoc for noticing a time set issue here
|
||||
|
||||
}, map.getTimeExpand() * 1000 - 10 * 1000); // thanks Vcoc for noticing a time set issue here
|
||||
}
|
||||
|
||||
public void complete() {
|
||||
|
||||
Reference in New Issue
Block a user