ariantpq + correct use catch item
This commit is contained in:
@@ -47,6 +47,7 @@ public enum MapleBuffStat {
|
||||
GHOST_MORPH(0x20000L),
|
||||
AURA(0x40000L),
|
||||
CONFUSE(0x80000L),
|
||||
ARIANT_PQ_SHIELD(0x40000L),
|
||||
|
||||
// ------ COUPON feature ------
|
||||
|
||||
|
||||
@@ -1,25 +1,3 @@
|
||||
/*
|
||||
This file is part of the OdinMS Maple Story Server
|
||||
Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc>
|
||||
Matthias Butz <matze@odinms.de>
|
||||
Jan Christian Meyer <vimes@odinms.de>
|
||||
|
||||
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 otheer version of the GNU Affero General Public
|
||||
License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; witout 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 client;
|
||||
|
||||
import java.awt.Point;
|
||||
@@ -126,7 +104,6 @@ import client.newyear.NewYearCardRecord;
|
||||
import constants.ExpTable;
|
||||
import constants.GameConstants;
|
||||
import constants.ItemConstants;
|
||||
import constants.LinguaConstants;
|
||||
import constants.ServerConstants;
|
||||
import constants.skills.Aran;
|
||||
import constants.skills.Beginner;
|
||||
@@ -320,7 +297,9 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
private int banishSp = -1;
|
||||
private long banishTime = 0;
|
||||
private long lastExpGainTime;
|
||||
|
||||
public ScheduledFuture<?> pqMapleMap;
|
||||
public ScheduledFuture<?> ariantScore;
|
||||
|
||||
private MapleCharacter() {
|
||||
super.setListener(new AbstractCharacterListener() {
|
||||
@Override
|
||||
@@ -1944,12 +1923,14 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
this.getMonsterBook().addCard(client, mItem.getItemId());
|
||||
}
|
||||
} else if (MapleInventoryManipulator.addFromDrop(client, mItem, true)) {
|
||||
} else if (mItem.getItemId() == 4031868) {
|
||||
this.getMap().broadcastMessage(MaplePacketCreator.updateAriantPQRanking(this.getName(), this.getItemQuantity(4031868, false), false));
|
||||
} else {
|
||||
client.announce(MaplePacketCreator.enableActions());
|
||||
return;
|
||||
}
|
||||
if (mItem.getItemId() == 4031868) {
|
||||
updateAriantScore();
|
||||
getMap().broadcastMessage(MaplePacketCreator.updateAriantPQRanking(this.getName(), this.getItemQuantity(4031868, false), false));
|
||||
}
|
||||
|
||||
this.getMap().pickItemDrop(pickupPacket, mapitem);
|
||||
} else if (!hasSpaceInventory) {
|
||||
@@ -5780,6 +5761,22 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
if (hpDecreaseTask != null) {
|
||||
hpDecreaseTask.cancel(false);
|
||||
}
|
||||
cancelPqMapleMap();
|
||||
cancelAriantScore();
|
||||
}
|
||||
|
||||
public void cancelPqMapleMap() {
|
||||
if (pqMapleMap != null) {
|
||||
pqMapleMap.cancel(true);
|
||||
pqMapleMap = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void cancelAriantScore() {
|
||||
if (ariantScore != null) {
|
||||
ariantScore.cancel(true);
|
||||
ariantScore = null;
|
||||
}
|
||||
}
|
||||
|
||||
private int getChangedJobSp(MapleJob newJob) {
|
||||
@@ -7007,12 +7004,12 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
|
||||
private void playerDead() {
|
||||
if (this.getMap().isCPQMap()) {
|
||||
int lost = getCP();
|
||||
if (lost > 6) {
|
||||
lost = 6;
|
||||
int losing = getMap().getDeathCP();
|
||||
if (getCP() < losing) {
|
||||
losing = getCP();
|
||||
}
|
||||
getMap().broadcastMessage(MaplePacketCreator.playerDiedMessage(getName(), lost, getTeam()));
|
||||
gainCP(-lost);
|
||||
getMap().broadcastMessage(MaplePacketCreator.playerDiedMessage(getName(), losing, getTeam()));
|
||||
gainCP(-losing);
|
||||
return;
|
||||
}
|
||||
cancelAllBuffs(false);
|
||||
@@ -10226,4 +10223,41 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
getClient().getAbstractPlayerInteraction().gainItem(item.getItemId(), item.getQuantity());
|
||||
}
|
||||
}
|
||||
|
||||
public int getAriantScore() {
|
||||
return this.countItem(4031868);
|
||||
}
|
||||
|
||||
public void updateAriantScore() {
|
||||
this.getMap().broadcastMessage(MaplePacketCreator.updateAriantPQRanking(this.getName(), getAriantScore(), false));
|
||||
}
|
||||
|
||||
public void disease(int type, int level) {
|
||||
if (MapleDisease.getBySkill(type) == null) {
|
||||
return;
|
||||
}
|
||||
giveDebuff(MapleDisease.getBySkill(type), MobSkillFactory.getMobSkill(type, level));
|
||||
}
|
||||
|
||||
public void shield() {
|
||||
List<Pair<MapleBuffStat, Integer>> ldsstat = Collections.singletonList(new Pair<MapleBuffStat, Integer>(MapleBuffStat.ARIANT_PQ_SHIELD, 1));
|
||||
getMap().broadcastMessage(this, MaplePacketCreator.giveForeignBuff(id, ldsstat), false);
|
||||
}
|
||||
|
||||
public ScheduledFuture<?> getPqMapleMap() {
|
||||
return pqMapleMap;
|
||||
}
|
||||
|
||||
public void setPqMapleMap(ScheduledFuture<?> pqMapleMap) {
|
||||
this.pqMapleMap = pqMapleMap;
|
||||
}
|
||||
|
||||
public ScheduledFuture<?> getAriantScoreBord() {
|
||||
return ariantScore;
|
||||
}
|
||||
|
||||
public void setAriantScore(ScheduledFuture<?> ariantScore) {
|
||||
this.ariantScore = ariantScore;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -81,6 +81,8 @@ import server.quest.MapleQuest;
|
||||
import net.server.audit.locks.MonitoredLockType;
|
||||
import net.server.audit.locks.factory.MonitoredReentrantLockFactory;
|
||||
import net.server.coordinator.MapleLoginBypassCoordinator;
|
||||
import server.expeditions.MapleExpedition;
|
||||
import server.expeditions.MapleExpeditionType;
|
||||
|
||||
public class MapleClient {
|
||||
|
||||
@@ -767,7 +769,7 @@ public class MapleClient {
|
||||
try {
|
||||
Connection con = DatabaseConnection.getConnection();
|
||||
try (PreparedStatement ps = con.prepareStatement("UPDATE accounts SET loggedin = ?, lastlogin = ? WHERE id = ?")) {
|
||||
// using sql currenttime here could potentially break the login, thanks Arnah for pointing this out
|
||||
// using sql currenttime here could potentially break the login, thanks Arnah for pointing this out
|
||||
|
||||
ps.setInt(1, newstate);
|
||||
ps.setTimestamp(2, new java.sql.Timestamp(Server.getInstance().getCurrentTime()));
|
||||
@@ -884,6 +886,9 @@ public class MapleClient {
|
||||
if (player.getMonsterCarnival() != null) {
|
||||
player.getMonsterCarnival().playerDisconnected(getPlayer().getId());
|
||||
}
|
||||
|
||||
cancelarAriantPQ();
|
||||
|
||||
}
|
||||
|
||||
if (player.getMap() != null) {
|
||||
@@ -899,6 +904,20 @@ public class MapleClient {
|
||||
}
|
||||
}
|
||||
|
||||
public void cancelarAriantPQ() {
|
||||
MapleExpedition exp = null;
|
||||
if (player.getMapId() == 980010101) {
|
||||
exp = player.getClient().getAbstractPlayerInteraction().getExpedition(MapleExpeditionType.ARIANT);
|
||||
} else if (player.getMapId() == 980010201) {
|
||||
exp = player.getClient().getAbstractPlayerInteraction().getExpedition(MapleExpeditionType.ARIANT1);
|
||||
} else {
|
||||
exp = player.getClient().getAbstractPlayerInteraction().getExpedition(MapleExpeditionType.ARIANT2);
|
||||
}
|
||||
if (exp != null && (player.getMapId() == 980010101 || player.getMapId() == 980010201 || player.getMapId() == 980010301) && player.getMap().getAllPlayer().size() == 1) {
|
||||
getAbstractPlayerInteraction().endExpedition(exp);
|
||||
}
|
||||
}
|
||||
|
||||
public final void disconnect(final boolean shutdown, final boolean cashshop) {
|
||||
if (canDisconnect()) {
|
||||
ThreadManager.getInstance().newTask(new Runnable() {
|
||||
@@ -985,7 +1004,7 @@ public class MapleClient {
|
||||
chrg.setCharacter(null);
|
||||
}
|
||||
wserv.removePlayer(player);
|
||||
//getChannelServer().removePlayer(player); already being done
|
||||
//getChannelServer().removePlayer(player); already being done
|
||||
|
||||
player.saveCooldowns();
|
||||
player.cancelAllDebuffs();
|
||||
@@ -1448,7 +1467,7 @@ public class MapleClient {
|
||||
player.cancelDiseaseExpireTask();
|
||||
player.cancelSkillCooldownTask();
|
||||
player.cancelQuestExpirationTask();
|
||||
//Cancelling magicdoor? Nope
|
||||
//Cancelling magicdoor? Nope
|
||||
//Cancelling mounts? Noty
|
||||
|
||||
player.getInventory(MapleInventoryType.EQUIPPED).checked(false); //test
|
||||
|
||||
@@ -29,7 +29,7 @@ public enum MapleDisease {
|
||||
SEDUCE(0x80, 128),
|
||||
FISHABLE(0x100),
|
||||
ZOMBIFY(0x4000),
|
||||
CONFUSE(0x80000),
|
||||
CONFUSE(0x80000, 132),
|
||||
STUN(0x2000000000000L, 123),
|
||||
POISON(0x4000000000000L, 125),
|
||||
SEAL(0x8000000000000L, 120),
|
||||
|
||||
@@ -20,6 +20,7 @@ import server.quest.MapleQuest;
|
||||
public class GameConstants {
|
||||
public static String[] WORLD_NAMES = {"Scania", "Bera", "Broa", "Windia", "Khaini", "Bellocan", "Mardia", "Kradia", "Yellonde", "Demethos", "Galicia", "El Nido", "Zenith", "Arcenia", "Kastia", "Judis", "Plana", "Kalluna", "Stius", "Croa", "Medere"};
|
||||
public static final int[] OWL_DATA = new int[]{1082002, 2070005, 2070006, 1022047, 1102041, 2044705, 2340000, 2040017, 1092030, 2040804};
|
||||
public static final String[] stats = {"tuc", "reqLevel", "reqJob", "reqSTR", "reqDEX", "reqINT", "reqLUK", "reqPOP", "cash", "cursed", "success", "setItemID", "equipTradeBlock", "durability", "randOption", "randStat", "masterLevel", "reqSkillLevel", "elemDefault", "incRMAS", "incRMAF", "incRMAI", "incRMAL", "canLevel", "skill", "charmEXP"};
|
||||
public static final int[] CASH_DATA = new int[]{50200004, 50200069, 50200117, 50100008, 50000047};
|
||||
|
||||
// Ronan's rates upgrade system
|
||||
|
||||
@@ -88,6 +88,7 @@ import constants.ServerConstants;
|
||||
import java.util.TimeZone;
|
||||
import net.server.coordinator.MapleSessionCoordinator;
|
||||
import server.CashShop.CashItemFactory;
|
||||
import server.MapleItemInformationProvider;
|
||||
import server.MapleSkillbookInformationProvider;
|
||||
import server.ThreadManager;
|
||||
import server.TimerManager;
|
||||
@@ -924,6 +925,7 @@ public class Server {
|
||||
//MapleItemInformationProvider.getInstance().getAllItems(); //unused, rofl
|
||||
|
||||
CashItemFactory.getSpecialCashItems();
|
||||
MapleItemInformationProvider.getInstance().getAllItems();
|
||||
System.out.println("Items loaded in " + ((System.currentTimeMillis() - timeToTake) / 1000.0) + " seconds");
|
||||
|
||||
timeToTake = System.currentTimeMillis();
|
||||
|
||||
@@ -34,7 +34,6 @@ import constants.GameConstants;
|
||||
import constants.ItemConstants;
|
||||
import constants.ServerConstants;
|
||||
import constants.skills.Aran;
|
||||
import constants.skills.Corsair;
|
||||
|
||||
import java.awt.Point;
|
||||
import java.util.Collections;
|
||||
@@ -44,6 +43,7 @@ import java.util.List;
|
||||
import net.AbstractMaplePacketHandler;
|
||||
import client.inventory.manipulator.MapleInventoryManipulator;
|
||||
import server.MapleStatEffect;
|
||||
import server.life.MapleLifeFactory;
|
||||
import server.life.MapleLifeFactory.loseItem;
|
||||
import server.life.MapleMonster;
|
||||
import server.life.MobAttackInfo;
|
||||
@@ -87,15 +87,19 @@ public final class TakeDamageHandler extends AbstractMaplePacketHandler {
|
||||
}
|
||||
}
|
||||
|
||||
if (attacker != null) {
|
||||
if (attacker != null || monsteridfrom == 9300166) {
|
||||
List<loseItem> loseItems;
|
||||
|
||||
if (attacker.isBuffed(MonsterStatus.NEUTRALISE)) {
|
||||
if (monsteridfrom != 9300166 && attacker.isBuffed(MonsterStatus.NEUTRALISE)) {
|
||||
return;
|
||||
}
|
||||
if (damage > 0) {
|
||||
MapleMonster assaulter = map.getMonsterById(monsteridfrom);
|
||||
|
||||
if (monsteridfrom == 9300166) {
|
||||
assaulter = MapleLifeFactory.getMonster(monsteridfrom);
|
||||
}
|
||||
|
||||
if(assaulter != null) {
|
||||
loseItems = assaulter.getStats().loseItem();
|
||||
if (loseItems != null) {
|
||||
@@ -106,8 +110,14 @@ public final class TakeDamageHandler extends AbstractMaplePacketHandler {
|
||||
for (loseItem loseItem : loseItems) {
|
||||
type = ItemConstants.getInventoryType(loseItem.getId());
|
||||
for (byte b = 0; b < loseItem.getX(); b++) {//LOL?
|
||||
boolean buffAtivo = false;
|
||||
if (Randomizer.nextInt(100) < loseItem.getChance()) {
|
||||
if (chr.haveItem(loseItem.getId())) {
|
||||
for (Integer inteiro : chr.getAvailableBuffs()) {
|
||||
if (inteiro == -2022269) {
|
||||
buffAtivo = true;
|
||||
}
|
||||
}
|
||||
if (chr.haveItem(loseItem.getId()) && !buffAtivo) {
|
||||
pos.x = (int) (playerpos + ((d % 2 == 0) ? (25 * (d + 1) / 2) : -(25 * (d / 2))));
|
||||
MapleInventoryManipulator.removeById(c, type, loseItem.getId(), 1, false, false);
|
||||
map.spawnItemDrop(chr, chr, new Item(loseItem.getId(), (short) 0, (short) 1), map.calcDropPos(pos, chr.getPosition()), true, true);
|
||||
@@ -118,7 +128,9 @@ public final class TakeDamageHandler extends AbstractMaplePacketHandler {
|
||||
}
|
||||
}
|
||||
}
|
||||
map.removeMapObject(attacker);
|
||||
if(monsteridfrom != 9300166) {
|
||||
map.removeMapObject(attacker);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,24 +1,24 @@
|
||||
/*
|
||||
This file is part of the OdinMS Maple Story Server
|
||||
Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc>
|
||||
Matthias Butz <matze@odinms.de>
|
||||
Jan Christian Meyer <vimes@odinms.de>
|
||||
This file is part of the OdinMS Maple Story Server
|
||||
Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc>
|
||||
Matthias Butz <matze@odinms.de>
|
||||
Jan Christian Meyer <vimes@odinms.de>
|
||||
|
||||
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 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.
|
||||
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/>.
|
||||
*/
|
||||
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 net.server.channel.handlers;
|
||||
|
||||
import client.MapleCharacter;
|
||||
@@ -29,6 +29,7 @@ import constants.ItemConstants;
|
||||
import net.AbstractMaplePacketHandler;
|
||||
import net.server.Server;
|
||||
import client.inventory.manipulator.MapleInventoryManipulator;
|
||||
import server.MapleItemInformationProvider;
|
||||
import server.life.MapleMonster;
|
||||
import tools.MaplePacketCreator;
|
||||
import tools.data.input.SeekableLittleEndianAccessor;
|
||||
@@ -38,6 +39,7 @@ import tools.data.input.SeekableLittleEndianAccessor;
|
||||
* @author kevintjuh93
|
||||
*/
|
||||
public final class UseCatchItemHandler extends AbstractMaplePacketHandler {
|
||||
|
||||
@Override
|
||||
public final void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) {
|
||||
MapleCharacter chr = c.getPlayer();
|
||||
@@ -48,140 +50,37 @@ public final class UseCatchItemHandler extends AbstractMaplePacketHandler {
|
||||
int itemId = slea.readInt();
|
||||
int monsterid = slea.readInt();
|
||||
|
||||
int itemGanho = MapleItemInformationProvider.getInstance().getCreatItem(itemId);
|
||||
int mobItem = MapleItemInformationProvider.getInstance().getMobItem(itemId);
|
||||
int timeCatch = MapleItemInformationProvider.getInstance().getUseDelay(itemId);
|
||||
int mobHp = MapleItemInformationProvider.getInstance().getMobHP(itemId);
|
||||
|
||||
MapleMonster mob = chr.getMap().getMonsterByOid(monsterid);
|
||||
if (chr.getInventory(ItemConstants.getInventoryType(itemId)).countById(itemId) <= 0) {
|
||||
return;
|
||||
return;
|
||||
}
|
||||
if (mob == null) {
|
||||
return;
|
||||
return;
|
||||
}
|
||||
switch (itemId) {
|
||||
case 2270000:
|
||||
if (mob.getId() == 9300101) {
|
||||
|
||||
if (itemGanho != 0 && mobItem == mob.getId()) {
|
||||
if (timeCatch != 0 && (abm.getLastSpam(10) + timeCatch) < currentServerTime()) {
|
||||
if (mobHp != 0 && mob.getHp() < ((mob.getMaxHp() / 100) * mobHp)) {
|
||||
chr.getMap().broadcastMessage(MaplePacketCreator.catchMonster(monsterid, itemId, (byte) 1));
|
||||
mob.getMap().killMonster(mob, null, false);
|
||||
MapleInventoryManipulator.removeById(c, MapleInventoryType.USE, itemId, 1, true, true);
|
||||
MapleInventoryManipulator.addById(c, 1902000, (short) 1, "", -1);
|
||||
}
|
||||
c.announce(MaplePacketCreator.enableActions());
|
||||
break;
|
||||
case 2270001:
|
||||
if (mob.getId() == 9500197) {
|
||||
if ((abm.getLastSpam(10) + 1000) < currentServerTime()) {
|
||||
if (mob.getHp() < ((mob.getMaxHp() / 10) * 4)) {
|
||||
chr.getMap().broadcastMessage(MaplePacketCreator.catchMonster(monsterid, itemId, (byte) 1));
|
||||
mob.getMap().killMonster(mob, null, false);
|
||||
MapleInventoryManipulator.removeById(c, MapleInventoryType.USE, itemId, 1, true, true);
|
||||
MapleInventoryManipulator.addById(c, 4031830, (short) 1, "", -1);
|
||||
} else {
|
||||
abm.spam(10);
|
||||
c.announce(MaplePacketCreator.catchMessage(0));
|
||||
}
|
||||
MapleInventoryManipulator.addById(c, itemGanho, (short) 1, "", -1);
|
||||
if (itemGanho == 4031868) {
|
||||
chr.updateAriantScore();
|
||||
}
|
||||
c.announce(MaplePacketCreator.enableActions());
|
||||
}
|
||||
break;
|
||||
case 2270002:
|
||||
if (mob.getId() == 9300157) {
|
||||
if ((abm.getLastSpam(10) + 800) < currentServerTime()) {
|
||||
if (mob.getHp() < ((mob.getMaxHp() / 10) * 4)) {
|
||||
if (Math.random() < 0.5) { // 50% chance
|
||||
chr.getMap().broadcastMessage(MaplePacketCreator.catchMonster(monsterid, itemId, (byte) 1));
|
||||
mob.getMap().killMonster(mob, null, false);
|
||||
MapleInventoryManipulator.removeById(c, MapleInventoryType.USE, itemId, 1, true, true);
|
||||
MapleInventoryManipulator.addById(c, 4031868, (short) 1, "", -1);
|
||||
} else {
|
||||
chr.getMap().broadcastMessage(MaplePacketCreator.catchMonster(monsterid, itemId, (byte) 0));
|
||||
}
|
||||
abm.spam(10);
|
||||
} else {
|
||||
c.announce(MaplePacketCreator.catchMessage(0));
|
||||
}
|
||||
}
|
||||
c.announce(MaplePacketCreator.enableActions());
|
||||
}
|
||||
break;
|
||||
case 2270003:
|
||||
if (mob.getId() == 9500320) {
|
||||
if (mob.getHp() < ((mob.getMaxHp() / 10) * 4)) {
|
||||
chr.getMap().broadcastMessage(MaplePacketCreator.catchMonster(monsterid, itemId, (byte) 1));
|
||||
mob.getMap().killMonster(mob, null, false);
|
||||
MapleInventoryManipulator.removeById(c, MapleInventoryType.USE, itemId, 1, true, true);
|
||||
MapleInventoryManipulator.addById(c, 4031887, (short) 1, "", -1);
|
||||
} else {
|
||||
c.announce(MaplePacketCreator.catchMessage(0));
|
||||
}
|
||||
}
|
||||
c.announce(MaplePacketCreator.enableActions());
|
||||
break;
|
||||
case 2270005:
|
||||
if (mob.getId() == 9300187) {
|
||||
if (mob.getHp() < ((mob.getMaxHp() / 10) * 3)) {
|
||||
chr.getMap().broadcastMessage(MaplePacketCreator.catchMonster(monsterid, itemId, (byte) 1));
|
||||
mob.getMap().killMonster(mob, null, false);
|
||||
MapleInventoryManipulator.removeById(c, MapleInventoryType.USE, itemId, 1, true, true);
|
||||
MapleInventoryManipulator.addById(c, 2109001, (short) 1, "", -1);
|
||||
} else {
|
||||
c.announce(MaplePacketCreator.catchMessage(0));
|
||||
}
|
||||
}
|
||||
c.announce(MaplePacketCreator.enableActions());
|
||||
break;
|
||||
case 2270006:
|
||||
if (mob.getId() == 9300189) {
|
||||
if (mob.getHp() < ((mob.getMaxHp() / 10) * 3)) {
|
||||
chr.getMap().broadcastMessage(MaplePacketCreator.catchMonster(monsterid, itemId, (byte) 1));
|
||||
mob.getMap().killMonster(mob, null, false);
|
||||
MapleInventoryManipulator.removeById(c, MapleInventoryType.USE, itemId, 1, true, true);
|
||||
MapleInventoryManipulator.addById(c, 2109002, (short) 1, "", -1);
|
||||
} else {
|
||||
c.announce(MaplePacketCreator.catchMessage(0));
|
||||
}
|
||||
}
|
||||
c.announce(MaplePacketCreator.enableActions());
|
||||
break;
|
||||
case 2270007:
|
||||
if (mob.getId() == 9300191) {
|
||||
if (mob.getHp() < ((mob.getMaxHp() / 10) * 3)) {
|
||||
chr.getMap().broadcastMessage(MaplePacketCreator.catchMonster(monsterid, itemId, (byte) 1));
|
||||
mob.getMap().killMonster(mob, null, false);
|
||||
MapleInventoryManipulator.removeById(c, MapleInventoryType.USE, itemId, 1, true, true);
|
||||
MapleInventoryManipulator.addById(c, 2109003, (short) 1, "", -1);
|
||||
} else {
|
||||
c.announce(MaplePacketCreator.catchMessage(0));
|
||||
}
|
||||
}
|
||||
c.announce(MaplePacketCreator.enableActions());
|
||||
break;
|
||||
case 2270004:
|
||||
if (mob.getId() == 9300175) {
|
||||
if (mob.getHp() < ((mob.getMaxHp() / 10) * 4)) {
|
||||
chr.getMap().broadcastMessage(MaplePacketCreator.catchMonster(monsterid, itemId, (byte) 1));
|
||||
mob.getMap().killMonster(mob, null, false);
|
||||
MapleInventoryManipulator.removeById(c, MapleInventoryType.USE, itemId, 1, true, true);
|
||||
MapleInventoryManipulator.addById(c, 4001169, (short) 1, "", -1);
|
||||
} else {
|
||||
} else if (mobHp != 0 && mob.getId() != 9500336) {
|
||||
abm.spam(10);
|
||||
c.announce(MaplePacketCreator.catchMessage(0));
|
||||
}
|
||||
} else if (mob.getId() == 9500336) {
|
||||
chr.message("You cannot use the Fishing Net yet.");
|
||||
}
|
||||
c.announce(MaplePacketCreator.enableActions());
|
||||
break;
|
||||
case 2270008:
|
||||
if (mob.getId() == 9500336) {
|
||||
if ((abm.getLastSpam(10) + 3000) < currentServerTime()) {
|
||||
abm.spam(10);
|
||||
chr.getMap().broadcastMessage(MaplePacketCreator.catchMonster(monsterid, itemId, (byte) 1));
|
||||
mob.getMap().killMonster(mob, null, false);
|
||||
MapleInventoryManipulator.removeById(c, MapleInventoryType.USE, itemId, 1, true, true);
|
||||
MapleInventoryManipulator.addById(c, 2022323, (short) 1, "", -1);
|
||||
} else {
|
||||
chr.message("You cannot use the Fishing Net yet.");
|
||||
}
|
||||
c.announce(MaplePacketCreator.enableActions());
|
||||
}
|
||||
break;
|
||||
default:
|
||||
// System.out.println("UseCatchItemHandler: \r\n" + slea.toString());
|
||||
}
|
||||
}
|
||||
c.announce(MaplePacketCreator.enableActions());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,6 +72,25 @@ public class MapleDataTool {
|
||||
return getInt(data);
|
||||
}
|
||||
}
|
||||
|
||||
public static int getIntConvert(MapleData d, int def) {
|
||||
if (d == null) {
|
||||
return def;
|
||||
}
|
||||
if (d.getType() == MapleDataType.STRING) {
|
||||
String dd = getString(d);
|
||||
if (dd.endsWith("%")) {
|
||||
dd = dd.substring(0, dd.length() - 1);
|
||||
}
|
||||
try {
|
||||
return Integer.parseInt(dd);
|
||||
} catch (NumberFormatException nfe) {
|
||||
return def;
|
||||
}
|
||||
} else {
|
||||
return getInt(d, def);
|
||||
}
|
||||
}
|
||||
|
||||
public static int getIntConvert(String path, MapleData data) {
|
||||
MapleData d = data.getChildByPath(path);
|
||||
|
||||
@@ -55,7 +55,6 @@ import tools.MaplePacketCreator;
|
||||
import client.MapleCharacter;
|
||||
import client.MapleClient;
|
||||
import client.MapleQuestStatus;
|
||||
import client.MapleStat;
|
||||
import client.SkillFactory;
|
||||
import client.inventory.Equip;
|
||||
import client.inventory.Item;
|
||||
@@ -331,7 +330,7 @@ public class AbstractPlayerInteraction {
|
||||
return true;
|
||||
}
|
||||
|
||||
//---- \/ \/ \/ \/ \/ \/ \/ NOT TESTED \/ \/ \/ \/ \/ \/ \/ \/ \/ ----
|
||||
//---- \/ \/ \/ \/ \/ \/ \/ NOT TESTED \/ \/ \/ \/ \/ \/ \/ \/ \/ ----
|
||||
public final MapleQuestStatus getQuestRecord(final int id) {
|
||||
return c.getPlayer().getQuestNAdd(MapleQuest.getInstance(id));
|
||||
}
|
||||
@@ -340,7 +339,7 @@ public class AbstractPlayerInteraction {
|
||||
return c.getPlayer().getQuestNoAdd(MapleQuest.getInstance(id));
|
||||
}
|
||||
|
||||
//---- /\ /\ /\ /\ /\ /\ /\ NOT TESTED /\ /\ /\ /\ /\ /\ /\ /\ /\ ----
|
||||
//---- /\ /\ /\ /\ /\ /\ /\ NOT TESTED /\ /\ /\ /\ /\ /\ /\ /\ /\ ----
|
||||
public void openNpc(int npcid) {
|
||||
openNpc(npcid, null);
|
||||
}
|
||||
@@ -745,7 +744,7 @@ public class AbstractPlayerInteraction {
|
||||
}
|
||||
|
||||
public void givePartyExp(String PQ, boolean instance) {
|
||||
//1 player = +0% bonus (100)
|
||||
//1 player = +0% bonus (100)
|
||||
//2 players = +0% bonus (100)
|
||||
//3 players = +0% bonus (100)
|
||||
//4 players = +10% bonus (110)
|
||||
@@ -1025,6 +1024,33 @@ public class AbstractPlayerInteraction {
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getNomeDosMembrosExpedition(MapleExpeditionType tipo) {
|
||||
String membros = "";
|
||||
MapleExpedition expedicao = getExpedition(tipo);
|
||||
for (String memberName : expedicao.getMembers().values()) {
|
||||
membros += "" + memberName + ", ";
|
||||
}
|
||||
return membros;
|
||||
}
|
||||
|
||||
public boolean getIsLeaderExpedition(MapleExpeditionType tipo) {
|
||||
MapleExpedition expedicao = getExpedition(tipo);
|
||||
return expedicao.isLeader(getPlayer());
|
||||
}
|
||||
|
||||
public void warpExpedition(int mapId, MapleExpeditionType tipo) {
|
||||
if (tipo != null ) {
|
||||
MapleExpedition expedicao = getExpedition(tipo);
|
||||
for (MapleCharacter chr : expedicao.getActiveMembers()) {
|
||||
chr.changeMap(mapId);
|
||||
}
|
||||
} else {
|
||||
for (MapleCharacter chr : getMap().getAllPlayers()) {
|
||||
chr.changeMap(mapId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public long getJailTimeLeft() {
|
||||
return getPlayer().getJailExpirationTimeLeft();
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -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 getCreatItem(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)) {
|
||||
|
||||
@@ -125,10 +125,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 +208,24 @@ 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;
|
||||
}
|
||||
ret.barrier = MapleDataTool.getInt("barrier", source, 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,8 +246,15 @@ public class MapleStatEffect {
|
||||
ret.speed = (short) MapleDataTool.getInt("speed", source, 0);
|
||||
ret.jump = (short) MapleDataTool.getInt("jump", source, 0);
|
||||
|
||||
|
||||
if (MapleDataTool.getInt("barrier", source, 0) > 0) {
|
||||
ret.barrier = MapleDataTool.getInt("barrier", source, 0);
|
||||
addBuffStatPairToListIfNotZero(statups, MapleBuffStat.ARIANT_PQ_SHIELD, Integer.valueOf(1));
|
||||
}
|
||||
|
||||
ret.mapProtection = mapProtection(sourceid);
|
||||
addBuffStatPairToListIfNotZero(statups, MapleBuffStat.MAP_PROTECTION, Integer.valueOf(ret.mapProtection));
|
||||
|
||||
|
||||
if (ret.overTime && ret.getSummonMovementType() == null) {
|
||||
if (!skill) {
|
||||
@@ -974,8 +999,19 @@ public class MapleStatEffect {
|
||||
applyfrom.dispelDebuff(debuff);
|
||||
}
|
||||
}
|
||||
} else if (mobSkill > 0 && mobSkillLevel > 0) {
|
||||
if (target > 0) {
|
||||
for (MapleCharacter chr : applyto.getMap().getAllPlayers()) {
|
||||
if (chr.getId() != applyto.getId()) {
|
||||
chr.disease(mobSkill, mobSkillLevel);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
applyto.disease(mobSkill, mobSkillLevel);
|
||||
}
|
||||
} else if (barrier > 0) {
|
||||
applyto.shield();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1195,7 +1231,6 @@ public class MapleStatEffect {
|
||||
|
||||
localstatups = statups;
|
||||
}
|
||||
|
||||
buff = MaplePacketCreator.giveBuff(localsourceid, localDuration, localstatups);
|
||||
mbuff = MaplePacketCreator.showMonsterRiding(applyto.getId(), givemount);
|
||||
localDuration = duration;
|
||||
|
||||
@@ -1,25 +1,3 @@
|
||||
/*
|
||||
This file is part of the OdinMS Maple Story Server
|
||||
Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc>
|
||||
Matthias Butz <matze@odinms.de>
|
||||
Jan Christian Meyer <vimes@odinms.de>
|
||||
|
||||
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.expeditions;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
@@ -41,6 +19,10 @@ import server.maps.MapleMap;
|
||||
import tools.LogHelper;
|
||||
import tools.MaplePacketCreator;
|
||||
import client.MapleCharacter;
|
||||
import java.util.Properties;
|
||||
import net.server.audit.locks.MonitoredLockType;
|
||||
import net.server.audit.locks.MonitoredReentrantLock;
|
||||
import net.server.audit.locks.factory.MonitoredReentrantLockFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -48,236 +30,307 @@ import client.MapleCharacter;
|
||||
*/
|
||||
public class MapleExpedition {
|
||||
|
||||
private static final int [] EXPEDITION_BOSSES = {
|
||||
8800000,// - Zakum's first body
|
||||
8800001,// - Zakum's second body
|
||||
8800002,// - Zakum's third body
|
||||
8800003,// - Zakum's Arm 1
|
||||
8800004,// - Zakum's Arm 2
|
||||
8800005,// - Zakum's Arm 3
|
||||
8800006,// - Zakum's Arm 4
|
||||
8800007,// - Zakum's Arm 5
|
||||
8800008,// - Zakum's Arm 6
|
||||
8800009,// - Zakum's Arm 7
|
||||
8800010,// - Zakum's Arm 8
|
||||
8810000,// - Horntail's Left Head
|
||||
8810001,// - Horntail's Right Head
|
||||
8810002,// - Horntail's Head A
|
||||
8810003,// - Horntail's Head B
|
||||
8810004,// - Horntail's Head C
|
||||
8810005,// - Horntail's Left Hand
|
||||
8810006,// - Horntail's Right Hand
|
||||
8810007,// - Horntail's Wings
|
||||
8810008,// - Horntail's Legs
|
||||
8810009,// - Horntail's Tails
|
||||
9420546,// - Scarlion Boss
|
||||
9420547,// - Scarlion Boss
|
||||
9420548,// - Angry Scarlion Boss
|
||||
9420549,// - Furious Scarlion Boss
|
||||
9420541,// - Targa
|
||||
9420542,// - Targa
|
||||
9420543,// - Angry Targa
|
||||
9420544,// - Furious Targa
|
||||
};
|
||||
|
||||
private MapleCharacter leader;
|
||||
private MapleExpeditionType type;
|
||||
private boolean registering;
|
||||
private MapleMap startMap;
|
||||
private List<String> bossLogs;
|
||||
private ScheduledFuture<?> schedule;
|
||||
private Map<Integer, String> members = new ConcurrentHashMap<>();
|
||||
private List<Integer> banned = new CopyOnWriteArrayList<>();
|
||||
private long startTime;
|
||||
private static final int[] EXPEDITION_BOSSES = {
|
||||
8800000,// - Zakum's first body
|
||||
8800001,// - Zakum's second body
|
||||
8800002,// - Zakum's third body
|
||||
8800003,// - Zakum's Arm 1
|
||||
8800004,// - Zakum's Arm 2
|
||||
8800005,// - Zakum's Arm 3
|
||||
8800006,// - Zakum's Arm 4
|
||||
8800007,// - Zakum's Arm 5
|
||||
8800008,// - Zakum's Arm 6
|
||||
8800009,// - Zakum's Arm 7
|
||||
8800010,// - Zakum's Arm 8
|
||||
8810000,// - Horntail's Left Head
|
||||
8810001,// - Horntail's Right Head
|
||||
8810002,// - Horntail's Head A
|
||||
8810003,// - Horntail's Head B
|
||||
8810004,// - Horntail's Head C
|
||||
8810005,// - Horntail's Left Hand
|
||||
8810006,// - Horntail's Right Hand
|
||||
8810007,// - Horntail's Wings
|
||||
8810008,// - Horntail's Legs
|
||||
8810009,// - Horntail's Tails
|
||||
9420546,// - Scarlion Boss
|
||||
9420547,// - Scarlion Boss
|
||||
9420548,// - Angry Scarlion Boss
|
||||
9420549,// - Furious Scarlion Boss
|
||||
9420541,// - Targa
|
||||
9420542,// - Targa
|
||||
9420543,// - Angry Targa
|
||||
9420544,// - Furious Targa
|
||||
};
|
||||
|
||||
public MapleExpedition(MapleCharacter player, MapleExpeditionType met) {
|
||||
leader = player;
|
||||
members.put(player.getId(), player.getName());
|
||||
startMap = player.getMap();
|
||||
type = met;
|
||||
bossLogs = new CopyOnWriteArrayList<>();
|
||||
beginRegistration();
|
||||
}
|
||||
private MapleCharacter leader;
|
||||
private MapleExpeditionType type;
|
||||
private boolean registering;
|
||||
private MapleMap startMap;
|
||||
private List<String> bossLogs;
|
||||
private ScheduledFuture<?> schedule;
|
||||
private Map<Integer, String> members = new ConcurrentHashMap<>();
|
||||
private List<Integer> banned = new CopyOnWriteArrayList<>();
|
||||
private long startTime;
|
||||
private Properties props = new Properties();
|
||||
private MonitoredReentrantLock pL = MonitoredReentrantLockFactory.createLock(MonitoredLockType.EIM_PARTY, true);
|
||||
|
||||
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."));
|
||||
scheduleRegistrationEnd();
|
||||
}
|
||||
public MapleExpedition(MapleCharacter player, MapleExpeditionType met) {
|
||||
leader = player;
|
||||
members.put(player.getId(), player.getName());
|
||||
startMap = player.getMap();
|
||||
type = met;
|
||||
bossLogs = new CopyOnWriteArrayList<>();
|
||||
beginRegistration();
|
||||
}
|
||||
|
||||
private void scheduleRegistrationEnd() {
|
||||
final MapleExpedition exped = this;
|
||||
startTime = System.currentTimeMillis() + type.getRegistrationTime() * 60 * 1000;
|
||||
|
||||
schedule = TimerManager.getInstance().schedule(new Runnable() {
|
||||
@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."));
|
||||
|
||||
dispose(false);
|
||||
}
|
||||
}
|
||||
}, type.getRegistrationTime() * 60 * 1000);
|
||||
}
|
||||
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."));
|
||||
|
||||
public void dispose(boolean log){
|
||||
broadcastExped(MaplePacketCreator.removeClock());
|
||||
|
||||
if (schedule != null){
|
||||
schedule.cancel(false);
|
||||
}
|
||||
if (log && !registering){
|
||||
LogHelper.logExpedition(this);
|
||||
}
|
||||
}
|
||||
if (!MapleExpeditionType.ARIANT.equals(type) && !MapleExpeditionType.ARIANT1.equals(type) && !MapleExpeditionType.ARIANT2.equals(type)) {
|
||||
scheduleRegistrationEnd();
|
||||
}
|
||||
}
|
||||
|
||||
public void start(){
|
||||
registering = false;
|
||||
broadcastExped(MaplePacketCreator.removeClock());
|
||||
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()));
|
||||
}
|
||||
private void scheduleRegistrationEnd() {
|
||||
final MapleExpedition exped = this;
|
||||
startTime = System.currentTimeMillis() + type.getRegistrationTime() * 60 * 1000;
|
||||
|
||||
public String addMember(MapleCharacter player) {
|
||||
if (!registering){
|
||||
return "Sorry, this expedition is already underway. Registration is closed!";
|
||||
}
|
||||
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
|
||||
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!"));
|
||||
return "You have registered for the expedition successfully!";
|
||||
}
|
||||
schedule = TimerManager.getInstance().schedule(new Runnable() {
|
||||
@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."));
|
||||
|
||||
private void broadcastExped(byte[] packet){
|
||||
for (MapleCharacter chr : getActiveMembers()){
|
||||
chr.announce(packet);
|
||||
}
|
||||
}
|
||||
|
||||
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.");
|
||||
return true;
|
||||
dispose(false);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}, type.getRegistrationTime() * 60 * 1000);
|
||||
}
|
||||
|
||||
public MapleExpeditionType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public List<MapleCharacter> getActiveMembers() { // thanks MedicOP for figuring out an issue with broadcasting packets to offline members
|
||||
PlayerStorage ps = startMap.getWorldServer().getPlayerStorage();
|
||||
|
||||
List<MapleCharacter> activeMembers = new LinkedList<>();
|
||||
for (Integer chrid : getMembers().keySet()){
|
||||
MapleCharacter chr = ps.getCharacterById(chrid);
|
||||
if (chr != null && chr.isLoggedinWorld()) {
|
||||
activeMembers.add(chr);
|
||||
}
|
||||
}
|
||||
|
||||
return activeMembers;
|
||||
public void dispose(boolean log) {
|
||||
broadcastExped(MaplePacketCreator.removeClock());
|
||||
|
||||
if (schedule != null) {
|
||||
schedule.cancel(false);
|
||||
}
|
||||
|
||||
public Map<Integer, String> getMembers() {
|
||||
return new HashMap<>(members);
|
||||
}
|
||||
|
||||
public List<Entry<Integer, String>> getMemberList() {
|
||||
List<Entry<Integer, String>> memberList = new LinkedList<>();
|
||||
Entry<Integer, String> leaderEntry = null;
|
||||
|
||||
for (Entry<Integer, String> e : getMembers().entrySet()) {
|
||||
if (!isLeader(e.getKey())) {
|
||||
memberList.add(e);
|
||||
} else {
|
||||
leaderEntry = e;
|
||||
}
|
||||
}
|
||||
|
||||
if (leaderEntry != null) {
|
||||
memberList.add(0, leaderEntry);
|
||||
}
|
||||
|
||||
return memberList;
|
||||
}
|
||||
props.clear();
|
||||
if (log && !registering) {
|
||||
LogHelper.logExpedition(this);
|
||||
}
|
||||
}
|
||||
|
||||
public MapleCharacter getLeader(){
|
||||
return leader;
|
||||
}
|
||||
|
||||
public MapleMap getRecruitingMap() {
|
||||
return startMap;
|
||||
public void start() {
|
||||
if (MapleExpeditionType.ARIANT.equals(type) || MapleExpeditionType.ARIANT1.equals(type) || MapleExpeditionType.ARIANT2.equals(type)) {
|
||||
startTime = System.currentTimeMillis() + type.getRegistrationTime() * 60 * 1000;
|
||||
}
|
||||
registering = false;
|
||||
broadcastExped(MaplePacketCreator.removeClock());
|
||||
broadcastExped(MaplePacketCreator.serverNotice(6, "[Expedition] The expedition has started! Good luck, brave heroes!"));
|
||||
broadcastExped(MaplePacketCreator.getClock((int) (startTime - System.currentTimeMillis()) / 1000));
|
||||
Server.getInstance().broadcastGMMessage(startMap.getWorld(), MaplePacketCreator.serverNotice(6, "[Expedition] " + type.toString() + " Expedition started with leader: " + leader.getName()));
|
||||
}
|
||||
|
||||
public String addMember(MapleCharacter player) {
|
||||
if (!registering) {
|
||||
return "Sorry, this expedition is already underway. Registration is closed!";
|
||||
}
|
||||
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
|
||||
return "Sorry, this expedition is full!";
|
||||
}
|
||||
|
||||
public boolean contains(MapleCharacter player) {
|
||||
return members.containsKey(player.getId()) || isLeader(player);
|
||||
}
|
||||
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!"));
|
||||
return "You have registered for the expedition successfully!";
|
||||
}
|
||||
|
||||
public boolean isLeader(MapleCharacter player) {
|
||||
return isLeader(player.getId());
|
||||
}
|
||||
|
||||
public boolean isLeader(int playerid) {
|
||||
return leader.getId() == playerid;
|
||||
}
|
||||
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() >= type.getMaxSize()) { //Would be a miracle if anybody ever saw this
|
||||
return 3; //"Sorry, this expedition is full!";
|
||||
}
|
||||
|
||||
public boolean isRegistering(){
|
||||
return registering;
|
||||
}
|
||||
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!"));
|
||||
return 0; //"You have registered for the expedition successfully!";
|
||||
}
|
||||
|
||||
public boolean isInProgress(){
|
||||
return !registering;
|
||||
}
|
||||
private void broadcastExped(byte[] packet) {
|
||||
for (MapleCharacter chr : getActiveMembers()) {
|
||||
chr.announce(packet);
|
||||
}
|
||||
}
|
||||
|
||||
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 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.");
|
||||
return true;
|
||||
}
|
||||
|
||||
public long getStartTime(){
|
||||
return startTime;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public MapleExpeditionType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public List<MapleCharacter> getActiveMembers() { // thanks MedicOP for figuring out an issue with broadcasting packets to offline members
|
||||
PlayerStorage ps = startMap.getWorldServer().getPlayerStorage();
|
||||
|
||||
List<MapleCharacter> activeMembers = new LinkedList<>();
|
||||
for (Integer chrid : getMembers().keySet()) {
|
||||
MapleCharacter chr = ps.getCharacterById(chrid);
|
||||
if (chr != null && chr.isLoggedinWorld()) {
|
||||
activeMembers.add(chr);
|
||||
}
|
||||
}
|
||||
|
||||
return activeMembers;
|
||||
}
|
||||
|
||||
public Map<Integer, String> getMembers() {
|
||||
return new HashMap<>(members);
|
||||
}
|
||||
|
||||
public List<Entry<Integer, String>> getMemberList() {
|
||||
List<Entry<Integer, String>> memberList = new LinkedList<>();
|
||||
Entry<Integer, String> leaderEntry = null;
|
||||
|
||||
for (Entry<Integer, String> e : getMembers().entrySet()) {
|
||||
if (!isLeader(e.getKey())) {
|
||||
memberList.add(e);
|
||||
} else {
|
||||
leaderEntry = e;
|
||||
}
|
||||
}
|
||||
|
||||
if (leaderEntry != null) {
|
||||
memberList.add(0, leaderEntry);
|
||||
}
|
||||
|
||||
return memberList;
|
||||
}
|
||||
|
||||
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.");
|
||||
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 MapleCharacter getLeader() {
|
||||
return leader;
|
||||
}
|
||||
|
||||
public MapleMap getRecruitingMap() {
|
||||
return startMap;
|
||||
}
|
||||
|
||||
public boolean contains(MapleCharacter player) {
|
||||
return members.containsKey(player.getId()) || isLeader(player);
|
||||
}
|
||||
|
||||
public boolean isLeader(MapleCharacter player) {
|
||||
return isLeader(player.getId());
|
||||
}
|
||||
|
||||
public boolean isLeader(int playerid) {
|
||||
return leader.getId() == playerid;
|
||||
}
|
||||
|
||||
public boolean isRegistering() {
|
||||
return registering;
|
||||
}
|
||||
|
||||
public boolean isInProgress() {
|
||||
return !registering;
|
||||
}
|
||||
|
||||
public long getStartTime() {
|
||||
return startTime;
|
||||
}
|
||||
|
||||
public List<String> getBossLogs() {
|
||||
return bossLogs;
|
||||
}
|
||||
|
||||
public MapleMap getStartMap() {
|
||||
return startMap;
|
||||
}
|
||||
|
||||
public void setStartMap(MapleMap startMap) {
|
||||
this.startMap = startMap;
|
||||
}
|
||||
|
||||
public ScheduledFuture<?> getSchedule() {
|
||||
return schedule;
|
||||
}
|
||||
|
||||
public void setSchedule(ScheduledFuture<?> schedule) {
|
||||
this.schedule = schedule;
|
||||
}
|
||||
|
||||
public List<Integer> getBanned() {
|
||||
return banned;
|
||||
}
|
||||
|
||||
public void setBanned(List<Integer> banned) {
|
||||
this.banned = banned;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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, 4, 20, 30, 5),
|
||||
ARIANT1(2, 4, 20, 30, 5),
|
||||
ARIANT2(2, 4, 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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -299,7 +299,7 @@ public class MapleLifeFactory {
|
||||
private int id;
|
||||
private byte chance, x;
|
||||
|
||||
private loseItem(int id, byte chance, byte x) {
|
||||
public loseItem(int id, byte chance, byte x) {
|
||||
this.id = id;
|
||||
this.chance = chance;
|
||||
this.x = x;
|
||||
|
||||
@@ -186,7 +186,12 @@ public class MapleMonsterInformationProvider {
|
||||
if (monsterId >= 9300127 && monsterId <= 9300136 || monsterId >= 9300315 && monsterId <= 9300324) {
|
||||
int dropArray[] = {2022157, 2022158, 2022159, 2022160, 2022161, 2022162, 2022163, 2022164, 2022165, 2022166, 2022167, 2022168, 2022169, 2022170, 2022171, 2022172, 2022173, 2022174, 2022175, 2022176, 2022177, 2022178, 4001129}; //These are the drops, -1 means meso :D
|
||||
for (int id : dropArray) {
|
||||
ret.add(new MonsterDropEntry(id, 2000, 1, 1, (short) 0));
|
||||
ret.add(new MonsterDropEntry(id, 20000, 1, 1, (short) 0));
|
||||
}
|
||||
} else if (monsterId == 9300157) {
|
||||
int dropArray[] = {2022266, 2022267, 2022268, 2022269}; //These are the drops, -1 means meso :D
|
||||
for (int id : dropArray) {
|
||||
ret.add(new MonsterDropEntry(id, 20000, 1, 1, (short) 0));
|
||||
}
|
||||
} else {
|
||||
PreparedStatement ps = null;
|
||||
|
||||
@@ -1,24 +1,3 @@
|
||||
/*
|
||||
This file is part of the OdinMS Maple Story Server
|
||||
Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc>
|
||||
Matthias Butz <matze@odinms.de>
|
||||
Jan Christian Meyer <vimes@odinms.de>
|
||||
|
||||
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.maps;
|
||||
|
||||
import client.MapleBuffStat;
|
||||
@@ -84,9 +63,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;
|
||||
@@ -162,6 +141,13 @@ public class MapleMap {
|
||||
private MapleSnowball snowball0 = null;
|
||||
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;
|
||||
@@ -2499,6 +2485,42 @@ public class MapleMap {
|
||||
if (mmd != null) {
|
||||
mmd.registerPlayer(chr);
|
||||
}
|
||||
} else if (mapid == 980010101 || mapid == 980010201 || mapid == 980010301) { // AriantPQ
|
||||
int pqTimer = (10 * 60 * 1000);
|
||||
int pqTimerBord = (9 * 60 * 1000) + 50 * 1000;
|
||||
|
||||
chr.announce(MaplePacketCreator.getClock(pqTimer / 1000));
|
||||
|
||||
chr.setAriantScore(TimerManager.getInstance().schedule(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (chr.getMapId() == 980010101 || chr.getMapId() == 980010201 || chr.getMapId() == 980010301) {
|
||||
broadcastMessage(MaplePacketCreator.showAriantScoreBoard());
|
||||
killAllMonsters();
|
||||
}
|
||||
}
|
||||
}, pqTimerBord));
|
||||
|
||||
chr.setPqMapleMap(TimerManager.getInstance().schedule(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (chr.getMapId() == 980010101 || chr.getMapId() == 980010201 || chr.getMapId() == 980010301) {
|
||||
MapleExpedition exp = null;
|
||||
if (chr.getMapId() == 980010101) {
|
||||
exp = chr.getClient().getAbstractPlayerInteraction().getExpedition(MapleExpeditionType.ARIANT);
|
||||
} else if (chr.getMapId() == 980010201) {
|
||||
exp = chr.getClient().getAbstractPlayerInteraction().getExpedition(MapleExpeditionType.ARIANT1);
|
||||
} else {
|
||||
exp = chr.getClient().getAbstractPlayerInteraction().getExpedition(MapleExpeditionType.ARIANT2);
|
||||
}
|
||||
chr.changeMap(980010010, 0);
|
||||
chr.cancelPqMapleMap();
|
||||
if (exp != null) {
|
||||
chr.getClient().getAbstractPlayerInteraction().endExpedition(exp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}, pqTimer));
|
||||
}
|
||||
|
||||
MaplePet[] pets = chr.getPets();
|
||||
@@ -4350,7 +4372,7 @@ public class MapleMap {
|
||||
public final List<Pair<Integer, Integer>> getMobsToSpawn() {
|
||||
return mobsToSpawn;
|
||||
}
|
||||
|
||||
|
||||
public boolean isCPQWinnerMap() {
|
||||
switch (this.getId()) {
|
||||
case 980000103:
|
||||
@@ -4382,4 +4404,44 @@ public class MapleMap {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
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;
|
||||
@@ -313,6 +313,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)));
|
||||
@@ -320,18 +325,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) {
|
||||
|
||||
@@ -14,7 +14,6 @@ import tools.MaplePacketCreator;
|
||||
/**
|
||||
* @author Drago/Dragohe4rt
|
||||
*/
|
||||
|
||||
public class MonsterCarnival {
|
||||
|
||||
public static int D = 3;
|
||||
@@ -36,6 +35,8 @@ public class MonsterCarnival {
|
||||
this.cpq1 = cpq1;
|
||||
this.p1 = p1;
|
||||
this.p2 = p2;
|
||||
setSummons(map.getMaxMobs());
|
||||
setSummonss(map.getMaxMobs());
|
||||
Channel cs = Server.getInstance().getWorld(p2.getLeader().getWorld()).getChannel(p2.getLeader().getChannel());
|
||||
p1.setEnemy(p2);
|
||||
p2.setEnemy(p1);
|
||||
@@ -91,17 +92,17 @@ 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() - 10) * 1000 - 10 * 1000);
|
||||
TimerManager.getInstance().schedule(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
map.addClock(60 * 10);
|
||||
map.addClock(map.getTimeDefault() - 10);
|
||||
}
|
||||
}, 2000);
|
||||
} catch (Exception e) {
|
||||
@@ -321,13 +322,13 @@ 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);
|
||||
}, map.getTimeExpand() * 1000 - 10);
|
||||
}
|
||||
|
||||
public void complete() {
|
||||
@@ -486,4 +487,20 @@ public class MonsterCarnival {
|
||||
this.blueCP = CP;
|
||||
}
|
||||
}
|
||||
|
||||
public int getSummons() {
|
||||
return summons;
|
||||
}
|
||||
|
||||
public void setSummons(int summons) {
|
||||
this.summons = summons;
|
||||
}
|
||||
|
||||
public int getSummonss() {
|
||||
return summonss;
|
||||
}
|
||||
|
||||
public void setSummonss(int summonss) {
|
||||
this.summonss = summonss;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,125 +0,0 @@
|
||||
package server.partyquest;
|
||||
|
||||
import client.MapleCharacter;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import server.maps.MapleMap;
|
||||
import tools.MaplePacketCreator;
|
||||
|
||||
/**
|
||||
* @author Rob
|
||||
*/
|
||||
public class MonsterCarnivalParty {
|
||||
|
||||
private List<MapleCharacter> members = new LinkedList<>();
|
||||
private MapleCharacter leader;
|
||||
private byte team;
|
||||
private short availableCP = 0, totalCP = 0;
|
||||
private int summons = 7;
|
||||
private boolean winner = false;
|
||||
|
||||
public MonsterCarnivalParty(final MapleCharacter owner, final List<MapleCharacter> members1, final byte team1) {
|
||||
leader = owner;
|
||||
members = members1;
|
||||
team = team1;
|
||||
|
||||
for (final MapleCharacter chr : members) {
|
||||
chr.setCarnivalParty(this);
|
||||
chr.setTeam(team);
|
||||
}
|
||||
}
|
||||
|
||||
public final MapleCharacter getLeader() {
|
||||
return leader;
|
||||
}
|
||||
|
||||
public void addCP(MapleCharacter player, int ammount) {
|
||||
totalCP += ammount;
|
||||
availableCP += ammount;
|
||||
player.addCP(ammount);
|
||||
}
|
||||
|
||||
public int getTotalCP() {
|
||||
return totalCP;
|
||||
}
|
||||
|
||||
public int getAvailableCP() {
|
||||
return availableCP;
|
||||
}
|
||||
|
||||
public void useCP(MapleCharacter player, int ammount) {
|
||||
availableCP -= ammount;
|
||||
player.useCP(ammount);
|
||||
}
|
||||
|
||||
public List<MapleCharacter> getMembers() {
|
||||
return members;
|
||||
}
|
||||
|
||||
public int getTeam() {
|
||||
return team;
|
||||
}
|
||||
|
||||
public void warpOut(final int map) {
|
||||
for (MapleCharacter chr : members) {
|
||||
chr.changeMap(map, 0);
|
||||
chr.setCarnivalParty(null);
|
||||
chr.setCarnival(null);
|
||||
}
|
||||
members.clear();
|
||||
}
|
||||
|
||||
public void warp(final MapleMap map, final int portalid) {
|
||||
for (MapleCharacter chr : members) {
|
||||
chr.changeMap(map, map.getPortal(portalid));
|
||||
}
|
||||
}
|
||||
|
||||
public void warpOut() {
|
||||
if (winner == true)
|
||||
warpOut(980000003 + (leader.getCarnival().getRoom() * 100));
|
||||
else
|
||||
warpOut(980000004 + (leader.getCarnival().getRoom() * 100));
|
||||
}
|
||||
|
||||
public boolean allInMap(MapleMap map) {
|
||||
boolean status = true;
|
||||
for (MapleCharacter chr : members) {
|
||||
if (chr.getMap() != map) {
|
||||
status = false;
|
||||
}
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
public void removeMember(MapleCharacter chr) {
|
||||
members.remove(chr);
|
||||
chr.changeMap(980000010);
|
||||
chr.setCarnivalParty(null);
|
||||
chr.setCarnival(null);
|
||||
}
|
||||
|
||||
public boolean isWinner() {
|
||||
return winner;
|
||||
}
|
||||
|
||||
public void setWinner(boolean status) {
|
||||
winner = status;
|
||||
}
|
||||
|
||||
public void displayMatchResult() {
|
||||
final String effect = winner ? "quest/carnival/win" : "quest/carnival/lose";
|
||||
|
||||
for (final MapleCharacter chr : members) {
|
||||
chr.announce(MaplePacketCreator.showEffect(effect));
|
||||
}
|
||||
}
|
||||
|
||||
public void summon() {
|
||||
this.summons--;
|
||||
}
|
||||
|
||||
public boolean canSummon() {
|
||||
return this.summons > 0;
|
||||
}
|
||||
}
|
||||
@@ -4988,7 +4988,7 @@ public class MaplePacketCreator {
|
||||
|
||||
public static byte[] updateAriantPQRanking(String name, int score, boolean empty) {
|
||||
final MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
|
||||
mplew.writeShort(SendOpcode.ARIANT_SCORE.getValue());
|
||||
mplew.writeShort(SendOpcode.ARIANT_ARENA_USER_SCORE.getValue());
|
||||
mplew.write(empty ? 0 : 1);
|
||||
if (!empty) {
|
||||
mplew.writeMapleAsciiString(name);
|
||||
@@ -4996,6 +4996,12 @@ public class MaplePacketCreator {
|
||||
}
|
||||
return mplew.getPacket();
|
||||
}
|
||||
|
||||
public static byte[] showAriantScoreBoard() {
|
||||
MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
|
||||
mplew.writeShort(SendOpcode.ARIANT_ARENA_SHOW_RESULT.getValue());
|
||||
return mplew.getPacket();
|
||||
}
|
||||
|
||||
public static byte[] catchMessage(int message) { // not done, I guess
|
||||
final MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
|
||||
|
||||
Reference in New Issue
Block a user