After-quest messages & MCPQ patch + Scroll Generator
Fixed an issue within Restore Lost Item functionality. New custom NPC: scroll generator. Trades a scroll for bundles of common miscellaneous items. Revised several lock-acquiring flow scenarios. Fixed pet autopot taking out "negative" amounts from inventory. Added zombify and confuse diseases dispellable by all-cure potions. Patched after-quest messages sometimes allowing player movement, that shouldn't be available until the message box is closed. Reviewed multiclient component, now also evaluating passed HWID alongside remote IP. Fixed missing info about questlines on skillbook announcer NPC after recent updates. Fixed some Aran skills not applying MP consume properly. Cleared a few issues within MCPQ collectable solo/party items and skills. Improved response time on scroll generator by adding a cache for scroll requirements.
This commit is contained in:
@@ -568,9 +568,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
}
|
||||
|
||||
public void setSessionTransitionState() {
|
||||
IoSession session = client.getSession();
|
||||
session.setAttribute(MapleClient.CLIENT_TRANSITION);
|
||||
Server.getInstance().setCharacteridInTransition(session, this.getId());
|
||||
client.setCharacterOnSessionTransitionState(this.getId());
|
||||
}
|
||||
|
||||
public boolean getCS() {
|
||||
@@ -2803,6 +2801,8 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
dispelDebuff(MapleDisease.SEAL);
|
||||
dispelDebuff(MapleDisease.WEAKEN);
|
||||
dispelDebuff(MapleDisease.SLOW);
|
||||
dispelDebuff(MapleDisease.ZOMBIFY);
|
||||
dispelDebuff(MapleDisease.CONFUSE);
|
||||
}
|
||||
|
||||
public void cancelAllDebuffs() {
|
||||
@@ -6792,20 +6792,16 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
MapleInventory cashInv = this.getInventory(MapleInventoryType.CASH);
|
||||
if (cashInv == null) return;
|
||||
|
||||
if (cpnLock.tryLock()) {
|
||||
effLock.lock();
|
||||
chrLock.lock();
|
||||
cashInv.lockInventory();
|
||||
try {
|
||||
revertCouponRates();
|
||||
setCouponRates();
|
||||
} finally {
|
||||
cpnLock.unlock();
|
||||
|
||||
cashInv.unlockInventory();
|
||||
chrLock.unlock();
|
||||
effLock.unlock();
|
||||
}
|
||||
effLock.lock();
|
||||
chrLock.lock();
|
||||
cashInv.lockInventory();
|
||||
try {
|
||||
revertCouponRates();
|
||||
setCouponRates();
|
||||
} finally {
|
||||
cashInv.unlockInventory();
|
||||
chrLock.unlock();
|
||||
effLock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7509,7 +7505,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
}
|
||||
|
||||
public void reloadQuestExpirations() {
|
||||
for(MapleQuestStatus mqs: getQuests()) {
|
||||
for(MapleQuestStatus mqs: getStartedQuests()) {
|
||||
if(mqs.getExpirationTime() > 0) {
|
||||
questTimeLimit2(mqs.getQuest(), mqs.getExpirationTime());
|
||||
}
|
||||
@@ -7690,29 +7686,23 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
}
|
||||
|
||||
public void sitChair(int itemId) {
|
||||
if (client.tryacquireClient()) {
|
||||
try {
|
||||
if (this.isLoggedinWorld()) {
|
||||
if (itemId >= 1000000) { // sit on item chair
|
||||
if (chair.get() < 0) {
|
||||
setChair(itemId);
|
||||
getMap().broadcastMessage(this, MaplePacketCreator.showChair(this.getId(), itemId), false);
|
||||
}
|
||||
announce(MaplePacketCreator.enableActions());
|
||||
} else if (itemId >= 0) { // sit on map chair
|
||||
if (chair.get() < 0) {
|
||||
setChair(itemId);
|
||||
if (registerChairBuff()) {
|
||||
getMap().broadcastMessage(this, MaplePacketCreator.giveForeignChairSkillEffect(this.getId()), false);
|
||||
}
|
||||
announce(MaplePacketCreator.cancelChair(itemId));
|
||||
}
|
||||
} else { // stand up
|
||||
unsitChairInternal();
|
||||
}
|
||||
if (this.isLoggedinWorld()) {
|
||||
if (itemId >= 1000000) { // sit on item chair
|
||||
if (chair.get() < 0) {
|
||||
setChair(itemId);
|
||||
getMap().broadcastMessage(this, MaplePacketCreator.showChair(this.getId(), itemId), false);
|
||||
}
|
||||
} finally {
|
||||
client.releaseClient();
|
||||
announce(MaplePacketCreator.enableActions());
|
||||
} else if (itemId >= 0) { // sit on map chair
|
||||
if (chair.get() < 0) {
|
||||
setChair(itemId);
|
||||
if (registerChairBuff()) {
|
||||
getMap().broadcastMessage(this, MaplePacketCreator.giveForeignChairSkillEffect(this.getId()), false);
|
||||
}
|
||||
announce(MaplePacketCreator.cancelChair(itemId));
|
||||
}
|
||||
} else { // stand up
|
||||
unsitChairInternal();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9974,9 +9964,9 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
awardQuestPoint(YamlConfig.config.server.QUEST_POINT_PER_QUEST_COMPLETE);
|
||||
}
|
||||
qs.setCompleted(qs.getCompleted() + 1); // count quest completed Jayd's idea
|
||||
|
||||
|
||||
announceUpdateQuest(DelayedQuestUpdate.COMPLETE, questid, qs.getCompletionTime());
|
||||
announceUpdateQuest(DelayedQuestUpdate.INFO, qs);
|
||||
//announceUpdateQuest(DelayedQuestUpdate.INFO, qs); // happens after giving rewards, for non-next quests only
|
||||
} else if (qs.getStatus().equals(MapleQuestStatus.Status.NOT_STARTED)) {
|
||||
announceUpdateQuest(DelayedQuestUpdate.UPDATE, qs, false);
|
||||
if (qs.getInfoNumber() > 0) {
|
||||
@@ -9987,19 +9977,9 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
}
|
||||
|
||||
private void expireQuest(MapleQuest quest) {
|
||||
MapleQuestStatus mqs = getQuest(quest);
|
||||
if(mqs.getStatus().equals(MapleQuestStatus.Status.COMPLETED)) {
|
||||
return;
|
||||
if (quest.forfeit(this)) {
|
||||
announce(MaplePacketCreator.questExpire(quest.getId()));
|
||||
}
|
||||
|
||||
if(System.currentTimeMillis() < mqs.getExpirationTime()) {
|
||||
return;
|
||||
}
|
||||
|
||||
announce(MaplePacketCreator.questExpire(quest.getId()));
|
||||
MapleQuestStatus newStatus = new MapleQuestStatus(quest, MapleQuestStatus.Status.NOT_STARTED);
|
||||
newStatus.setForfeited(mqs.getForfeited() + 1);
|
||||
updateQuestStatus(newStatus);
|
||||
}
|
||||
|
||||
public void cancelQuestExpirationTask() {
|
||||
|
||||
@@ -74,7 +74,6 @@ import scripting.quest.QuestScriptManager;
|
||||
import server.life.MapleMonster;
|
||||
import server.ThreadManager;
|
||||
import server.maps.*;
|
||||
import server.quest.MapleQuest;
|
||||
|
||||
import net.server.audit.locks.MonitoredLockType;
|
||||
import net.server.audit.locks.factory.MonitoredReentrantLockFactory;
|
||||
@@ -997,14 +996,9 @@ public class MapleClient {
|
||||
family.
|
||||
}
|
||||
*/
|
||||
for (MapleQuestStatus status : player.getStartedQuests()) { //This is for those quests that you have to stay logged in for a certain amount of time
|
||||
MapleQuest quest = status.getQuest();
|
||||
if (quest.getTimeLimit() > 0) {
|
||||
MapleQuestStatus newStatus = new MapleQuestStatus(quest, MapleQuestStatus.Status.NOT_STARTED);
|
||||
newStatus.setForfeited(player.getQuest(quest).getForfeited() + 1);
|
||||
player.updateQuestStatus(newStatus);
|
||||
}
|
||||
}
|
||||
|
||||
player.forfeitExpirableQuests(); //This is for those quests that you have to stay logged in for a certain amount of time
|
||||
|
||||
if (guild != null) {
|
||||
final Server server = Server.getInstance();
|
||||
server.setGuildMemberOnline(player, false, player.getClient().getChannel());
|
||||
@@ -1059,7 +1053,8 @@ public class MapleClient {
|
||||
MapleSessionCoordinator.getInstance().closeSession(session, false);
|
||||
session.removeAttribute(MapleClient.CLIENT_KEY);
|
||||
}
|
||||
if (!Server.getInstance().hasCharacteridInTransition(session)) {
|
||||
|
||||
if (!Server.getInstance().hasCharacteridInTransition(this)) {
|
||||
updateLoginState(MapleClient.LOGIN_NOTLOGGEDIN);
|
||||
}
|
||||
|
||||
@@ -1085,6 +1080,12 @@ public class MapleClient {
|
||||
this.send = null;
|
||||
//this.session = null;
|
||||
}
|
||||
|
||||
public void setCharacterOnSessionTransitionState(int cid) {
|
||||
this.updateLoginState(MapleClient.LOGIN_SERVER_TRANSITION);
|
||||
session.setAttribute(MapleClient.CLIENT_TRANSITION);
|
||||
Server.getInstance().setCharacteridInTransition(this, cid);
|
||||
}
|
||||
|
||||
public int getChannel() {
|
||||
return channel;
|
||||
@@ -1544,8 +1545,7 @@ public class MapleClient {
|
||||
|
||||
player.saveCharToDB();
|
||||
|
||||
player.getClient().updateLoginState(MapleClient.LOGIN_SERVER_TRANSITION);
|
||||
player.setSessionTransitionState();
|
||||
player.setSessionTransitionState();
|
||||
try {
|
||||
announce(MaplePacketCreator.getChannelChange(InetAddress.getByName(socket[0]), Integer.parseInt(socket[1])));
|
||||
} catch (IOException e) {
|
||||
|
||||
@@ -29,6 +29,7 @@ import java.util.Collections;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.locks.Lock;
|
||||
import java.util.concurrent.Semaphore;
|
||||
@@ -46,10 +47,10 @@ public final class MonsterBook {
|
||||
private Map<Integer, Integer> cards = new LinkedHashMap<>();
|
||||
private Lock lock = MonitoredReentrantLockFactory.createLock(MonitoredLockType.BOOK);
|
||||
|
||||
private Set<Entry<Integer, Integer>> getCardSet() {
|
||||
public Set<Entry<Integer, Integer>> getCardSet() {
|
||||
lock.lock();
|
||||
try {
|
||||
return Collections.unmodifiableSet(cards.entrySet());
|
||||
return new HashSet<>(cards.entrySet());
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
@@ -242,4 +243,29 @@ public final class MonsterBook {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static int[] getCardTierSize() {
|
||||
try {
|
||||
Connection con = DatabaseConnection.getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("SELECT COUNT(*) FROM monstercarddata GROUP BY floor(cardid / 1000);");
|
||||
ResultSet rs = ps.executeQuery();
|
||||
|
||||
rs.last();
|
||||
int[] tierSizes = new int[rs.getRow()];
|
||||
rs.beforeFirst();
|
||||
|
||||
while (rs.next()) {
|
||||
tierSizes[rs.getRow() - 1] = rs.getInt(1);
|
||||
}
|
||||
|
||||
rs.close();
|
||||
ps.close();
|
||||
con.close();
|
||||
|
||||
return tierSizes;
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
return new int[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,7 +52,6 @@ public class WarpWorldCommand extends Command {
|
||||
String[] socket = server.getInetSocket(worldb, c.getChannel());
|
||||
c.getWorldServer().removePlayer(player);
|
||||
player.getMap().removePlayer(player);//LOL FORGOT THIS ><
|
||||
c.updateLoginState(MapleClient.LOGIN_SERVER_TRANSITION);
|
||||
player.setSessionTransitionState();
|
||||
player.setWorld(worldb);
|
||||
player.saveCharToDB();//To set the new world :O (true because else 2 player instances are created, one in both worlds)
|
||||
|
||||
@@ -72,21 +72,12 @@ public class MapleInventoryManipulator {
|
||||
MapleCharacter chr = c.getPlayer();
|
||||
MapleInventoryType type = ItemConstants.getInventoryType(itemId);
|
||||
|
||||
if (c.tryacquireClient()) {
|
||||
try {
|
||||
MapleInventory inv = chr.getInventory(type);
|
||||
inv.lockInventory();
|
||||
try {
|
||||
return addByIdInternal(c, chr, type, inv, itemId, quantity, owner, petid, flag, expiration);
|
||||
} finally {
|
||||
inv.unlockInventory();
|
||||
}
|
||||
} finally {
|
||||
c.releaseClient();
|
||||
}
|
||||
} else {
|
||||
c.announce(MaplePacketCreator.enableActions());
|
||||
return false;
|
||||
MapleInventory inv = chr.getInventory(type);
|
||||
inv.lockInventory();
|
||||
try {
|
||||
return addByIdInternal(c, chr, type, inv, itemId, quantity, owner, petid, flag, expiration);
|
||||
} finally {
|
||||
inv.unlockInventory();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -187,21 +178,12 @@ public class MapleInventoryManipulator {
|
||||
MapleCharacter chr = c.getPlayer();
|
||||
MapleInventoryType type = item.getInventoryType();
|
||||
|
||||
if (c.tryacquireClient()) {
|
||||
try {
|
||||
MapleInventory inv = chr.getInventory(type);
|
||||
inv.lockInventory();
|
||||
try {
|
||||
return addFromDropInternal(c, chr, type, inv, item, show, petId);
|
||||
} finally {
|
||||
inv.unlockInventory();
|
||||
}
|
||||
} finally {
|
||||
c.releaseClient();
|
||||
}
|
||||
} else {
|
||||
c.announce(MaplePacketCreator.enableActions());
|
||||
return false;
|
||||
MapleInventory inv = chr.getInventory(type);
|
||||
inv.lockInventory();
|
||||
try {
|
||||
return addFromDropInternal(c, chr, type, inv, item, show, petId);
|
||||
} finally {
|
||||
inv.unlockInventory();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -88,6 +88,12 @@ public class PetAutopotProcessor {
|
||||
|
||||
int useCount = 0, qtyCount = 0;
|
||||
MapleStatEffect stat = null;
|
||||
|
||||
maxHp = chr.getCurrentMaxHp();
|
||||
maxMp = chr.getCurrentMaxMp();
|
||||
|
||||
curHp = chr.getHp();
|
||||
curMp = chr.getMp();
|
||||
|
||||
MapleInventory useInv = chr.getInventory(MapleInventoryType.USE);
|
||||
useInv.lockInventory();
|
||||
@@ -112,13 +118,7 @@ public class PetAutopotProcessor {
|
||||
stat = MapleItemInformationProvider.getInstance().getItemEffect(toUse.getItemId());
|
||||
hasHpGain = stat.getHp() > 0 || stat.getHpRate() > 0.0;
|
||||
hasMpGain = stat.getMp() > 0 || stat.getMpRate() > 0.0;
|
||||
|
||||
maxHp = chr.getCurrentMaxHp();
|
||||
maxMp = chr.getCurrentMaxMp();
|
||||
|
||||
curHp = chr.getHp();
|
||||
curMp = chr.getMp();
|
||||
|
||||
|
||||
incHp = stat.getHp();
|
||||
if(incHp <= 0 && hasHpGain) incHp = Math.ceil(maxHp * stat.getHpRate());
|
||||
|
||||
@@ -127,11 +127,21 @@ public class PetAutopotProcessor {
|
||||
|
||||
if (YamlConfig.config.server.USE_COMPULSORY_AUTOPOT) {
|
||||
if (hasHpGain) {
|
||||
qtyCount = (int) Math.ceil(((YamlConfig.config.server.PET_AUTOHP_RATIO * maxHp) - curHp) / incHp);
|
||||
double hpRatio = (YamlConfig.config.server.PET_AUTOHP_RATIO * maxHp) - curHp;
|
||||
if (hpRatio > 0.0) {
|
||||
qtyCount = (int) Math.ceil(hpRatio / incHp);
|
||||
}
|
||||
}
|
||||
|
||||
if (hasMpGain) {
|
||||
qtyCount = Math.max(qtyCount, (int) Math.ceil(((YamlConfig.config.server.PET_AUTOMP_RATIO * maxMp) - curMp) / incMp));
|
||||
double mpRatio = ((YamlConfig.config.server.PET_AUTOMP_RATIO * maxMp) - curMp);
|
||||
if (mpRatio > 0.0) {
|
||||
qtyCount = Math.max(qtyCount, (int) Math.ceil(mpRatio / incMp));
|
||||
}
|
||||
}
|
||||
|
||||
if (qtyCount < 0) { // thanks Flint, Kevs for noticing an issue where negative counts were getting achieved
|
||||
qtyCount = 0;
|
||||
}
|
||||
} else {
|
||||
qtyCount = 1; // non-compulsory autopot concept thanks to marcuswoon
|
||||
@@ -162,8 +172,10 @@ public class PetAutopotProcessor {
|
||||
useInv.unlockInventory();
|
||||
}
|
||||
|
||||
for (int i = 0; i < useCount; i++) {
|
||||
stat.applyTo(chr);
|
||||
if (stat != null) {
|
||||
for (int i = 0; i < useCount; i++) {
|
||||
stat.applyTo(chr);
|
||||
}
|
||||
}
|
||||
|
||||
chr.announce(MaplePacketCreator.enableActions());
|
||||
|
||||
@@ -348,14 +348,7 @@ public class AssignAPProcessor {
|
||||
if(slea.available() < 16) {
|
||||
AutobanFactory.PACKET_EDIT.alert(chr, "Didn't send full packet for Auto Assign.");
|
||||
|
||||
final MapleClient client = c;
|
||||
ThreadManager.getInstance().newTask(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
client.disconnect(false, false);
|
||||
}
|
||||
});
|
||||
|
||||
c.disconnect(true, false);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -51,14 +51,7 @@ public class AssignSPProcessor {
|
||||
AutobanFactory.PACKET_EDIT.alert(player, "tried to packet edit in distributing sp.");
|
||||
FilePrinter.printError(FilePrinter.EXPLOITS + c.getPlayer().getName() + ".txt", c.getPlayer().getName() + " tried to use skill " + skillid + " without it being in their job.");
|
||||
|
||||
final MapleClient client = c;
|
||||
ThreadManager.getInstance().newTask(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
client.disconnect(true, false);
|
||||
}
|
||||
});
|
||||
|
||||
c.disconnect(true, false);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -187,7 +187,7 @@ public class ServerConfig {
|
||||
public boolean USE_ENHANCED_CHSCROLL;
|
||||
public boolean USE_ENHANCED_CRAFTING;
|
||||
public boolean USE_ENHANCED_CLNSLATE;
|
||||
public int SCROLL_CHANCE_RATE;
|
||||
public int SCROLL_CHANCE_ROLLS;
|
||||
public int CHSCROLL_STAT_RATE;
|
||||
public int CHSCROLL_STAT_RANGE;
|
||||
|
||||
|
||||
@@ -490,18 +490,6 @@ public class GameConstants {
|
||||
}
|
||||
}
|
||||
|
||||
public static int getHiddenSkill(final int skill) {
|
||||
switch (skill) {
|
||||
case Aran.HIDDEN_FULL_DOUBLE:
|
||||
case Aran.HIDDEN_FULL_TRIPLE:
|
||||
return Aran.FULL_SWING;
|
||||
case Aran.HIDDEN_OVER_DOUBLE:
|
||||
case Aran.HIDDEN_OVER_TRIPLE:
|
||||
return Aran.OVER_SWING;
|
||||
}
|
||||
return skill;
|
||||
}
|
||||
|
||||
public static int getSkillBook(final int job) {
|
||||
if (job >= 2210 && job <= 2218) {
|
||||
return job - 2209;
|
||||
|
||||
@@ -170,11 +170,11 @@ public final class ItemConstants {
|
||||
}
|
||||
|
||||
public static boolean isPartyItem(int itemId) {
|
||||
return itemId >= 2022430 && itemId <= 2022433;
|
||||
return itemId >= 2022430 && itemId <= 2022433 || itemId >= 2022160 && itemId <= 2022163;
|
||||
}
|
||||
|
||||
public static boolean isPartyAllcure(int itemId) {
|
||||
return itemId == 2022433;
|
||||
return itemId == 2022433 || itemId == 2022163;
|
||||
}
|
||||
|
||||
public static boolean isHiredMerchant(int itemId) {
|
||||
|
||||
@@ -242,14 +242,14 @@ public class MapleServerHandler extends IoHandlerAdapter {
|
||||
long timeNow = Server.getInstance().getCurrentTime();
|
||||
long timeThen = timeNow - 15000;
|
||||
|
||||
Set<MapleClient> pingClients = new HashSet<>();
|
||||
idleLock.lock();
|
||||
try {
|
||||
for(Entry<MapleClient, Long> mc : idleSessions.entrySet()) {
|
||||
if(timeNow - mc.getValue() >= 15000) {
|
||||
mc.getKey().testPing(timeThen);
|
||||
pingClients.add(mc.getKey());
|
||||
}
|
||||
}
|
||||
|
||||
idleSessions.clear();
|
||||
|
||||
if(!tempIdleSessions.isEmpty()) {
|
||||
@@ -267,6 +267,10 @@ public class MapleServerHandler extends IoHandlerAdapter {
|
||||
} finally {
|
||||
idleLock.unlock();
|
||||
}
|
||||
|
||||
for(MapleClient c : pingClients) {
|
||||
c.testPing(timeThen);
|
||||
}
|
||||
}
|
||||
|
||||
private void idleManagerTask() {
|
||||
|
||||
@@ -33,7 +33,6 @@ import tools.HexTool;
|
||||
import tools.MapleAESOFB;
|
||||
import tools.data.input.ByteArrayByteStream;
|
||||
import tools.data.input.GenericLittleEndianAccessor;
|
||||
import net.opcodes.RecvOpcode;
|
||||
import tools.FilePrinter;
|
||||
|
||||
public class MaplePacketDecoder extends CumulativeProtocolDecoder {
|
||||
|
||||
@@ -106,7 +106,6 @@ import tools.AutoJCE;
|
||||
import tools.DatabaseConnection;
|
||||
import tools.FilePrinter;
|
||||
import tools.Pair;
|
||||
import org.apache.mina.core.session.IoSession;
|
||||
|
||||
public class Server {
|
||||
|
||||
@@ -1730,12 +1729,12 @@ public class Server {
|
||||
}
|
||||
}
|
||||
|
||||
private static String getRemoteIp(IoSession session) {
|
||||
return MapleSessionCoordinator.getSessionRemoteAddress(session);
|
||||
private static String getRemoteHost(MapleClient client) {
|
||||
return MapleSessionCoordinator.getSessionRemoteHost(client.getSession());
|
||||
}
|
||||
|
||||
public void setCharacteridInTransition(IoSession session, int charId) {
|
||||
String remoteIp = getRemoteIp(session);
|
||||
public void setCharacteridInTransition(MapleClient client, int charId) {
|
||||
String remoteIp = getRemoteHost(client);
|
||||
|
||||
lgnWLock.lock();
|
||||
try {
|
||||
@@ -1745,12 +1744,12 @@ public class Server {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean validateCharacteridInTransition(IoSession session, int charId) {
|
||||
public boolean validateCharacteridInTransition(MapleClient client, int charId) {
|
||||
if (!YamlConfig.config.server.USE_IP_VALIDATION) {
|
||||
return true;
|
||||
}
|
||||
|
||||
String remoteIp = getRemoteIp(session);
|
||||
String remoteIp = getRemoteHost(client);
|
||||
|
||||
lgnWLock.lock();
|
||||
try {
|
||||
@@ -1761,12 +1760,12 @@ public class Server {
|
||||
}
|
||||
}
|
||||
|
||||
public Integer freeCharacteridInTransition(IoSession session) {
|
||||
public Integer freeCharacteridInTransition(MapleClient client) {
|
||||
if (!YamlConfig.config.server.USE_IP_VALIDATION) {
|
||||
return null;
|
||||
}
|
||||
|
||||
String remoteIp = getRemoteIp(session);
|
||||
String remoteIp = getRemoteHost(client);
|
||||
|
||||
lgnWLock.lock();
|
||||
try {
|
||||
@@ -1776,13 +1775,13 @@ public class Server {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean hasCharacteridInTransition(IoSession session) {
|
||||
public boolean hasCharacteridInTransition(MapleClient client) {
|
||||
if (!YamlConfig.config.server.USE_IP_VALIDATION) {
|
||||
return true;
|
||||
}
|
||||
|
||||
String remoteIp = getRemoteIp(session);
|
||||
|
||||
String remoteIp = getRemoteHost(client);
|
||||
|
||||
lgnRLock.lock();
|
||||
try {
|
||||
return transitioningChars.containsKey(remoteIp);
|
||||
|
||||
@@ -375,7 +375,7 @@ public final class Channel {
|
||||
for (Integer cid : playersAway) {
|
||||
MapleCharacter chr = wserv.getPlayerStorage().getCharacterById(cid);
|
||||
if (chr != null && chr.isLoggedin()) {
|
||||
chr.getClient().disconnect(true, false);
|
||||
chr.getClient().forceDisconnect();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -113,10 +113,11 @@ public abstract class AbstractDealDamageHandler extends AbstractMaplePacketHandl
|
||||
public boolean ranged, magic;
|
||||
public int speed = 4;
|
||||
public Point position = new Point();
|
||||
|
||||
public MapleStatEffect getAttackEffect(MapleCharacter chr, Skill theSkill) {
|
||||
Skill mySkill = theSkill;
|
||||
if (mySkill == null) {
|
||||
mySkill = SkillFactory.getSkill(GameConstants.getHiddenSkill(skill));
|
||||
mySkill = SkillFactory.getSkill(skill);
|
||||
}
|
||||
|
||||
int skillLevel = chr.getSkillLevel(mySkill);
|
||||
@@ -149,8 +150,8 @@ public abstract class AbstractDealDamageHandler extends AbstractMaplePacketHandl
|
||||
return;
|
||||
}
|
||||
if (attack.skill != 0) {
|
||||
theSkill = SkillFactory.getSkill(GameConstants.getHiddenSkill(attack.skill)); //returns back the skill id if its not a hidden skill so we are gucci
|
||||
attackEffect = attack.getAttackEffect(player, theSkill);
|
||||
theSkill = SkillFactory.getSkill(attack.skill); // thanks Conrad for noticing some Aran skills not consuming MP
|
||||
attackEffect = attack.getAttackEffect(player, theSkill); //returns back the player's attack effect so we are gucci
|
||||
if (attackEffect == null) {
|
||||
player.announce(MaplePacketCreator.enableActions());
|
||||
return;
|
||||
|
||||
@@ -37,6 +37,12 @@ public final class CancelChairHandler extends AbstractMaplePacketHandler {
|
||||
return;
|
||||
}
|
||||
|
||||
mc.sitChair(id);
|
||||
if (c.tryacquireClient()) {
|
||||
try {
|
||||
mc.sitChair(id);
|
||||
} finally {
|
||||
c.releaseClient();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,7 +40,6 @@ import server.CashShop;
|
||||
import server.CashShop.CashItem;
|
||||
import server.CashShop.CashItemFactory;
|
||||
import client.inventory.manipulator.MapleInventoryManipulator;
|
||||
import constants.net.ServerConstants;
|
||||
import server.MapleItemInformationProvider;
|
||||
import tools.FilePrinter;
|
||||
import tools.MaplePacketCreator;
|
||||
|
||||
@@ -62,7 +62,6 @@ public final class ChangeMapHandler extends AbstractMaplePacketHandler {
|
||||
String[] socket = c.getChannelServer().getIP().split(":");
|
||||
chr.getCashShop().open(false);
|
||||
|
||||
c.updateLoginState(MapleClient.LOGIN_SERVER_TRANSITION);
|
||||
chr.setSessionTransitionState();
|
||||
try {
|
||||
c.announce(MaplePacketCreator.getChannelChange(InetAddress.getByName(socket[0]), Integer.parseInt(socket[1])));
|
||||
|
||||
@@ -126,13 +126,7 @@ public final class PlayerLoggedinHandler extends AbstractMaplePacketHandler {
|
||||
}
|
||||
|
||||
MapleCharacter player = wserv.getPlayerStorage().getCharacterById(cid);
|
||||
boolean newcomer = false;
|
||||
|
||||
IoSession session = c.getSession();
|
||||
if (!server.validateCharacteridInTransition(session, cid)) {
|
||||
c.disconnect(true, false);
|
||||
return;
|
||||
}
|
||||
|
||||
String remoteHwid;
|
||||
if (player == null) {
|
||||
@@ -141,25 +135,37 @@ public final class PlayerLoggedinHandler extends AbstractMaplePacketHandler {
|
||||
c.disconnect(true, false);
|
||||
return;
|
||||
}
|
||||
|
||||
} else {
|
||||
remoteHwid = player.getClient().getHWID();
|
||||
}
|
||||
|
||||
int hwidLen = remoteHwid.length();
|
||||
session.setAttribute(MapleClient.CLIENT_HWID, remoteHwid);
|
||||
session.setAttribute(MapleClient.CLIENT_NIBBLEHWID, remoteHwid.substring(hwidLen - 8, hwidLen));
|
||||
c.setHWID(remoteHwid);
|
||||
|
||||
if (!server.validateCharacteridInTransition(c, cid)) {
|
||||
c.disconnect(true, false);
|
||||
return;
|
||||
}
|
||||
|
||||
boolean newcomer = false;
|
||||
if (player == null) {
|
||||
try {
|
||||
player = MapleCharacter.loadCharFromDB(cid, c, true);
|
||||
newcomer = true;
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
remoteHwid = player.getClient().getHWID();
|
||||
|
||||
if (player == null) { //If you are still getting null here then please just uninstall the game >.>, we dont need you fucking with the logs
|
||||
c.disconnect(true, false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (player == null) { //If you are still getting null here then please just uninstall the game >.>, we dont need you fucking with the logs
|
||||
c.disconnect(true, false);
|
||||
return;
|
||||
}
|
||||
|
||||
c.setPlayer(player);
|
||||
c.setAccID(player.getAccountID());
|
||||
|
||||
|
||||
boolean allowLogin = true;
|
||||
|
||||
/* is this check really necessary?
|
||||
@@ -211,11 +217,6 @@ public final class PlayerLoggedinHandler extends AbstractMaplePacketHandler {
|
||||
player.newClient(c);
|
||||
}
|
||||
|
||||
int hwidLen = remoteHwid.length();
|
||||
session.setAttribute(MapleClient.CLIENT_HWID, remoteHwid);
|
||||
session.setAttribute(MapleClient.CLIENT_NIBBLEHWID, remoteHwid.substring(hwidLen - 8, hwidLen));
|
||||
c.setHWID(remoteHwid);
|
||||
|
||||
cserv.addPlayer(player);
|
||||
wserv.addPlayer(player);
|
||||
player.setEnteredChannelWorld();
|
||||
@@ -386,7 +387,7 @@ public final class PlayerLoggedinHandler extends AbstractMaplePacketHandler {
|
||||
player.announceBattleshipHp();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
player.buffExpireTask();
|
||||
player.diseaseExpireTask();
|
||||
player.skillCooldownTask();
|
||||
|
||||
@@ -33,7 +33,6 @@ import client.MapleCharacter;
|
||||
import client.MapleClient;
|
||||
import client.Skill;
|
||||
import client.SkillFactory;
|
||||
import constants.net.ServerConstants;
|
||||
import constants.skills.Brawler;
|
||||
import constants.skills.Corsair;
|
||||
import constants.skills.DarkKnight;
|
||||
|
||||
@@ -635,11 +635,11 @@ public final class UseCashItemHandler extends AbstractMaplePacketHandler {
|
||||
position = it.getPosition();
|
||||
}
|
||||
}
|
||||
|
||||
MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.CASH, position, (short) 1, true, false);
|
||||
} finally {
|
||||
cashInv.unlockInventory();
|
||||
}
|
||||
|
||||
MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.CASH, position, (short) 1, true, false);
|
||||
}
|
||||
|
||||
private static boolean getIncubatedItem(MapleClient c, int id) {
|
||||
|
||||
@@ -37,6 +37,12 @@ public final class UseChairHandler extends AbstractMaplePacketHandler {
|
||||
return;
|
||||
}
|
||||
|
||||
c.getPlayer().sitChair(itemId);
|
||||
if (c.tryacquireClient()) {
|
||||
try {
|
||||
c.getPlayer().sitChair(itemId);
|
||||
} finally {
|
||||
c.releaseClient();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ public final class UseItemHandler extends AbstractMaplePacketHandler {
|
||||
int itemId = slea.readInt();
|
||||
Item toUse = chr.getInventory(MapleInventoryType.USE).getItem(slot);
|
||||
if (toUse != null && toUse.getQuantity() > 0 && toUse.getItemId() == itemId) {
|
||||
if (itemId == 2022178 || itemId == 2050004) {
|
||||
if (itemId == 2050004) {
|
||||
chr.dispelDebuffs();
|
||||
remove(c, slot);
|
||||
return;
|
||||
|
||||
@@ -31,7 +31,6 @@ import constants.game.ExpTable;
|
||||
import net.AbstractMaplePacketHandler;
|
||||
import client.inventory.manipulator.MapleInventoryManipulator;
|
||||
import tools.MaplePacketCreator;
|
||||
import tools.Pair;
|
||||
import tools.data.input.SeekableLittleEndianAccessor;
|
||||
|
||||
/**
|
||||
|
||||
@@ -58,20 +58,18 @@ public final class WeddingHandler extends AbstractMaplePacketHandler {
|
||||
MapleInventoryType type = ItemConstants.getInventoryType(itemid);
|
||||
MapleInventory chrInv = chr.getInventory(type);
|
||||
|
||||
Item newItem = null;
|
||||
chrInv.lockInventory();
|
||||
try {
|
||||
Item item = chrInv.getItem((byte) slot);
|
||||
if (item != null) {
|
||||
if (!item.isUntradeable()) {
|
||||
if (itemid == item.getItemId() && quantity <= item.getQuantity()) {
|
||||
Item newItem = item.copy();
|
||||
newItem = item.copy();
|
||||
|
||||
marriage.addGiftItem(groomWishlist, newItem);
|
||||
MapleInventoryManipulator.removeFromSlot(c, type, slot, quantity, false, false);
|
||||
|
||||
if (YamlConfig.config.server.USE_ENFORCE_MERCHANT_SAVE) chr.saveCharToDB(false);
|
||||
marriage.saveGiftItemsToDb(c, groomWishlist, cid);
|
||||
|
||||
|
||||
MapleKarmaManipulator.toggleKarmaFlagToUntradeable(newItem);
|
||||
marriage.setIntProperty(groomWishlistProp, giftCount + 1);
|
||||
|
||||
@@ -84,6 +82,11 @@ public final class WeddingHandler extends AbstractMaplePacketHandler {
|
||||
} finally {
|
||||
chrInv.unlockInventory();
|
||||
}
|
||||
|
||||
if (newItem != null) {
|
||||
if (YamlConfig.config.server.USE_ENFORCE_MERCHANT_SAVE) chr.saveCharToDB(false);
|
||||
marriage.saveGiftItemsToDb(c, groomWishlist, cid);
|
||||
}
|
||||
} else {
|
||||
c.announce(Wedding.OnWeddingGiftResult((byte) 0xE, marriage.getWishlistItems(groomWishlist), null));
|
||||
}
|
||||
|
||||
@@ -22,7 +22,6 @@ package net.server.coordinator.matchchecker;
|
||||
import client.MapleCharacter;
|
||||
import net.server.PlayerStorage;
|
||||
import net.server.Server;
|
||||
import net.server.coordinator.matchchecker.AbstractMatchCheckerListener;
|
||||
import net.server.coordinator.matchchecker.MatchCheckerListenerFactory.MatchCheckerType;
|
||||
import net.server.world.World;
|
||||
import java.util.Collections;
|
||||
@@ -260,19 +259,19 @@ public class MapleMatchCheckerCoordinator {
|
||||
}
|
||||
}
|
||||
|
||||
private void createMatchConfirmationInternal(MatchCheckerType matchType, int world, int leaderCid, AbstractMatchCheckerListener leaderListener, Set<Integer> players, String message) {
|
||||
private MapleMatchCheckingElement createMatchConfirmationInternal(MatchCheckerType matchType, int world, int leaderCid, AbstractMatchCheckerListener leaderListener, Set<Integer> players, String message) {
|
||||
MapleMatchCheckingElement mmce = new MapleMatchCheckingElement(matchType, leaderCid, world, leaderListener, players, message);
|
||||
|
||||
for (Integer cid : players) {
|
||||
matchEntries.put(cid, mmce);
|
||||
}
|
||||
|
||||
mmce.dispatchMatchCreated();
|
||||
|
||||
acceptMatchElement(mmce, leaderCid);
|
||||
return mmce;
|
||||
}
|
||||
|
||||
public boolean createMatchConfirmation(MatchCheckerType matchType, int world, int leaderCid, Set<Integer> players, String message) {
|
||||
MapleMatchCheckingElement mmce = null;
|
||||
try {
|
||||
semaphorePool.acquire();
|
||||
try {
|
||||
@@ -280,8 +279,7 @@ public class MapleMatchCheckerCoordinator {
|
||||
try {
|
||||
if (isMatchingAvailable(players)) {
|
||||
AbstractMatchCheckerListener leaderListener = matchType.getListener();
|
||||
createMatchConfirmationInternal(matchType, world, leaderCid, leaderListener, players, message);
|
||||
return true;
|
||||
mmce = createMatchConfirmationInternal(matchType, world, leaderCid, leaderListener, players, message);
|
||||
} else {
|
||||
reenablePlayerMatching(players);
|
||||
}
|
||||
@@ -296,7 +294,12 @@ public class MapleMatchCheckerCoordinator {
|
||||
ie.printStackTrace();
|
||||
}
|
||||
|
||||
return false;
|
||||
if (mmce != null) {
|
||||
mmce.dispatchMatchCreated();
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private void disposeMatchElement(MapleMatchCheckingElement mmce) {
|
||||
@@ -320,16 +323,12 @@ public class MapleMatchCheckerCoordinator {
|
||||
if (mmce.acceptEntry(cid)) {
|
||||
unpoolMatchPlayer(cid);
|
||||
disposeMatchElement(mmce);
|
||||
|
||||
mmce.dispatchMatchResult(true);
|
||||
}
|
||||
}
|
||||
|
||||
private void denyMatchElement(MapleMatchCheckingElement mmce, int cid) {
|
||||
unpoolMatchPlayer(cid);
|
||||
disposeMatchElement(mmce);
|
||||
|
||||
mmce.dispatchMatchResult(false);
|
||||
}
|
||||
|
||||
private void dismissMatchElement(MapleMatchCheckingElement mmce, int cid) {
|
||||
@@ -337,35 +336,32 @@ public class MapleMatchCheckerCoordinator {
|
||||
|
||||
unpoolMatchPlayer(cid);
|
||||
disposeMatchElement(mmce);
|
||||
|
||||
mmce.dispatchMatchDismissed();
|
||||
}
|
||||
|
||||
public boolean answerMatchConfirmation(int cid, boolean accept) {
|
||||
MapleMatchCheckingElement mmce = null;
|
||||
try {
|
||||
semaphorePool.acquire();
|
||||
try {
|
||||
while (matchEntries.containsKey(cid)) {
|
||||
if (poolMatchPlayer(cid)) {
|
||||
try {
|
||||
MapleMatchCheckingElement mmce = matchEntries.get(cid);
|
||||
mmce = matchEntries.get(cid);
|
||||
|
||||
if (mmce != null) {
|
||||
synchronized (mmce) {
|
||||
if (!mmce.isMatchActive()) { // thanks Alex (CanIGetaPR) for noticing that exploiters could stall on match checking
|
||||
matchEntries.remove(cid);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (accept) {
|
||||
acceptMatchElement(mmce, cid);
|
||||
mmce = null;
|
||||
} else {
|
||||
denyMatchElement(mmce, cid);
|
||||
matchEntries.remove(cid);
|
||||
if (accept) {
|
||||
acceptMatchElement(mmce, cid);
|
||||
} else {
|
||||
denyMatchElement(mmce, cid);
|
||||
matchEntries.remove(cid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
} finally {
|
||||
unpoolMatchPlayer(cid);
|
||||
@@ -379,26 +375,30 @@ public class MapleMatchCheckerCoordinator {
|
||||
ie.printStackTrace();
|
||||
}
|
||||
|
||||
if (mmce != null) {
|
||||
mmce.dispatchMatchResult(accept);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean dismissMatchConfirmation(int cid) {
|
||||
MapleMatchCheckingElement mmce = null;
|
||||
try {
|
||||
semaphorePool.acquire();
|
||||
try {
|
||||
while (matchEntries.containsKey(cid)) {
|
||||
if (poolMatchPlayer(cid)) {
|
||||
try {
|
||||
MapleMatchCheckingElement mmce = matchEntries.get(cid);
|
||||
mmce = matchEntries.get(cid);
|
||||
|
||||
if (mmce != null) {
|
||||
synchronized (mmce) {
|
||||
if (!mmce.isMatchActive()) {
|
||||
return false;
|
||||
mmce = null;
|
||||
} else {
|
||||
dismissMatchElement(mmce, cid);
|
||||
}
|
||||
|
||||
dismissMatchElement(mmce, cid);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
@@ -413,7 +413,12 @@ public class MapleMatchCheckerCoordinator {
|
||||
ie.printStackTrace();
|
||||
}
|
||||
|
||||
return false;
|
||||
if (mmce != null) {
|
||||
mmce.dispatchMatchDismissed();
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -224,6 +224,16 @@ public class MapleSessionCoordinator {
|
||||
public static String getSessionRemoteAddress(IoSession session) {
|
||||
return (String) session.getAttribute(MapleClient.CLIENT_REMOTE_ADDRESS);
|
||||
}
|
||||
|
||||
public static String getSessionRemoteHost(IoSession session) {
|
||||
String nibbleHwid = (String) session.getAttribute(MapleClient.CLIENT_NIBBLEHWID);
|
||||
|
||||
if (nibbleHwid != null) {
|
||||
return getSessionRemoteAddress(session) + "-" + nibbleHwid;
|
||||
} else {
|
||||
return getSessionRemoteAddress(session);
|
||||
}
|
||||
}
|
||||
|
||||
private static MapleClient getSessionClient(IoSession session) {
|
||||
return (MapleClient) session.getAttribute(MapleClient.CLIENT_KEY);
|
||||
@@ -246,7 +256,7 @@ public class MapleSessionCoordinator {
|
||||
public boolean canStartLoginSession(IoSession session) {
|
||||
if (!YamlConfig.config.server.DETERRED_MULTICLIENT) return true;
|
||||
|
||||
String remoteHost = getSessionRemoteAddress(session);
|
||||
String remoteHost = getSessionRemoteHost(session);
|
||||
Lock lock = getCoodinatorLock(remoteHost);
|
||||
|
||||
try {
|
||||
@@ -306,7 +316,9 @@ public class MapleSessionCoordinator {
|
||||
}
|
||||
|
||||
public void closeLoginSession(IoSession session) {
|
||||
String remoteHost = getSessionRemoteAddress(session);
|
||||
String nibbleHwid = (String) session.removeAttribute(MapleClient.CLIENT_NIBBLEHWID);
|
||||
String remoteHost = getSessionRemoteHost(session);
|
||||
|
||||
Set<IoSession> lrh = loginRemoteHosts.get(remoteHost);
|
||||
if (lrh != null) {
|
||||
lrh.remove(session);
|
||||
@@ -314,8 +326,7 @@ public class MapleSessionCoordinator {
|
||||
loginRemoteHosts.remove(remoteHost);
|
||||
}
|
||||
}
|
||||
|
||||
String nibbleHwid = (String) session.removeAttribute(MapleClient.CLIENT_NIBBLEHWID);
|
||||
|
||||
if (nibbleHwid != null) {
|
||||
onlineRemoteHwids.remove(nibbleHwid);
|
||||
|
||||
@@ -337,7 +348,7 @@ public class MapleSessionCoordinator {
|
||||
return AntiMulticlientResult.SUCCESS;
|
||||
}
|
||||
|
||||
String remoteHost = getSessionRemoteAddress(session);
|
||||
String remoteHost = getSessionRemoteHost(session);
|
||||
Lock lock = getCoodinatorLock(remoteHost);
|
||||
|
||||
try {
|
||||
@@ -403,9 +414,10 @@ public class MapleSessionCoordinator {
|
||||
}
|
||||
|
||||
public AntiMulticlientResult attemptGameSession(IoSession session, int accountId, String remoteHwid) {
|
||||
String remoteHost = getSessionRemoteAddress(session);
|
||||
String remoteHost = getSessionRemoteHost(session);
|
||||
if (!YamlConfig.config.server.DETERRED_MULTICLIENT) {
|
||||
associateRemoteHostHwid(remoteHost, remoteHwid);
|
||||
associateRemoteHostHwid(getSessionRemoteAddress(session), remoteHwid); // no HWID information on the loggedin newcomer session...
|
||||
return AntiMulticlientResult.SUCCESS;
|
||||
}
|
||||
|
||||
@@ -451,6 +463,7 @@ public class MapleSessionCoordinator {
|
||||
// updated session CLIENT_HWID attribute will be set when the player log in the game
|
||||
onlineRemoteHwids.add(remoteHwid);
|
||||
associateRemoteHostHwid(remoteHost, remoteHwid);
|
||||
associateRemoteHostHwid(getSessionRemoteAddress(session), remoteHwid);
|
||||
associateHwidAccountIfAbsent(remoteHwid, accountId);
|
||||
|
||||
return AntiMulticlientResult.SUCCESS;
|
||||
@@ -486,7 +499,7 @@ public class MapleSessionCoordinator {
|
||||
}
|
||||
|
||||
MapleClient client = new MapleClient(null, null, session);
|
||||
Integer cid = Server.getInstance().freeCharacteridInTransition(session);
|
||||
Integer cid = Server.getInstance().freeCharacteridInTransition(client);
|
||||
if (cid != null) {
|
||||
try {
|
||||
client.setAccID(MapleCharacter.loadCharFromDB(cid, client, false).getAccountID());
|
||||
@@ -535,7 +548,7 @@ public class MapleSessionCoordinator {
|
||||
}
|
||||
|
||||
public String getGameSessionHwid(IoSession session) {
|
||||
String remoteHost = getSessionRemoteAddress(session);
|
||||
String remoteHost = getSessionRemoteHost(session);
|
||||
return cachedHostHwids.get(remoteHost);
|
||||
}
|
||||
|
||||
|
||||
@@ -101,8 +101,7 @@ public final class CharSelectedHandler extends AbstractMaplePacketHandler {
|
||||
}
|
||||
|
||||
server.unregisterLoginState(c);
|
||||
c.updateLoginState(MapleClient.LOGIN_SERVER_TRANSITION);
|
||||
server.setCharacteridInTransition(session, charId);
|
||||
c.setCharacterOnSessionTransitionState(charId);
|
||||
|
||||
try {
|
||||
c.announce(MaplePacketCreator.getServerIP(InetAddress.getByName(socket[0]), Integer.parseInt(socket[1]), charId));
|
||||
|
||||
@@ -84,8 +84,7 @@ public class CharSelectedWithPicHandler extends AbstractMaplePacketHandler {
|
||||
}
|
||||
|
||||
server.unregisterLoginState(c);
|
||||
c.updateLoginState(MapleClient.LOGIN_SERVER_TRANSITION);
|
||||
server.setCharacteridInTransition(session, charId);
|
||||
c.setCharacterOnSessionTransitionState(charId);
|
||||
|
||||
try {
|
||||
c.announce(MaplePacketCreator.getServerIP(InetAddress.getByName(socket[0]), Integer.parseInt(socket[1]), charId));
|
||||
|
||||
@@ -86,8 +86,7 @@ public final class RegisterPicHandler extends AbstractMaplePacketHandler {
|
||||
}
|
||||
|
||||
server.unregisterLoginState(c);
|
||||
c.updateLoginState(MapleClient.LOGIN_SERVER_TRANSITION);
|
||||
server.setCharacteridInTransition(session, charId);
|
||||
c.setCharacterOnSessionTransitionState(charId);
|
||||
|
||||
try {
|
||||
c.announce(MaplePacketCreator.getServerIP(InetAddress.getByName(socket[0]), Integer.parseInt(socket[1]), charId));
|
||||
|
||||
@@ -89,8 +89,7 @@ public final class ViewAllCharRegisterPicHandler extends AbstractMaplePacketHand
|
||||
}
|
||||
|
||||
server.unregisterLoginState(c);
|
||||
c.updateLoginState(MapleClient.LOGIN_SERVER_TRANSITION);
|
||||
server.setCharacteridInTransition(session, charId);
|
||||
c.setCharacterOnSessionTransitionState(charId);
|
||||
|
||||
try {
|
||||
c.announce(MaplePacketCreator.getServerIP(InetAddress.getByName(socket[0]), Integer.parseInt(socket[1]), charId));
|
||||
|
||||
@@ -112,8 +112,7 @@ public final class ViewAllCharSelectedHandler extends AbstractMaplePacketHandler
|
||||
}
|
||||
|
||||
server.unregisterLoginState(c);
|
||||
c.updateLoginState(MapleClient.LOGIN_SERVER_TRANSITION);
|
||||
server.setCharacteridInTransition(session, charId);
|
||||
c.setCharacterOnSessionTransitionState(charId);
|
||||
|
||||
try {
|
||||
c.announce(MaplePacketCreator.getServerIP(InetAddress.getByName(socket[0]), Integer.parseInt(socket[1]), charId));
|
||||
|
||||
@@ -90,8 +90,7 @@ public class ViewAllCharSelectedWithPicHandler extends AbstractMaplePacketHandle
|
||||
}
|
||||
|
||||
server.unregisterLoginState(c);
|
||||
c.updateLoginState(MapleClient.LOGIN_SERVER_TRANSITION);
|
||||
server.setCharacteridInTransition(session, charId);
|
||||
c.setCharacterOnSessionTransitionState(charId);
|
||||
|
||||
try {
|
||||
c.announce(MaplePacketCreator.getServerIP(InetAddress.getByName(socket[0]), Integer.parseInt(socket[1]), charId));
|
||||
|
||||
@@ -356,7 +356,7 @@ public class MapleParty {
|
||||
party = player.getWorldServer().createParty(partyplayer);
|
||||
player.setParty(party);
|
||||
player.setMPC(partyplayer);
|
||||
player.getMap().addPartyMember(player);
|
||||
player.getMap().addPartyMember(player, party.getId());
|
||||
player.silentPartyUpdate();
|
||||
|
||||
player.updatePartySearchAvailability(false);
|
||||
@@ -383,7 +383,7 @@ public class MapleParty {
|
||||
if (party != null) {
|
||||
if (party.getMembers().size() < 6) {
|
||||
MaplePartyCharacter partyplayer = new MaplePartyCharacter(player);
|
||||
player.getMap().addPartyMember(player);
|
||||
player.getMap().addPartyMember(player, party.getId());
|
||||
|
||||
world.updateParty(party.getId(), PartyOperation.JOIN, partyplayer);
|
||||
player.receivePartyMemberHP();
|
||||
@@ -433,7 +433,7 @@ public class MapleParty {
|
||||
} else {
|
||||
MapleMap map = player.getMap();
|
||||
if (map != null) {
|
||||
map.removePartyMember(player);
|
||||
map.removePartyMember(player, party.getId());
|
||||
}
|
||||
|
||||
MonsterCarnival mcpq = player.getMonsterCarnival();
|
||||
@@ -472,7 +472,7 @@ public class MapleParty {
|
||||
List<MapleCharacter> partyMembers = emc.getPartyMembersOnline();
|
||||
|
||||
MapleMap map = emc.getMap();
|
||||
if(map != null) map.removePartyMember(emc);
|
||||
if(map != null) map.removePartyMember(emc, party.getId());
|
||||
|
||||
MonsterCarnival mcpq = player.getMonsterCarnival();
|
||||
if (mcpq != null) {
|
||||
|
||||
@@ -719,6 +719,45 @@ public class NPCConversationManager extends AbstractPlayerInteraction {
|
||||
mc.changeMap(out, out.getPortal(0));
|
||||
}
|
||||
}
|
||||
|
||||
private int isCPQParty(MapleMap lobby, MapleParty party) {
|
||||
int cpqMinLvl, cpqMaxLvl;
|
||||
|
||||
if (lobby.isCPQLobby()) {
|
||||
cpqMinLvl = 30;
|
||||
cpqMaxLvl = 50;
|
||||
} else {
|
||||
cpqMinLvl = 51;
|
||||
cpqMaxLvl = 70;
|
||||
}
|
||||
|
||||
List<MaplePartyCharacter> partyMembers = party.getPartyMembers();
|
||||
for (MaplePartyCharacter pchr : partyMembers) {
|
||||
if (pchr.getLevel() >= cpqMinLvl && pchr.getLevel() <= cpqMaxLvl) {
|
||||
if (lobby.getCharacterById(pchr.getId()) == null) {
|
||||
return 1; // party member detected out of area
|
||||
}
|
||||
} else {
|
||||
return 2; // party member doesn't fit requirements
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
private int canStartCPQ(MapleMap lobby, MapleParty party, MapleParty challenger) {
|
||||
int ret = isCPQParty(lobby, party);
|
||||
if (ret != 0) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = isCPQParty(lobby, challenger);
|
||||
if (ret != 0) {
|
||||
return -ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void startCPQ(final MapleCharacter challenger, final int field) {
|
||||
try {
|
||||
@@ -779,7 +818,13 @@ public class NPCConversationManager extends AbstractPlayerInteraction {
|
||||
return;
|
||||
}
|
||||
|
||||
new MonsterCarnival(getPlayer().getParty(), challenger.getParty(), mapid, true, (field / 100) % 10);
|
||||
MapleParty lobbyParty = getPlayer().getParty(), challengerParty = challenger.getParty();
|
||||
int status = canStartCPQ(lobbyMap, lobbyParty, challengerParty);
|
||||
if (status == 0) {
|
||||
new MonsterCarnival(lobbyParty, challengerParty, mapid, true, (field / 100) % 10);
|
||||
} else {
|
||||
warpoutCPQLobby(lobbyMap);
|
||||
}
|
||||
}
|
||||
}, 11000);
|
||||
} catch (Exception e) {
|
||||
@@ -828,7 +873,13 @@ public class NPCConversationManager extends AbstractPlayerInteraction {
|
||||
return;
|
||||
}
|
||||
|
||||
new MonsterCarnival(getPlayer().getParty(), challenger.getParty(), mapid, false, (field / 1000) % 10);
|
||||
MapleParty lobbyParty = getPlayer().getParty(), challengerParty = challenger.getParty();
|
||||
int status = canStartCPQ(lobbyMap, lobbyParty, challengerParty);
|
||||
if (status == 0) {
|
||||
new MonsterCarnival(lobbyParty, challengerParty, mapid, false, (field / 1000) % 10);
|
||||
} else {
|
||||
warpoutCPQLobby(lobbyMap);
|
||||
}
|
||||
}
|
||||
}, 10000);
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -101,6 +101,7 @@ public class MapleItemInformationProvider {
|
||||
protected Map<Integer, MapleData> equipLevelInfoCache = new HashMap<>();
|
||||
protected Map<Integer, Integer> equipLevelReqCache = new HashMap<>();
|
||||
protected Map<Integer, Integer> equipMaxLevelCache = new HashMap<>();
|
||||
protected Map<Integer, List<Integer>> scrollReqsCache = new HashMap<>();
|
||||
protected Map<Integer, Integer> wholePriceCache = new HashMap<>();
|
||||
protected Map<Integer, Double> unitPriceCache = new HashMap<>();
|
||||
protected Map<Integer, Integer> projectileWatkCache = new HashMap<>();
|
||||
@@ -594,15 +595,20 @@ public class MapleItemInformationProvider {
|
||||
}
|
||||
|
||||
public List<Integer> getScrollReqs(int itemId) {
|
||||
if (scrollReqsCache.containsKey(itemId)) {
|
||||
return scrollReqsCache.get(itemId);
|
||||
}
|
||||
|
||||
List<Integer> ret = new ArrayList<>();
|
||||
MapleData data = getItemData(itemId);
|
||||
data = data.getChildByPath("req");
|
||||
if (data == null) {
|
||||
return ret;
|
||||
}
|
||||
for (MapleData req : data.getChildren()) {
|
||||
ret.add(MapleDataTool.getInt(req));
|
||||
if (data != null) {
|
||||
for (MapleData req : data.getChildren()) {
|
||||
ret.add(MapleDataTool.getInt(req));
|
||||
}
|
||||
}
|
||||
|
||||
scrollReqsCache.put(itemId, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -620,7 +626,7 @@ public class MapleItemInformationProvider {
|
||||
}
|
||||
|
||||
public static boolean rollSuccessChance(double propPercent) {
|
||||
return Math.random() >= testYourLuck(propPercent / 100.0, YamlConfig.config.server.SCROLL_CHANCE_RATE);
|
||||
return Math.random() >= testYourLuck(propPercent / 100.0, YamlConfig.config.server.SCROLL_CHANCE_ROLLS);
|
||||
}
|
||||
|
||||
private static short getMaximumShortMaxIfOverflow(int value1, int value2) {
|
||||
|
||||
@@ -69,18 +69,10 @@ public class MapleMarriage extends EventInstanceManager {
|
||||
}
|
||||
|
||||
public List<Item> getGiftItems(MapleClient c, boolean groom) {
|
||||
if (c.tryacquireClient()) {
|
||||
try {
|
||||
List<Item> gifts = getGiftItemsList(groom);
|
||||
synchronized (gifts) {
|
||||
return new LinkedList<>(gifts);
|
||||
}
|
||||
} finally {
|
||||
c.releaseClient();
|
||||
}
|
||||
List<Item> gifts = getGiftItemsList(groom);
|
||||
synchronized (gifts) {
|
||||
return new LinkedList<>(gifts);
|
||||
}
|
||||
|
||||
return new LinkedList<>();
|
||||
}
|
||||
|
||||
private List<Item> getGiftItemsList(boolean groom) {
|
||||
@@ -130,7 +122,9 @@ public class MapleMarriage extends EventInstanceManager {
|
||||
Connection con = DatabaseConnection.getConnection();
|
||||
ItemFactory.MARRIAGE_GIFTS.saveItems(new LinkedList<Pair<Item, MapleInventoryType>>(), chr.getId(), con);
|
||||
con.close();
|
||||
} catch (SQLException sqle) {}
|
||||
} catch (SQLException sqle) {
|
||||
sqle.printStackTrace();
|
||||
}
|
||||
|
||||
for (Item item : gifts) {
|
||||
MapleInventoryManipulator.addFromDrop(chr.getClient(), item, false);
|
||||
@@ -144,18 +138,13 @@ public class MapleMarriage extends EventInstanceManager {
|
||||
|
||||
public static List<Item> loadGiftItemsFromDb(MapleClient c, int cid) {
|
||||
List<Item> items = new LinkedList<>();
|
||||
if (c.tryacquireClient()) {
|
||||
try {
|
||||
try {
|
||||
for (Pair<Item, MapleInventoryType> it : ItemFactory.MARRIAGE_GIFTS.loadItems(cid, false)) {
|
||||
items.add(it.getLeft());
|
||||
}
|
||||
} catch (SQLException sqle) {
|
||||
sqle.printStackTrace();
|
||||
}
|
||||
} finally {
|
||||
c.releaseClient();
|
||||
|
||||
try {
|
||||
for (Pair<Item, MapleInventoryType> it : ItemFactory.MARRIAGE_GIFTS.loadItems(cid, false)) {
|
||||
items.add(it.getLeft());
|
||||
}
|
||||
} catch (SQLException sqle) {
|
||||
sqle.printStackTrace();
|
||||
}
|
||||
|
||||
return items;
|
||||
@@ -170,19 +159,13 @@ public class MapleMarriage extends EventInstanceManager {
|
||||
for (Item it : giftItems) {
|
||||
items.add(new Pair<>(it, it.getInventoryType()));
|
||||
}
|
||||
|
||||
if (c.tryacquireClient()) {
|
||||
try {
|
||||
try {
|
||||
Connection con = DatabaseConnection.getConnection();
|
||||
ItemFactory.MARRIAGE_GIFTS.saveItems(items, cid, con);
|
||||
con.close();
|
||||
} catch (SQLException sqle) {
|
||||
sqle.printStackTrace();
|
||||
}
|
||||
} finally {
|
||||
c.releaseClient();
|
||||
}
|
||||
|
||||
try {
|
||||
Connection con = DatabaseConnection.getConnection();
|
||||
ItemFactory.MARRIAGE_GIFTS.saveItems(items, cid, con);
|
||||
con.close();
|
||||
} catch (SQLException sqle) {
|
||||
sqle.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,10 +19,8 @@
|
||||
*/
|
||||
package server;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
@@ -67,25 +65,12 @@ public class MapleSkillbookInformationProvider {
|
||||
static String driver = "com.mysql.jdbc.Driver";
|
||||
static String username = "root";
|
||||
static String password = "";
|
||||
|
||||
static String wzPath = "wz";
|
||||
|
||||
static String rootDirectory = ".";
|
||||
|
||||
static InputStreamReader fileReader = null;
|
||||
static BufferedReader bufferedReader = null;
|
||||
|
||||
static int initialStringLength = 50;
|
||||
|
||||
static int skillbookMinItemid = 2280000;
|
||||
static int skillbookMaxItemid = 2300000; // exclusively
|
||||
|
||||
static byte status = 0;
|
||||
static int questId = -1;
|
||||
static int isCompleteState = 0;
|
||||
|
||||
static int currentItemid = 0;
|
||||
static int currentCount = 0;
|
||||
|
||||
static {
|
||||
loadSkillbooks();
|
||||
}
|
||||
@@ -106,7 +91,7 @@ public class MapleSkillbookInformationProvider {
|
||||
int itemcount = MapleDataTool.getInt("count", questItemData, 0);
|
||||
|
||||
if (isSkillBook(itemid) && itemcount > 0) {
|
||||
foundSkillbooks.put(currentItemid, SkillBookEntry.QUEST);
|
||||
foundSkillbooks.put(itemid, SkillBookEntry.QUEST);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -262,6 +262,7 @@ public class MapleStatEffect {
|
||||
}
|
||||
if (MapleDataTool.getInt("weakness", source, 0) > 0) {
|
||||
cure.add(MapleDisease.WEAKEN);
|
||||
cure.add(MapleDisease.SLOW);
|
||||
}
|
||||
if (MapleDataTool.getInt("curse", source, 0) > 0) {
|
||||
cure.add(MapleDisease.CURSE);
|
||||
@@ -1070,7 +1071,7 @@ public class MapleStatEffect {
|
||||
if (isMagicDoor() && !FieldLimit.DOOR.check(applyto.getMap().getFieldLimit())) { // Magic Door
|
||||
int y = applyto.getFh();
|
||||
if (y == 0) {
|
||||
y = applyto.getPosition().y;
|
||||
y = applyto.getMap().getGroundBelow(applyto.getPosition()).y; // thanks Lame for pointing out unusual cases of doors sending players on ground below
|
||||
}
|
||||
Point doorPosition = new Point(applyto.getPosition().x, y);
|
||||
MapleDoor door = new MapleDoor(applyto, doorPosition);
|
||||
@@ -1118,7 +1119,7 @@ public class MapleStatEffect {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
int amount = opposition.getMembers().size() - 1;
|
||||
int amount = opposition.getMembers().size();
|
||||
int randd = (int) Math.floor(Math.random() * amount);
|
||||
MapleCharacter chrApp = applyfrom.getMap().getCharacterById(opposition.getMemberByPos(randd).getId());
|
||||
if (chrApp != null && chrApp.getMap().isCPQMap()) {
|
||||
@@ -1132,16 +1133,7 @@ public class MapleStatEffect {
|
||||
}
|
||||
} else if (cureDebuffs.size() > 0) { // by Drago-Dragohe4rt
|
||||
for (final MapleDisease debuff : cureDebuffs) {
|
||||
if (applyfrom.getParty() != null) {
|
||||
for (MaplePartyCharacter mpc : applyfrom.getParty().getPartyMembers()) {
|
||||
MapleCharacter chr = mpc.getPlayer();
|
||||
if (chr != null) {
|
||||
chr.dispelDebuff(debuff);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
applyfrom.dispelDebuff(debuff);
|
||||
}
|
||||
applyfrom.dispelDebuff(debuff);
|
||||
}
|
||||
} else if (mobSkill > 0 && mobSkillLevel > 0) {
|
||||
MobSkill ms = MobSkillFactory.getMobSkill(mobSkill, mobSkillLevel);
|
||||
|
||||
@@ -70,6 +70,7 @@ import net.server.services.type.ChannelServices;
|
||||
import net.server.services.task.channel.FaceExpressionService;
|
||||
import net.server.services.task.channel.MobMistService;
|
||||
import net.server.services.task.channel.OverallService;
|
||||
import net.server.world.MapleParty;
|
||||
import net.server.world.World;
|
||||
import scripting.map.MapScriptManager;
|
||||
import server.MapleItemInformationProvider;
|
||||
@@ -2413,8 +2414,7 @@ public class MapleMap {
|
||||
return null;
|
||||
}
|
||||
|
||||
private void addPartyMemberInternal(MapleCharacter chr) {
|
||||
int partyid = chr.getPartyId();
|
||||
private void addPartyMemberInternal(MapleCharacter chr, int partyid) {
|
||||
if (partyid == -1) {
|
||||
return;
|
||||
}
|
||||
@@ -2430,8 +2430,7 @@ public class MapleMap {
|
||||
}
|
||||
}
|
||||
|
||||
private void removePartyMemberInternal(MapleCharacter chr) {
|
||||
int partyid = chr.getPartyId();
|
||||
private void removePartyMemberInternal(MapleCharacter chr, int partyid) {
|
||||
if (partyid == -1) {
|
||||
return;
|
||||
}
|
||||
@@ -2446,19 +2445,19 @@ public class MapleMap {
|
||||
}
|
||||
}
|
||||
|
||||
public void addPartyMember(MapleCharacter chr) {
|
||||
public void addPartyMember(MapleCharacter chr, int partyid) {
|
||||
chrWLock.lock();
|
||||
try {
|
||||
addPartyMemberInternal(chr);
|
||||
addPartyMemberInternal(chr, partyid);
|
||||
} finally {
|
||||
chrWLock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
public void removePartyMember(MapleCharacter chr) {
|
||||
public void removePartyMember(MapleCharacter chr, int partyid) {
|
||||
chrWLock.lock();
|
||||
try {
|
||||
removePartyMemberInternal(chr);
|
||||
removePartyMemberInternal(chr, partyid);
|
||||
} finally {
|
||||
chrWLock.unlock();
|
||||
}
|
||||
@@ -2475,12 +2474,15 @@ public class MapleMap {
|
||||
|
||||
public void addPlayer(final MapleCharacter chr) {
|
||||
int chrSize;
|
||||
MapleParty party = chr.getParty();
|
||||
chrWLock.lock();
|
||||
try {
|
||||
characters.add(chr);
|
||||
chrSize = characters.size();
|
||||
|
||||
addPartyMemberInternal(chr);
|
||||
if (party != null && party.getMemberById(chr.getId()) != null) {
|
||||
addPartyMemberInternal(chr, party.getId());
|
||||
}
|
||||
itemMonitorTimeout = 1;
|
||||
} finally {
|
||||
chrWLock.unlock();
|
||||
@@ -2810,9 +2812,13 @@ public class MapleMap {
|
||||
service.unregisterFaceExpression(mapid, chr);
|
||||
chr.unregisterChairBuff();
|
||||
|
||||
MapleParty party = chr.getParty();
|
||||
chrWLock.lock();
|
||||
try {
|
||||
removePartyMemberInternal(chr);
|
||||
if (party != null && party.getMemberById(chr.getId()) != null) {
|
||||
removePartyMemberInternal(chr, party.getId());
|
||||
}
|
||||
|
||||
characters.remove(chr);
|
||||
} finally {
|
||||
chrWLock.unlock();
|
||||
@@ -3559,7 +3565,7 @@ public class MapleMap {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
reactor.lockReactor();
|
||||
reactor.hitLockReactor();
|
||||
try {
|
||||
if(reactor.getReactorType() == 100) {
|
||||
if (reactor.getShouldCollect() == true && mapitem != null && mapitem == getMapObject(mapitem.getObjectId())) {
|
||||
@@ -3603,7 +3609,7 @@ public class MapleMap {
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
reactor.unlockReactor();
|
||||
reactor.hitUnlockReactor();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -274,10 +274,10 @@ public class MapleMapFactory {
|
||||
MapleData mcData = mapData.getChildByPath("monsterCarnival");
|
||||
if (mcData != null) {
|
||||
map.setDeathCP(MapleDataTool.getIntConvert("deathCP", mcData, 0));
|
||||
map.setMaxMobs(MapleDataTool.getIntConvert("mobGenMax", mcData, Integer.MAX_VALUE)); // thanks Atoot for noticing CPQ1 bf. 3 & 4 not accepting spawns due to undefined limits
|
||||
map.setMaxMobs(MapleDataTool.getIntConvert("mobGenMax", mcData, 20)); // thanks Atoot for noticing CPQ1 bf. 3 & 4 not accepting spawns due to undefined limits, Lame for noticing a need to cap mob spawns even on such undefined limits
|
||||
map.setTimeDefault(MapleDataTool.getIntConvert("timeDefault", mcData, 0));
|
||||
map.setTimeExpand(MapleDataTool.getIntConvert("timeExpand", mcData, 0));
|
||||
map.setMaxReactors(MapleDataTool.getIntConvert("guardianGenMax", mcData, Integer.MAX_VALUE));
|
||||
map.setMaxReactors(MapleDataTool.getIntConvert("guardianGenMax", mcData, 16));
|
||||
MapleData guardianGenData = mcData.getChildByPath("guardianGenPos");
|
||||
for (MapleData node : guardianGenData.getChildren()) {
|
||||
GuardianSpawnPoint pt = new GuardianSpawnPoint(new Point(MapleDataTool.getIntConvert("x", node), MapleDataTool.getIntConvert("y", node)));
|
||||
|
||||
@@ -86,6 +86,16 @@ public class MapleReactor extends AbstractMapleMapObject {
|
||||
public void unlockReactor() {
|
||||
reactorLock.unlock();
|
||||
}
|
||||
|
||||
public void hitLockReactor() {
|
||||
hitLock.lock();
|
||||
reactorLock.lock();
|
||||
}
|
||||
|
||||
public void hitUnlockReactor() {
|
||||
reactorLock.unlock();
|
||||
hitLock.unlock();
|
||||
}
|
||||
|
||||
public void setState(byte state) {
|
||||
this.state = state;
|
||||
|
||||
@@ -59,7 +59,7 @@ public class MapleCarnivalFactory {
|
||||
if (multi) {
|
||||
return skills.get(multiTargetedSkills.get((int) (Math.random() * multiTargetedSkills.size())));
|
||||
} else {
|
||||
return skills.get(multiTargetedSkills.get((int) (Math.random() * multiTargetedSkills.size())));
|
||||
return skills.get(singleTargetedSkills.get((int) (Math.random() * singleTargetedSkills.size())));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -305,16 +305,20 @@ public class MapleQuest {
|
||||
for (MapleQuestAction a : acts) {
|
||||
a.run(chr, selection);
|
||||
}
|
||||
if (!this.hasNextQuestAction()) {
|
||||
chr.announceUpdateQuest(MapleCharacter.DelayedQuestUpdate.INFO, chr.getQuest(this));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void reset(MapleCharacter chr) {
|
||||
chr.updateQuestStatus(new MapleQuestStatus(this, MapleQuestStatus.Status.NOT_STARTED));
|
||||
MapleQuestStatus newStatus = new MapleQuestStatus(this, MapleQuestStatus.Status.NOT_STARTED);
|
||||
chr.updateQuestStatus(newStatus);
|
||||
}
|
||||
|
||||
public void forfeit(MapleCharacter chr) {
|
||||
public boolean forfeit(MapleCharacter chr) {
|
||||
if (!chr.getQuest(this).getStatus().equals(Status.STARTED)) {
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
if (timeLimit > 0) {
|
||||
chr.announce(MaplePacketCreator.removeQuestTimeLimit(id));
|
||||
@@ -322,6 +326,7 @@ public class MapleQuest {
|
||||
MapleQuestStatus newStatus = new MapleQuestStatus(this, MapleQuestStatus.Status.NOT_STARTED);
|
||||
newStatus.setForfeited(chr.getQuest(this).getForfeited() + 1);
|
||||
chr.updateQuestStatus(newStatus);
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean forceStart(MapleCharacter chr, int npc) {
|
||||
@@ -584,7 +589,7 @@ public class MapleQuest {
|
||||
}
|
||||
|
||||
public boolean restoreLostItem(MapleCharacter chr, int itemid) {
|
||||
if (chr.getQuest(this).equals(MapleQuestStatus.Status.STARTED)) {
|
||||
if (chr.getQuest(this).getStatus().equals(MapleQuestStatus.Status.STARTED)) {
|
||||
ItemAction itemAct = (ItemAction) startActs.get(MapleQuestActionType.ITEM);
|
||||
if (itemAct != null) {
|
||||
return itemAct.restoreLostItem(chr, itemid);
|
||||
@@ -620,6 +625,13 @@ public class MapleQuest {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean hasNextQuestAction() {
|
||||
Map<MapleQuestActionType, MapleQuestAction> acts = completeActs;
|
||||
MapleQuestAction mqa = acts.get(MapleQuestActionType.NEXTQUEST);
|
||||
|
||||
return mqa != null;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@@ -22,12 +22,10 @@
|
||||
package server.quest.actions;
|
||||
|
||||
import client.MapleCharacter;
|
||||
import client.MapleStat;
|
||||
import provider.MapleData;
|
||||
import provider.MapleDataTool;
|
||||
import server.quest.MapleQuest;
|
||||
import server.quest.MapleQuestActionType;
|
||||
import tools.MaplePacketCreator;
|
||||
|
||||
/**
|
||||
*
|
||||
|
||||
@@ -24,7 +24,6 @@ package server.quest.actions;
|
||||
import client.MapleCharacter;
|
||||
import client.MapleClient;
|
||||
import client.inventory.Item;
|
||||
import client.inventory.MapleInventory;
|
||||
import client.inventory.MapleInventoryType;
|
||||
import constants.inventory.ItemConstants;
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
package server.quest.actions;
|
||||
|
||||
import client.MapleCharacter;
|
||||
import client.MapleQuestStatus;
|
||||
import provider.MapleData;
|
||||
import server.quest.MapleQuest;
|
||||
import server.quest.MapleQuestActionType;
|
||||
|
||||
Reference in New Issue
Block a user