The great MCPQ Merge offensive
Fulfilled the lovely pull request #427 from @dragoso, which added in backing code content to HeavenMS. Implemented structural changes for the Marriage wishlist, in order to receive, maintain and distribute gifts to spouses. Added untradeable check on wishlist gift handler. Adjusted CPQ drops to actually load from DB rathe than hard-coded. Fixed CPQ "random disease to player/party" functionality not applying properly. Adjusted how CPQ maps are generated. It directly loads a new area from WZ (this process should at least removes the player's spawned mobs) rather than reset the cache at every MCPQ creation.
This commit is contained in:
@@ -0,0 +1,183 @@
|
||||
/*
|
||||
This file is part of the HeavenMS MapleStory Server
|
||||
Copyleft (L) 2016 - 2018 RonanLana
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation version 3 as published by
|
||||
the Free Software Foundation. You may not use, modify or distribute
|
||||
this program under any other version of the GNU Affero General Public
|
||||
License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package server;
|
||||
|
||||
import client.MapleClient;
|
||||
import client.MapleCharacter;
|
||||
import client.inventory.Item;
|
||||
import client.inventory.ItemFactory;
|
||||
import client.inventory.MapleInventory;
|
||||
import client.inventory.MapleInventoryType;
|
||||
import client.inventory.manipulator.MapleInventoryManipulator;
|
||||
import scripting.event.EventInstanceManager;
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import scripting.event.EventManager;
|
||||
import tools.DatabaseConnection;
|
||||
import tools.Pair;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Ronan
|
||||
*/
|
||||
public class MapleMarriage extends EventInstanceManager {
|
||||
|
||||
public MapleMarriage(EventManager em, String name) {
|
||||
super(em, name);
|
||||
}
|
||||
|
||||
public boolean giftItemToSpouse(int cid) {
|
||||
return this.getIntProperty("wishlistSelection") == 0;
|
||||
}
|
||||
|
||||
public List<String> getWishlistItems(boolean groom) {
|
||||
String strItems = this.getProperty(groom ? "groomWishlist" : "brideWishlist");
|
||||
if (strItems != null) {
|
||||
return Arrays.asList(strItems.split("\r\n"));
|
||||
}
|
||||
|
||||
return new LinkedList<>();
|
||||
}
|
||||
|
||||
public void initializeGiftItems() {
|
||||
List<Item> groomGifts = new ArrayList<>();
|
||||
this.setObjectProperty("groomGiftlist", groomGifts);
|
||||
|
||||
List<Item> brideGifts = new ArrayList<>();
|
||||
this.setObjectProperty("brideGiftlist", brideGifts);
|
||||
}
|
||||
|
||||
public List<Item> getGiftItems(MapleClient c, boolean groom) {
|
||||
c.tryacquireClient();
|
||||
try {
|
||||
List<Item> gifts = getGiftItemsList(groom);
|
||||
synchronized (gifts) {
|
||||
return new LinkedList<>(gifts);
|
||||
}
|
||||
} finally {
|
||||
c.releaseClient();
|
||||
}
|
||||
}
|
||||
|
||||
private List<Item> getGiftItemsList(boolean groom) {
|
||||
return (List<Item>) this.getObjectProperty(groom ? "groomGiftlist" : "brideGiftlist");
|
||||
}
|
||||
|
||||
public Item getGiftItem(MapleClient c, boolean groom, int idx) {
|
||||
try {
|
||||
return getGiftItems(c, groom).get(idx);
|
||||
} catch (IndexOutOfBoundsException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public void addGiftItem(boolean groom, Item item) {
|
||||
List<Item> gifts = getGiftItemsList(groom);
|
||||
synchronized (gifts) {
|
||||
gifts.add(item);
|
||||
}
|
||||
}
|
||||
|
||||
public void removeGiftItem(boolean groom, Item item) {
|
||||
List<Item> gifts = getGiftItemsList(groom);
|
||||
synchronized (gifts) {
|
||||
gifts.remove(item);
|
||||
}
|
||||
}
|
||||
|
||||
public Boolean isMarriageGroom(MapleCharacter chr) {
|
||||
Boolean groom = null;
|
||||
try {
|
||||
int groomid = this.getIntProperty("groomId"), brideid = this.getIntProperty("brideId");
|
||||
if (chr.getId() == groomid) {
|
||||
groom = true;
|
||||
} else if (chr.getId() == brideid) {
|
||||
groom = false;
|
||||
}
|
||||
} catch (NumberFormatException nfe) {}
|
||||
|
||||
return groom;
|
||||
}
|
||||
|
||||
public static boolean claimGiftItems(MapleClient c, MapleCharacter chr) {
|
||||
List<Item> gifts = loadGiftItemsFromDb(c, chr.getId());
|
||||
if (MapleInventory.checkSpot(chr, gifts)) {
|
||||
try {
|
||||
Connection con = DatabaseConnection.getConnection();
|
||||
ItemFactory.MARRIAGE_GIFTS.saveItems(new LinkedList<Pair<Item, MapleInventoryType>>(), chr.getId(), con);
|
||||
con.close();
|
||||
} catch (SQLException sqle) {}
|
||||
|
||||
for (Item item : gifts) {
|
||||
MapleInventoryManipulator.addFromDrop(chr.getClient(), item, false);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static List<Item> loadGiftItemsFromDb(MapleClient c, int cid) {
|
||||
c.tryacquireClient();
|
||||
try {
|
||||
List<Item> items = new LinkedList<>();
|
||||
try {
|
||||
for (Pair<Item, MapleInventoryType> it : ItemFactory.MARRIAGE_GIFTS.loadItems(cid, false)) {
|
||||
items.add(it.getLeft());
|
||||
}
|
||||
} catch (SQLException sqle) {
|
||||
sqle.printStackTrace();
|
||||
}
|
||||
|
||||
return items;
|
||||
} finally {
|
||||
c.releaseClient();
|
||||
}
|
||||
}
|
||||
|
||||
public void saveGiftItemsToDb(MapleClient c, boolean groom, int cid) {
|
||||
MapleMarriage.saveGiftItemsToDb(c, getGiftItems(c, groom), cid);
|
||||
}
|
||||
|
||||
public static void saveGiftItemsToDb(MapleClient c, List<Item> giftItems, int cid) {
|
||||
List<Pair<Item, MapleInventoryType>> items = new LinkedList<>();
|
||||
for (Item it : giftItems) {
|
||||
items.add(new Pair<>(it, it.getInventoryType()));
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -940,26 +940,17 @@ public class MapleStatEffect {
|
||||
} else if (cp != 0 && applyto.getMonsterCarnival() != null) {
|
||||
applyto.gainCP(cp);
|
||||
} else if (nuffSkill != 0 && applyto.getParty() != null && applyto.getMap().isCPQMap()) { // by Drago-Dragohe4rt
|
||||
final MCSkill skil = MapleCarnivalFactory.getInstance().getSkill(nuffSkill);
|
||||
if (skil != null) {
|
||||
final MapleDisease dis = skil.getDisease();
|
||||
MapleParty inimigos = applyfrom.getParty().getEnemy();
|
||||
if (nuffSkill == 8) {
|
||||
int amount = inimigos.getMembers().size() - 1;
|
||||
int randd = (int) Math.floor(Math.random() * amount);
|
||||
MapleCharacter chrApp = applyfrom.getClient().getChannelServer().getPlayerStorage().getCharacterById(inimigos.getMemberByPos(randd).getId());
|
||||
final MCSkill skill = MapleCarnivalFactory.getInstance().getSkill(nuffSkill);
|
||||
if (skill != null) {
|
||||
final MapleDisease dis = skill.getDisease();
|
||||
MapleParty opposition = applyfrom.getParty().getEnemy();
|
||||
for (MaplePartyCharacter enemyChrs : opposition.getPartyMembers()) {
|
||||
MapleCharacter chrApp = enemyChrs.getPlayer();
|
||||
if (chrApp != null && chrApp.getMap().isCPQMap()) {
|
||||
chrApp.dispel();
|
||||
}
|
||||
} else {
|
||||
for (MaplePartyCharacter chrsInimigos : inimigos.getPartyMembers()) {
|
||||
MapleCharacter chrApp = chrsInimigos.getPlayer();
|
||||
if (chrApp != null && chrApp.getMap().isCPQMap()) {
|
||||
if (dis == null) {
|
||||
chrApp.dispel();
|
||||
} else if (skil.getSkill() != null) {
|
||||
chrApp.giveDebuff(dis, skil.getSkill());
|
||||
}
|
||||
if (dis == null) {
|
||||
chrApp.dispel();
|
||||
} else {
|
||||
chrApp.giveDebuff(dis, MCSkill.getMobSkill(dis.getDisease()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -182,45 +182,38 @@ public class MapleMonsterInformationProvider {
|
||||
return drops.get(monsterId);
|
||||
}
|
||||
final List<MonsterDropEntry> ret = new LinkedList<>();
|
||||
|
||||
PreparedStatement ps = null;
|
||||
ResultSet rs = null;
|
||||
Connection con = null;
|
||||
try {
|
||||
con = DatabaseConnection.getConnection();
|
||||
ps = con.prepareStatement("SELECT itemid, chance, minimum_quantity, maximum_quantity, questid FROM drop_data WHERE dropperid = ?");
|
||||
ps.setInt(1, monsterId);
|
||||
rs = ps.executeQuery();
|
||||
|
||||
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));
|
||||
while (rs.next()) {
|
||||
ret.add(new MonsterDropEntry(rs.getInt("itemid"), rs.getInt("chance"), rs.getInt("minimum_quantity"), rs.getInt("maximum_quantity"), rs.getShort("questid")));
|
||||
}
|
||||
} else {
|
||||
PreparedStatement ps = null;
|
||||
ResultSet rs = null;
|
||||
Connection con = null;
|
||||
|
||||
con.close();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
return ret;
|
||||
} finally {
|
||||
try {
|
||||
con = DatabaseConnection.getConnection();
|
||||
ps = con.prepareStatement("SELECT itemid, chance, minimum_quantity, maximum_quantity, questid FROM drop_data WHERE dropperid = ?");
|
||||
ps.setInt(1, monsterId);
|
||||
rs = ps.executeQuery();
|
||||
|
||||
while (rs.next()) {
|
||||
ret.add(new MonsterDropEntry(rs.getInt("itemid"), rs.getInt("chance"), rs.getInt("minimum_quantity"), rs.getInt("maximum_quantity"), rs.getShort("questid")));
|
||||
if (ps != null && !ps.isClosed()) {
|
||||
ps.close();
|
||||
}
|
||||
|
||||
con.close();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
if (rs != null && !rs.isClosed()) {
|
||||
rs.close();
|
||||
}
|
||||
if (con != null && !con.isClosed()) {
|
||||
con.close();
|
||||
}
|
||||
} catch (SQLException ignore) {
|
||||
ignore.printStackTrace();
|
||||
return ret;
|
||||
} finally {
|
||||
try {
|
||||
if (ps != null && !ps.isClosed()) {
|
||||
ps.close();
|
||||
}
|
||||
if (rs != null && !rs.isClosed()) {
|
||||
rs.close();
|
||||
}
|
||||
if (con != null && !con.isClosed()) {
|
||||
con.close();
|
||||
}
|
||||
} catch (SQLException ignore) {
|
||||
ignore.printStackTrace();
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
drops.put(monsterId, ret);
|
||||
|
||||
@@ -166,18 +166,20 @@ public class MapleMapFactory {
|
||||
}
|
||||
}
|
||||
|
||||
private synchronized MapleMap loadMapFromWz(int mapid, Integer omapid) {
|
||||
private synchronized MapleMap loadMapFromWz(int mapid, Integer omapid, boolean cache) {
|
||||
MapleMap map;
|
||||
|
||||
mapsRLock.lock();
|
||||
try {
|
||||
map = maps.get(omapid);
|
||||
} finally {
|
||||
mapsRLock.unlock();
|
||||
}
|
||||
if (cache) {
|
||||
mapsRLock.lock();
|
||||
try {
|
||||
map = maps.get(omapid);
|
||||
} finally {
|
||||
mapsRLock.unlock();
|
||||
}
|
||||
|
||||
if (map != null) {
|
||||
return map;
|
||||
if (map != null) {
|
||||
return map;
|
||||
}
|
||||
}
|
||||
|
||||
String mapName = getMapName(mapid);
|
||||
@@ -389,11 +391,13 @@ public class MapleMapFactory {
|
||||
map.setBackgroundTypes(backTypes);
|
||||
map.generateMapDropRangeCache();
|
||||
|
||||
mapsWLock.lock();
|
||||
try {
|
||||
maps.put(omapid, map);
|
||||
} finally {
|
||||
mapsWLock.unlock();
|
||||
if (cache) {
|
||||
mapsWLock.lock();
|
||||
try {
|
||||
maps.put(omapid, map);
|
||||
} finally {
|
||||
mapsWLock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
return map;
|
||||
@@ -410,7 +414,11 @@ public class MapleMapFactory {
|
||||
mapsRLock.unlock();
|
||||
}
|
||||
|
||||
return (map != null) ? map : loadMapFromWz(mapid, omapid);
|
||||
return (map != null) ? map : loadMapFromWz(mapid, omapid, true);
|
||||
}
|
||||
|
||||
public MapleMap getDisposableMap(int mapid) {
|
||||
return loadMapFromWz(mapid, mapid, false);
|
||||
}
|
||||
|
||||
public boolean isMapLoaded(int mapId) {
|
||||
|
||||
@@ -63,6 +63,10 @@ public class MapleCarnivalFactory {
|
||||
}
|
||||
|
||||
public MobSkill getSkill() {
|
||||
return getMobSkill(skillid);
|
||||
}
|
||||
|
||||
public static MobSkill getMobSkill(int skillid) {
|
||||
return MobSkillFactory.getMobSkill(skillid, 1); //level?
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,8 @@ package server.partyquest;
|
||||
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import client.MapleCharacter;
|
||||
import constants.LinguaConstants;
|
||||
import constants.LanguageConstants;
|
||||
import constants.ServerConstants;
|
||||
import net.server.Server;
|
||||
import net.server.channel.Channel;
|
||||
import net.server.world.MapleParty;
|
||||
@@ -24,22 +25,23 @@ public class MonsterCarnival {
|
||||
|
||||
private MapleParty p1, p2;
|
||||
private MapleMap map;
|
||||
private ScheduledFuture<?> timer, effectTimer;
|
||||
private ScheduledFuture<?> timer, effectTimer, respawnTask;
|
||||
private long startTime = 0;
|
||||
private int summons = 8, summonss = 8;
|
||||
private int summonsR = 8, summonsB = 8, room = 0;
|
||||
private MapleCharacter leader1, leader2, Grupo1, Grupo2;
|
||||
private int redCP, blueCP, redTotalCP, blueTotalCP;
|
||||
private boolean cpq1;
|
||||
|
||||
public MonsterCarnival(MapleParty p1, MapleParty p2, int mapid, boolean cpq1) {
|
||||
public MonsterCarnival(MapleParty p1, MapleParty p2, int mapid, boolean cpq1, int room) {
|
||||
try {
|
||||
this.cpq1 = cpq1;
|
||||
this.room = room;
|
||||
this.p1 = p1;
|
||||
this.p2 = p2;
|
||||
Channel cs = Server.getInstance().getWorld(p2.getLeader().getWorld()).getChannel(p2.getLeader().getChannel());
|
||||
p1.setEnemy(p2);
|
||||
p2.setEnemy(p1);
|
||||
map = cs.getMapFactory().resetMap(mapid);
|
||||
map = cs.getMapFactory().getDisposableMap(mapid);
|
||||
int redPortal = 0;
|
||||
int bluePortal = 0;
|
||||
if (map.isPurpleCPQMap()) {
|
||||
@@ -47,13 +49,13 @@ public class MonsterCarnival {
|
||||
bluePortal = 1;
|
||||
}
|
||||
for (MaplePartyCharacter mpc : p1.getMembers()) {
|
||||
MapleCharacter mc = cs.getPlayerStorage().getCharacterByName(mpc.getName());
|
||||
MapleCharacter mc = cs.getPlayerStorage().getCharacterById(mpc.getId());
|
||||
if (mc != null) {
|
||||
mc.setMonsterCarnival(this);
|
||||
mc.setTeam(0);
|
||||
mc.setFestivalPoints(0);
|
||||
mc.changeMap(map, map.getPortal(redPortal));
|
||||
mc.dropMessage(6, LinguaConstants.Linguas(mc).CPQEntrada);
|
||||
mc.forceChangeMap(map, map.getPortal(redPortal));
|
||||
mc.dropMessage(6, LanguageConstants.Linguas(mc).CPQEntrada);
|
||||
if (p1.getLeader().getId() == mc.getId()) {
|
||||
leader1 = mc;
|
||||
}
|
||||
@@ -61,13 +63,13 @@ public class MonsterCarnival {
|
||||
}
|
||||
}
|
||||
for (MaplePartyCharacter mpc : p2.getMembers()) {
|
||||
MapleCharacter mc = cs.getPlayerStorage().getCharacterByName(mpc.getName());
|
||||
MapleCharacter mc = cs.getPlayerStorage().getCharacterById(mpc.getId());
|
||||
if (mc != null) {
|
||||
mc.setMonsterCarnival(this);
|
||||
mc.setTeam(1);
|
||||
mc.setFestivalPoints(0);
|
||||
mc.changeMap(map, map.getPortal(bluePortal));
|
||||
mc.dropMessage(6, LinguaConstants.Linguas(mc).CPQEntrada);
|
||||
mc.forceChangeMap(map, map.getPortal(bluePortal));
|
||||
mc.dropMessage(6, LanguageConstants.Linguas(mc).CPQEntrada);
|
||||
if (p2.getLeader().getId() == mc.getId()) {
|
||||
leader2 = mc;
|
||||
}
|
||||
@@ -76,10 +78,10 @@ public class MonsterCarnival {
|
||||
}
|
||||
if (Grupo1 == null || Grupo2 == null) {
|
||||
for (MaplePartyCharacter mpc : p2.getMembers()) {
|
||||
mpc.getPlayer().dropMessage(5, LinguaConstants.Linguas(mpc.getPlayer()).CPQErro);
|
||||
mpc.getPlayer().dropMessage(5, LanguageConstants.Linguas(mpc.getPlayer()).CPQErro);
|
||||
}
|
||||
for (MaplePartyCharacter mpc : p2.getMembers()) {
|
||||
mpc.getPlayer().dropMessage(5, LinguaConstants.Linguas(mpc.getPlayer()).CPQErro);
|
||||
mpc.getPlayer().dropMessage(5, LanguageConstants.Linguas(mpc.getPlayer()).CPQErro);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -98,6 +100,12 @@ public class MonsterCarnival {
|
||||
complete();
|
||||
}
|
||||
}, 10 * 60 * 1000 - 10 * 1000);
|
||||
respawnTask = TimerManager.getInstance().register(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
respawn();
|
||||
}
|
||||
}, ServerConstants.RESPAWN_INTERVAL);
|
||||
TimerManager.getInstance().schedule(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
@@ -109,6 +117,10 @@ public class MonsterCarnival {
|
||||
}
|
||||
}
|
||||
|
||||
private void respawn() {
|
||||
map.respawn();
|
||||
}
|
||||
|
||||
public void playerDisconnected(int charid) {
|
||||
int team = -1;
|
||||
for (MaplePartyCharacter mpc : leader1.getParty().getMembers()) {
|
||||
@@ -128,13 +140,13 @@ public class MonsterCarnival {
|
||||
String teamS = "";
|
||||
switch (team) {
|
||||
case 0:
|
||||
teamS = LinguaConstants.Linguas(chrMap).CPQVermelho;
|
||||
teamS = LanguageConstants.Linguas(chrMap).CPQVermelho;
|
||||
break;
|
||||
case 1:
|
||||
teamS = LinguaConstants.Linguas(chrMap).CPQAzul;
|
||||
teamS = LanguageConstants.Linguas(chrMap).CPQAzul;
|
||||
break;
|
||||
}
|
||||
chrMap.dropMessage(5, teamS + LinguaConstants.Linguas(chrMap).CPQPlayerExit);
|
||||
chrMap.dropMessage(5, teamS + LanguageConstants.Linguas(chrMap).CPQPlayerExit);
|
||||
}
|
||||
earlyFinish();
|
||||
}
|
||||
@@ -151,20 +163,20 @@ public class MonsterCarnival {
|
||||
dispose(false);
|
||||
}
|
||||
|
||||
public void summon() {
|
||||
this.summons--;
|
||||
public void summonR() {
|
||||
this.summonsR--;
|
||||
}
|
||||
|
||||
public boolean canSummon() {
|
||||
return this.summons > 0;
|
||||
public boolean canSummonR() {
|
||||
return this.summonsR > 0;
|
||||
}
|
||||
|
||||
public void summons() {
|
||||
this.summonss--;
|
||||
public void summonB() {
|
||||
this.summonsB--;
|
||||
}
|
||||
|
||||
public boolean canSummons() {
|
||||
return this.summonss > 0;
|
||||
public boolean canSummonB() {
|
||||
return this.summonsB > 0;
|
||||
}
|
||||
|
||||
protected void dispose(boolean warpout) {
|
||||
@@ -176,7 +188,7 @@ public class MonsterCarnival {
|
||||
out = cs.getMapFactory().getMap(980000000);
|
||||
}
|
||||
for (MaplePartyCharacter mpc : leader1.getParty().getMembers()) {
|
||||
MapleCharacter mc = cs.getPlayerStorage().getCharacterByName(mpc.getName());
|
||||
MapleCharacter mc = cs.getPlayerStorage().getCharacterById(mpc.getId());
|
||||
if (mc != null) {
|
||||
mc.resetCP();
|
||||
mc.setTeam(-1);
|
||||
@@ -187,7 +199,7 @@ public class MonsterCarnival {
|
||||
}
|
||||
}
|
||||
for (MaplePartyCharacter mpc : leader2.getParty().getMembers()) {
|
||||
MapleCharacter mc = cs.getPlayerStorage().getCharacterByName(mpc.getName());
|
||||
MapleCharacter mc = cs.getPlayerStorage().getCharacterById(mpc.getId());
|
||||
if (mc != null) {
|
||||
mc.resetCP();
|
||||
mc.setTeam(-1);
|
||||
@@ -205,10 +217,16 @@ public class MonsterCarnival {
|
||||
this.effectTimer.cancel(true);
|
||||
this.effectTimer = null;
|
||||
}
|
||||
if (this.respawnTask != null) {
|
||||
this.respawnTask.cancel(true);
|
||||
this.respawnTask = null;
|
||||
}
|
||||
redTotalCP = 0;
|
||||
blueTotalCP = 0;
|
||||
leader1.getParty().setEnemy(null);
|
||||
leader2.getParty().setEnemy(null);
|
||||
map.dispose();
|
||||
map = null;
|
||||
|
||||
}
|
||||
|
||||
@@ -225,7 +243,7 @@ public class MonsterCarnival {
|
||||
Channel cs = Server.getInstance().getWorld(p1.getLeader().getWorld()).getChannel(p1.getLeader().getChannel());
|
||||
if (winningTeam == 0) {
|
||||
for (MaplePartyCharacter mpc : leader1.getParty().getMembers()) {
|
||||
MapleCharacter mc = cs.getPlayerStorage().getCharacterByName(mpc.getName());
|
||||
MapleCharacter mc = cs.getPlayerStorage().getCharacterById(mpc.getId());
|
||||
if (mc != null) {
|
||||
mc.gainFestivalPoints(this.redTotalCP);
|
||||
mc.setMonsterCarnival(null);
|
||||
@@ -239,7 +257,7 @@ public class MonsterCarnival {
|
||||
}
|
||||
}
|
||||
for (MaplePartyCharacter mpc : leader2.getParty().getMembers()) {
|
||||
MapleCharacter mc = cs.getPlayerStorage().getCharacterByName(mpc.getName());
|
||||
MapleCharacter mc = cs.getPlayerStorage().getCharacterById(mpc.getId());
|
||||
if (mc != null) {
|
||||
mc.gainFestivalPoints(this.blueTotalCP);
|
||||
mc.setMonsterCarnival(null);
|
||||
@@ -254,7 +272,7 @@ public class MonsterCarnival {
|
||||
}
|
||||
} else if (winningTeam == 1) {
|
||||
for (MaplePartyCharacter mpc : leader2.getParty().getMembers()) {
|
||||
MapleCharacter mc = cs.getPlayerStorage().getCharacterByName(mpc.getName());
|
||||
MapleCharacter mc = cs.getPlayerStorage().getCharacterById(mpc.getId());
|
||||
if (mc != null) {
|
||||
mc.gainFestivalPoints(this.blueTotalCP);
|
||||
mc.setMonsterCarnival(null);
|
||||
@@ -268,7 +286,7 @@ public class MonsterCarnival {
|
||||
}
|
||||
}
|
||||
for (MaplePartyCharacter mpc : leader1.getParty().getMembers()) {
|
||||
MapleCharacter mc = cs.getPlayerStorage().getCharacterByName(mpc.getName());
|
||||
MapleCharacter mc = cs.getPlayerStorage().getCharacterById(mpc.getId());
|
||||
if (mc != null) {
|
||||
mc.gainFestivalPoints(this.redTotalCP);
|
||||
mc.setMonsterCarnival(null);
|
||||
@@ -312,7 +330,7 @@ public class MonsterCarnival {
|
||||
|
||||
public void extendTime() {
|
||||
for (MapleCharacter chrMap : map.getAllPlayers()) {
|
||||
chrMap.dropMessage(5, LinguaConstants.Linguas(chrMap).CPQTempoExtendido);
|
||||
chrMap.dropMessage(5, LanguageConstants.Linguas(chrMap).CPQTempoExtendido);
|
||||
}
|
||||
startTime = System.currentTimeMillis() + 3 * 1000;
|
||||
map.addClock(3 * 60);
|
||||
@@ -340,14 +358,14 @@ public class MonsterCarnival {
|
||||
int chnl = leader1.getClient().getChannel();
|
||||
int chnl1 = leader2.getClient().getChannel();
|
||||
if (chnl != chnl1) {
|
||||
throw new RuntimeException("Os líderes estão em canais diferentes.");
|
||||
throw new RuntimeException("Os lideres estao em canais diferentes.");
|
||||
}
|
||||
|
||||
Channel cs = Server.getInstance().getWorld(p1.getLeader().getWorld()).getChannel(p1.getLeader().getChannel());
|
||||
map.killAllMonsters();
|
||||
for (MaplePartyCharacter mpc : leader1.getParty().getMembers()) {
|
||||
MapleCharacter mc;
|
||||
mc = cs.getPlayerStorage().getCharacterByName(mpc.getName());
|
||||
mc = cs.getPlayerStorage().getCharacterById(mpc.getId());
|
||||
if (mc != null) {
|
||||
if (redWin) {
|
||||
mc.getClient().announce(MaplePacketCreator.showEffect("quest/carnival/win"));
|
||||
@@ -362,7 +380,7 @@ public class MonsterCarnival {
|
||||
}
|
||||
for (MaplePartyCharacter mpc : leader2.getParty().getMembers()) {
|
||||
MapleCharacter mc;
|
||||
mc = cs.getPlayerStorage().getCharacterByName(mpc.getName());
|
||||
mc = cs.getPlayerStorage().getCharacterById(mpc.getId());
|
||||
if (mc != null) {
|
||||
if (!redWin) {
|
||||
mc.getClient().announce(MaplePacketCreator.showEffect("quest/carnival/win"));
|
||||
@@ -486,4 +504,8 @@ public class MonsterCarnival {
|
||||
this.blueCP = CP;
|
||||
}
|
||||
}
|
||||
|
||||
public int getRoom() {
|
||||
return this.room;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ public class MonsterCarnivalParty {
|
||||
private MapleCharacter leader;
|
||||
private byte team;
|
||||
private short availableCP = 0, totalCP = 0;
|
||||
private int summons = 7;
|
||||
private int summons = 8;
|
||||
private boolean winner = false;
|
||||
|
||||
public MonsterCarnivalParty(final MapleCharacter owner, final List<MapleCharacter> members1, final byte team1) {
|
||||
@@ -24,7 +24,7 @@ public class MonsterCarnivalParty {
|
||||
team = team1;
|
||||
|
||||
for (final MapleCharacter chr : members) {
|
||||
chr.setCarnivalParty(this);
|
||||
chr.setMonsterCarnivalParty(this);
|
||||
chr.setTeam(team);
|
||||
}
|
||||
}
|
||||
@@ -63,8 +63,8 @@ public class MonsterCarnivalParty {
|
||||
public void warpOut(final int map) {
|
||||
for (MapleCharacter chr : members) {
|
||||
chr.changeMap(map, 0);
|
||||
chr.setCarnivalParty(null);
|
||||
chr.setCarnival(null);
|
||||
chr.setMonsterCarnivalParty(null);
|
||||
chr.setMonsterCarnival(null);
|
||||
}
|
||||
members.clear();
|
||||
}
|
||||
@@ -77,9 +77,9 @@ public class MonsterCarnivalParty {
|
||||
|
||||
public void warpOut() {
|
||||
if (winner == true)
|
||||
warpOut(980000003 + (leader.getCarnival().getRoom() * 100));
|
||||
warpOut(980000003 + (leader.getMonsterCarnival().getRoom() * 100));
|
||||
else
|
||||
warpOut(980000004 + (leader.getCarnival().getRoom() * 100));
|
||||
warpOut(980000004 + (leader.getMonsterCarnival().getRoom() * 100));
|
||||
}
|
||||
|
||||
public boolean allInMap(MapleMap map) {
|
||||
@@ -95,8 +95,8 @@ public class MonsterCarnivalParty {
|
||||
public void removeMember(MapleCharacter chr) {
|
||||
members.remove(chr);
|
||||
chr.changeMap(980000010);
|
||||
chr.setCarnivalParty(null);
|
||||
chr.setCarnival(null);
|
||||
chr.setMonsterCarnivalParty(null);
|
||||
chr.setMonsterCarnival(null);
|
||||
}
|
||||
|
||||
public boolean isWinner() {
|
||||
|
||||
Reference in New Issue
Block a user