CPQ tidyup patch + Guild Creation matcher + Solution to Login Accid=0
Adjusted AP gains, to get it to work following the AP Reset check method. Fixed usage of inexistent itemids on CPQ and fishing. Fixed one-of-a-kind items being lost in player trades due to missing inventory checks. Implemented matching system for the guild creation phase. All players intending to join the new guild must be on the Guild Headquartes and accept the creation of the guild. Fixed changing jobs not properly updating info on the party tab. Fixed double tooltip information on CPQ actions UI. Fixed CPQ not disbanding after a player leaves the party/instance. Fixed checks for "in-progress" CPQ instances. Fixed changing maps on CPQ not leading players back to the starting battlefield. Reviewed login system, now preventing non-local IP connecting on local server and local IP on non-local server. Reviewed login system, now cherrypicking sessions in transition state when trying to disconnect them due to a failed login (avoiding possible mishaps due to duplicate sessions of a same account). Adjusted PiratePQ stage 2, now mobs respawn rather than making party leader request for new waves. Adjusted Prime Minister, its spawn is no longer related to starting the quest. It should also allow party fights. Fixed "forcevac" command not properly applying, rather sending to inventory, "consume-on-pickup" items. Fixed (probably) accId = 0 issue on login, that was occurring due to client accountid's being set to 0 a while before being checked once again on finishLogin(). Fixed an issue with extended time on CPQ not properly showing the end-match's visual effect.
This commit is contained in:
@@ -1657,7 +1657,7 @@ public class MapleItemInformationProvider {
|
||||
if (!EquipSlot.getFromTextSlot(islot).isAllowed(dst, isCash(id))) {
|
||||
equip.wear(false);
|
||||
String itemName = MapleItemInformationProvider.getInstance().getName(equip.getItemId());
|
||||
Server.getInstance().broadcastGMMessage(chr.getWorld(), MaplePacketCreator.sendYellowTip("[WARNING]: " + chr.getName() + " tried to equip " + itemName + " into slot " + dst + "."));
|
||||
Server.getInstance().broadcastGMMessage(chr.getWorld(), MaplePacketCreator.sendYellowTip("[Warning]: " + chr.getName() + " tried to equip " + itemName + " into slot " + dst + "."));
|
||||
AutobanFactory.PACKET_EDIT.alert(chr, chr.getName() + " tried to forcibly equip an item.");
|
||||
FilePrinter.printError(FilePrinter.EXPLOITS + chr.getName() + ".txt", chr.getName() + " tried to equip " + itemName + " into " + dst + " slot.");
|
||||
return false;
|
||||
|
||||
@@ -69,15 +69,18 @@ public class MapleMarriage extends EventInstanceManager {
|
||||
}
|
||||
|
||||
public List<Item> getGiftItems(MapleClient c, boolean groom) {
|
||||
c.tryacquireClient();
|
||||
try {
|
||||
List<Item> gifts = getGiftItemsList(groom);
|
||||
synchronized (gifts) {
|
||||
return new LinkedList<>(gifts);
|
||||
if (c.tryacquireClient()) {
|
||||
try {
|
||||
List<Item> gifts = getGiftItemsList(groom);
|
||||
synchronized (gifts) {
|
||||
return new LinkedList<>(gifts);
|
||||
}
|
||||
} finally {
|
||||
c.releaseClient();
|
||||
}
|
||||
} finally {
|
||||
c.releaseClient();
|
||||
}
|
||||
|
||||
return new LinkedList<>();
|
||||
}
|
||||
|
||||
private List<Item> getGiftItemsList(boolean groom) {
|
||||
@@ -140,21 +143,22 @@ public class MapleMarriage extends EventInstanceManager {
|
||||
}
|
||||
|
||||
public static List<Item> loadGiftItemsFromDb(MapleClient c, int cid) {
|
||||
c.tryacquireClient();
|
||||
try {
|
||||
List<Item> items = new LinkedList<>();
|
||||
List<Item> items = new LinkedList<>();
|
||||
if (c.tryacquireClient()) {
|
||||
try {
|
||||
for (Pair<Item, MapleInventoryType> it : ItemFactory.MARRIAGE_GIFTS.loadItems(cid, false)) {
|
||||
items.add(it.getLeft());
|
||||
try {
|
||||
for (Pair<Item, MapleInventoryType> it : ItemFactory.MARRIAGE_GIFTS.loadItems(cid, false)) {
|
||||
items.add(it.getLeft());
|
||||
}
|
||||
} catch (SQLException sqle) {
|
||||
sqle.printStackTrace();
|
||||
}
|
||||
} catch (SQLException sqle) {
|
||||
sqle.printStackTrace();
|
||||
} finally {
|
||||
c.releaseClient();
|
||||
}
|
||||
|
||||
return items;
|
||||
} finally {
|
||||
c.releaseClient();
|
||||
}
|
||||
|
||||
return items;
|
||||
}
|
||||
|
||||
public void saveGiftItemsToDb(MapleClient c, boolean groom, int cid) {
|
||||
@@ -167,17 +171,18 @@ public class MapleMarriage extends EventInstanceManager {
|
||||
items.add(new Pair<>(it, it.getInventoryType()));
|
||||
}
|
||||
|
||||
c.tryacquireClient();
|
||||
try {
|
||||
if (c.tryacquireClient()) {
|
||||
try {
|
||||
Connection con = DatabaseConnection.getConnection();
|
||||
ItemFactory.MARRIAGE_GIFTS.saveItems(items, cid, con);
|
||||
con.close();
|
||||
} catch (SQLException sqle) {
|
||||
sqle.printStackTrace();
|
||||
try {
|
||||
Connection con = DatabaseConnection.getConnection();
|
||||
ItemFactory.MARRIAGE_GIFTS.saveItems(items, cid, con);
|
||||
con.close();
|
||||
} catch (SQLException sqle) {
|
||||
sqle.printStackTrace();
|
||||
}
|
||||
} finally {
|
||||
c.releaseClient();
|
||||
}
|
||||
} finally {
|
||||
c.releaseClient();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -944,13 +944,26 @@ public class MapleStatEffect {
|
||||
if (skill != null) {
|
||||
final MapleDisease dis = skill.getDisease();
|
||||
MapleParty opposition = applyfrom.getParty().getEnemy();
|
||||
for (MaplePartyCharacter enemyChrs : opposition.getPartyMembers()) {
|
||||
MapleCharacter chrApp = enemyChrs.getPlayer();
|
||||
if (skill.targetsAll) {
|
||||
for (MaplePartyCharacter enemyChrs : opposition.getPartyMembers()) {
|
||||
MapleCharacter chrApp = enemyChrs.getPlayer();
|
||||
if (chrApp != null && chrApp.getMap().isCPQMap()) {
|
||||
if (dis == null) {
|
||||
chrApp.dispel();
|
||||
} else {
|
||||
chrApp.giveDebuff(dis, MCSkill.getMobSkill(dis.getDisease(), skill.level));
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
int amount = opposition.getMembers().size() - 1;
|
||||
int randd = (int) Math.floor(Math.random() * amount);
|
||||
MapleCharacter chrApp = applyfrom.getMap().getCharacterById(opposition.getMemberByPos(randd).getId());
|
||||
if (chrApp != null && chrApp.getMap().isCPQMap()) {
|
||||
if (dis == null) {
|
||||
chrApp.dispel();
|
||||
} else {
|
||||
chrApp.giveDebuff(dis, MCSkill.getMobSkill(dis.getDisease()));
|
||||
chrApp.giveDebuff(dis, MCSkill.getMobSkill(dis.getDisease(), skill.level));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ public class MapleTrade {
|
||||
this.number = number;
|
||||
}
|
||||
|
||||
private static int getFee(long meso) {
|
||||
public static int getFee(long meso) {
|
||||
long fee = 0;
|
||||
if (meso >= 100000000) {
|
||||
fee = (meso * 6) / 100;
|
||||
@@ -179,7 +179,7 @@ public class MapleTrade {
|
||||
throw new RuntimeException("Trade is locked.");
|
||||
}
|
||||
if (meso < 0) {
|
||||
System.out.println("[h4x] " + chr.getName() + " Trying to trade < 0 mesos");
|
||||
System.out.println("[Hack] " + chr.getName() + " Trying to trade < 0 mesos");
|
||||
return;
|
||||
}
|
||||
if (chr.getMeso() >= meso) {
|
||||
@@ -372,12 +372,30 @@ public class MapleTrade {
|
||||
chr.setTrade(null);
|
||||
}
|
||||
|
||||
private static byte[] tradeResultsPair(byte result) {
|
||||
byte selfResult, partnerResult;
|
||||
|
||||
if (result == TradeResult.PARTNER_CANCEL.getValue()) {
|
||||
partnerResult = result;
|
||||
selfResult = TradeResult.NO_RESPONSE.getValue();
|
||||
} else if (result == TradeResult.UNSUCCESSFUL_UNIQUE_ITEM_LIMIT.getValue()) {
|
||||
partnerResult = TradeResult.UNSUCCESSFUL.getValue();
|
||||
selfResult = result;
|
||||
} else {
|
||||
partnerResult = result;
|
||||
selfResult = result;
|
||||
}
|
||||
|
||||
return new byte[]{selfResult, partnerResult};
|
||||
}
|
||||
|
||||
private synchronized void tradeCancelHandshake(boolean updateSelf, byte result) {
|
||||
byte selfResult, partnerResult;
|
||||
MapleTrade self;
|
||||
|
||||
partnerResult = result;
|
||||
selfResult = (result == TradeResult.PARTNER_CANCEL.getValue() ? TradeResult.NO_RESPONSE.getValue() : result);
|
||||
byte[] pairedResult = tradeResultsPair(result);
|
||||
selfResult = pairedResult[0];
|
||||
partnerResult = pairedResult[1];
|
||||
|
||||
if (updateSelf) {
|
||||
self = this;
|
||||
|
||||
@@ -127,9 +127,9 @@ public class MapleMonster extends AbstractLoadedMapleLife {
|
||||
externalLock.unlock();
|
||||
}
|
||||
|
||||
private void initWithStats(MapleMonsterStats stats) {
|
||||
private void initWithStats(MapleMonsterStats baseStats) {
|
||||
setStance(5);
|
||||
this.stats = stats;
|
||||
this.stats = baseStats.copy();
|
||||
hp.set(stats.getHp());
|
||||
mp = stats.getMp();
|
||||
|
||||
@@ -223,7 +223,8 @@ public class MapleMonster extends AbstractLoadedMapleLife {
|
||||
this.hp.addAndGet(hp);
|
||||
}
|
||||
|
||||
public void setStartingHp(int hp) {
|
||||
public synchronized void setStartingHp(int hp) {
|
||||
stats.setHp(hp); // refactored mob stats after non-static HP pool suggestion thanks to twigs
|
||||
this.hp.set(hp);
|
||||
}
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
*/
|
||||
package server.life;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
@@ -36,20 +37,20 @@ import tools.Pair;
|
||||
* @author Frz
|
||||
*/
|
||||
public class MapleMonsterStats {
|
||||
private boolean changeable;
|
||||
private int exp, hp, mp, level, PADamage, PDDamage, MADamage, MDDamage, dropPeriod, cp, buffToGive = -1, removeAfter;
|
||||
private boolean boss, undead, ffaLoot, isExplosiveReward, firstAttack, removeOnMiss;
|
||||
private String name;
|
||||
private Map<String, Integer> animationTimes = new HashMap<String, Integer>();
|
||||
private Map<Element, ElementalEffectiveness> resistance = new HashMap<Element, ElementalEffectiveness>();
|
||||
private List<Integer> revives = Collections.emptyList();
|
||||
private byte tagColor, tagBgColor;
|
||||
private List<Pair<Integer, Integer>> skills = new ArrayList<Pair<Integer, Integer>>();
|
||||
private Pair<Integer, Integer> cool = null;
|
||||
private BanishInfo banish = null;
|
||||
private List<loseItem> loseItem = null;
|
||||
private selfDestruction selfDestruction = null;
|
||||
private boolean friendly;
|
||||
public boolean changeable;
|
||||
public int exp, hp, mp, level, PADamage, PDDamage, MADamage, MDDamage, dropPeriod, cp, buffToGive = -1, removeAfter;
|
||||
public boolean boss, undead, ffaLoot, isExplosiveReward, firstAttack, removeOnMiss;
|
||||
public String name;
|
||||
public Map<String, Integer> animationTimes = new HashMap<String, Integer>();
|
||||
public Map<Element, ElementalEffectiveness> resistance = new HashMap<Element, ElementalEffectiveness>();
|
||||
public List<Integer> revives = Collections.emptyList();
|
||||
public byte tagColor, tagBgColor;
|
||||
public List<Pair<Integer, Integer>> skills = new ArrayList<Pair<Integer, Integer>>();
|
||||
public Pair<Integer, Integer> cool = null;
|
||||
public BanishInfo banish = null;
|
||||
public List<loseItem> loseItem = null;
|
||||
public selfDestruction selfDestruction = null;
|
||||
public boolean friendly;
|
||||
|
||||
public void setChange(boolean change) {
|
||||
this.changeable = change;
|
||||
@@ -337,4 +338,40 @@ public class MapleMonsterStats {
|
||||
public void setMDDamage(int MDDamage) {
|
||||
this.MDDamage = MDDamage;
|
||||
}
|
||||
|
||||
public MapleMonsterStats copy() {
|
||||
MapleMonsterStats copy = new MapleMonsterStats();
|
||||
try {
|
||||
FieldCopyUtil.setFields(this, copy);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
try {
|
||||
Thread.sleep(10000);
|
||||
} catch (Exception ex) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return copy;
|
||||
}
|
||||
|
||||
// FieldCopyUtil src: http://www.codesenior.com/en/tutorial/Java-Copy-Fields-From-One-Object-to-Another-Object-with-Reflection
|
||||
private static class FieldCopyUtil { // thanks to Codesenior dev team
|
||||
private static void setFields(Object from, Object to) {
|
||||
Field[] fields = from.getClass().getDeclaredFields();
|
||||
for (Field field : fields) {
|
||||
try {
|
||||
Field fieldFrom = from.getClass().getDeclaredField(field.getName());
|
||||
Object value = fieldFrom.get(from);
|
||||
to.getClass().getDeclaredField(field.getName()).set(to, value);
|
||||
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
} catch (NoSuchFieldException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,6 +48,7 @@ import tools.DatabaseConnection;
|
||||
import tools.MaplePacketCreator;
|
||||
import tools.Pair;
|
||||
import net.server.audit.locks.MonitoredLockType;
|
||||
import server.MapleTrade;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -274,6 +275,7 @@ public class MapleHiredMerchant extends AbstractMapleMapObject {
|
||||
if (c.getPlayer().getMeso() >= price) {
|
||||
if (canBuy(c, newItem)) {
|
||||
c.getPlayer().gainMeso(-price, false);
|
||||
price -= MapleTrade.getFee(price); // thanks BHB for pointing out trade fees not applying here
|
||||
|
||||
synchronized (sold) {
|
||||
sold.add(new SoldItem(c.getPlayer().getName(), pItem.getItem().getItemId(), newItem.getQuantity(), price));
|
||||
|
||||
@@ -1264,19 +1264,19 @@ public class MapleMap {
|
||||
}
|
||||
|
||||
public void broadcastBalrogVictory(String leaderName) {
|
||||
getWorldServer().dropMessage(6, "[VICTORY] " + leaderName + "'s party has successfully defeated the Balrog! Praise to them, they finished with " + countAlivePlayers() + " players alive.");
|
||||
getWorldServer().dropMessage(6, "[Victory] " + leaderName + "'s party has successfully defeated the Balrog! Praise to them, they finished with " + countAlivePlayers() + " players alive.");
|
||||
}
|
||||
|
||||
public void broadcastHorntailVictory() {
|
||||
getWorldServer().dropMessage(6, "[VICTORY] To the crew that have finally conquered Horned Tail after numerous attempts, I salute thee! You are the true heroes of Leafre!!");
|
||||
getWorldServer().dropMessage(6, "[Victory] To the crew that have finally conquered Horned Tail after numerous attempts, I salute thee! You are the true heroes of Leafre!!");
|
||||
}
|
||||
|
||||
public void broadcastZakumVictory() {
|
||||
getWorldServer().dropMessage(6, "[VICTORY] At last, the tree of evil that for so long overwhelmed Ossyria has fallen. To the crew that managed to finally conquer Zakum, after numerous attempts, victory! You are the true heroes of Ossyria!!");
|
||||
getWorldServer().dropMessage(6, "[Victory] At last, the tree of evil that for so long overwhelmed Ossyria has fallen. To the crew that managed to finally conquer Zakum, after numerous attempts, victory! You are the true heroes of Ossyria!!");
|
||||
}
|
||||
|
||||
public void broadcastPinkBeanVictory(int channel) {
|
||||
getWorldServer().dropMessage(6, "[VICTORY] In a swift stroke of sorts, the crew that has attempted Pink Bean at channel " + channel + " has ultimately defeated it. The Temple of Time shines radiantly once again, the day finally coming back, as the crew that managed to finally conquer it returns victoriously from the battlefield!!");
|
||||
getWorldServer().dropMessage(6, "[Victory] In a swift stroke of sorts, the crew that has attempted Pink Bean at channel " + channel + " has ultimately defeated it. The Temple of Time shines radiantly once again, the day finally coming back, as the crew that managed to finally conquer it returns victoriously from the battlefield!!");
|
||||
}
|
||||
|
||||
private boolean removeKilledMonsterObject(MapleMonster monster) {
|
||||
@@ -1893,7 +1893,7 @@ public class MapleMap {
|
||||
|
||||
public void spawnAllMonsterIdFromMapSpawnList(int id, int difficulty, boolean isPq) {
|
||||
for(SpawnPoint sp: getAllMonsterSpawn()) {
|
||||
if(sp.getMonsterId() == id) {
|
||||
if(sp.getMonsterId() == id && sp.shouldForceSpawn()) {
|
||||
spawnMonster(sp.getMonster(), difficulty, isPq);
|
||||
}
|
||||
}
|
||||
@@ -2079,7 +2079,7 @@ public class MapleMap {
|
||||
public MaplePortal getDoorPortal(int doorid) {
|
||||
MaplePortal doorPortal = portals.get(0x80 + doorid);
|
||||
if(doorPortal == null) {
|
||||
FilePrinter.printError(FilePrinter.EXCEPTION, "[DOOR] " + mapName + "(" + mapid + ") does not contain door portalid " + doorid);
|
||||
FilePrinter.printError(FilePrinter.EXCEPTION, "[Door] " + mapName + "(" + mapid + ") does not contain door portalid " + doorid);
|
||||
return portals.get(0x80);
|
||||
}
|
||||
|
||||
@@ -4334,10 +4334,10 @@ public class MapleMap {
|
||||
if (team == 0 && redTeamBuffs.size() >= 4 || team == 1 && blueTeamBuffs.size() >= 4) {
|
||||
return 2;
|
||||
}
|
||||
final MCSkill skil = MapleCarnivalFactory.getInstance().getGuardian(num);
|
||||
if (team == 0 && redTeamBuffs.contains(skil)) {
|
||||
final MCSkill skill = MapleCarnivalFactory.getInstance().getGuardian(num);
|
||||
if (team == 0 && redTeamBuffs.contains(skill)) {
|
||||
return 0;
|
||||
} else if (team == 1 && blueTeamBuffs.contains(skil)) {
|
||||
} else if (team == 1 && blueTeamBuffs.contains(skill)) {
|
||||
return 0;
|
||||
}
|
||||
GuardianSpawnPoint pt = this.getRandomGuardianSpawn(team);
|
||||
@@ -4352,7 +4352,7 @@ public class MapleMap {
|
||||
reactor.resetReactorActions(0);
|
||||
this.spawnReactor(reactor);
|
||||
reactor.setGuardian(pt);
|
||||
this.buffMonsters(team, skil);
|
||||
this.buffMonsters(team, skill);
|
||||
getReactorByOid(reactor.getObjectId()).hitReactor(((MapleCharacter) this.getAllPlayer().get(0)).getClient());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
@@ -4360,21 +4360,20 @@ public class MapleMap {
|
||||
return 1;
|
||||
}
|
||||
|
||||
public void buffMonsters(int team, MCSkill skil) {
|
||||
public void buffMonsters(int team, MCSkill skill) {
|
||||
if (skill == null) return;
|
||||
|
||||
if (team == 0) {
|
||||
redTeamBuffs.add(skil);
|
||||
redTeamBuffs.add(skill);
|
||||
} else if (team == 1) {
|
||||
blueTeamBuffs.add(skil);
|
||||
blueTeamBuffs.add(skill);
|
||||
}
|
||||
for (MapleMapObject mmo : this.mapobjects.values()) {
|
||||
if (mmo.getType() == MapleMapObjectType.MONSTER) {
|
||||
MapleMonster mob = (MapleMonster) mmo;
|
||||
if (mob.getTeam() == team) {
|
||||
if (skil != null) {
|
||||
skil.getSkill().applyEffect(null, mob, false, null);
|
||||
}
|
||||
skill.getSkill().applyEffect(null, mob, false, null);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,6 +42,7 @@ import tools.Pair;
|
||||
import tools.data.output.MaplePacketLittleEndianWriter;
|
||||
import net.server.audit.locks.MonitoredLockType;
|
||||
import net.server.audit.locks.factory.MonitoredReentrantLockFactory;
|
||||
import server.MapleTrade;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -279,6 +280,7 @@ public class MaplePlayerShop extends AbstractMapleMapObject {
|
||||
}
|
||||
|
||||
c.getPlayer().gainMeso(-price, false);
|
||||
price -= MapleTrade.getFee(price); // thanks BHB for pointing out trade fees not applying here
|
||||
owner.gainMeso(price, true);
|
||||
|
||||
SoldItem soldItem = new SoldItem(c.getPlayer().getName(), pItem.getItem().getItemId(), quantity, price);
|
||||
|
||||
@@ -2,7 +2,9 @@ package server.partyquest;
|
||||
|
||||
import client.MapleDisease;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import server.life.MobSkillFactory;
|
||||
import provider.MapleDataProvider;
|
||||
@@ -20,6 +22,9 @@ public class MapleCarnivalFactory {
|
||||
private final Map<Integer, MCSkill> skills = new HashMap<Integer, MCSkill>();
|
||||
private final Map<Integer, MCSkill> guardians = new HashMap<Integer, MCSkill>();
|
||||
private final MapleDataProvider dataRoot = MapleDataProviderFactory.getDataProvider(new File(System.getProperty("wzpath") + "/Skill.wz"));
|
||||
|
||||
private final List<Integer> singleTargetedSkills = new ArrayList<>();
|
||||
private final List<Integer> multiTargetedSkills = new ArrayList<>();
|
||||
|
||||
public MapleCarnivalFactory() {
|
||||
//whoosh
|
||||
@@ -35,15 +40,36 @@ public class MapleCarnivalFactory {
|
||||
return;
|
||||
}
|
||||
for (MapleData z : dataRoot.getData("MCSkill.img")) {
|
||||
skills.put(Integer.parseInt(z.getName()), new MCSkill(MapleDataTool.getInt("spendCP", z, 0), MapleDataTool.getInt("mobSkillID", z, 0), MapleDataTool.getInt("level", z, 0), MapleDataTool.getInt("target", z, 1) > 1));
|
||||
Integer id = Integer.parseInt(z.getName());
|
||||
MCSkill ms = new MCSkill(MapleDataTool.getInt("spendCP", z, 0), MapleDataTool.getInt("mobSkillID", z, 0), MapleDataTool.getInt("level", z, 0), MapleDataTool.getInt("target", z, 1) > 1);
|
||||
|
||||
skills.put(id, ms);
|
||||
if (ms.targetsAll) {
|
||||
multiTargetedSkills.add(id);
|
||||
} else {
|
||||
singleTargetedSkills.add(id);
|
||||
}
|
||||
}
|
||||
for (MapleData z : dataRoot.getData("MCGuardian.img")) {
|
||||
guardians.put(Integer.parseInt(z.getName()), new MCSkill(MapleDataTool.getInt("spendCP", z, 0), MapleDataTool.getInt("mobSkillID", z, 0), MapleDataTool.getInt("level", z, 0), true));
|
||||
}
|
||||
}
|
||||
|
||||
private MCSkill randomizeSkill(boolean multi) {
|
||||
if (multi) {
|
||||
return skills.get(multiTargetedSkills.get((int) (Math.random() * multiTargetedSkills.size())));
|
||||
} else {
|
||||
return skills.get(multiTargetedSkills.get((int) (Math.random() * multiTargetedSkills.size())));
|
||||
}
|
||||
}
|
||||
|
||||
public MCSkill getSkill(final int id) {
|
||||
return skills.get(id);
|
||||
MCSkill skill = skills.get(id);
|
||||
if (skill != null && skill.skillid <= 0) {
|
||||
return randomizeSkill(skill.targetsAll);
|
||||
} else {
|
||||
return skill;
|
||||
}
|
||||
}
|
||||
|
||||
public MCSkill getGuardian(final int id) {
|
||||
@@ -63,17 +89,14 @@ public class MapleCarnivalFactory {
|
||||
}
|
||||
|
||||
public MobSkill getSkill() {
|
||||
return getMobSkill(skillid);
|
||||
return getMobSkill(skillid, level);
|
||||
}
|
||||
|
||||
public static MobSkill getMobSkill(int skillid) {
|
||||
return MobSkillFactory.getMobSkill(skillid, 1); //level?
|
||||
public static MobSkill getMobSkill(int skillid, int level) {
|
||||
return MobSkillFactory.getMobSkill(skillid, level);
|
||||
}
|
||||
|
||||
public MapleDisease getDisease() {
|
||||
if (skillid <= 0) {
|
||||
return MapleDisease.getRandom();
|
||||
}
|
||||
return MapleDisease.getBySkill(skillid);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ public class MonsterCarnival {
|
||||
private long startTime = 0;
|
||||
private int summonsR = 8, summonsB = 8, room = 0;
|
||||
private MapleCharacter leader1, leader2, Grupo1, Grupo2;
|
||||
private int redCP, blueCP, redTotalCP, blueTotalCP;
|
||||
private int redCP, blueCP, redTotalCP, blueTotalCP, redTimeupCP, blueTimeupCP;
|
||||
private boolean cpq1;
|
||||
|
||||
public MonsterCarnival(MapleParty p1, MapleParty p2, int mapid, boolean cpq1, int room) {
|
||||
@@ -42,6 +42,7 @@ public class MonsterCarnival {
|
||||
p1.setEnemy(p2);
|
||||
p2.setEnemy(p1);
|
||||
map = cs.getMapFactory().getDisposableMap(mapid);
|
||||
startTime = System.currentTimeMillis() + 10 * 60 * 1000;
|
||||
int redPortal = 0;
|
||||
int bluePortal = 0;
|
||||
if (map.isPurpleCPQMap()) {
|
||||
@@ -55,7 +56,7 @@ public class MonsterCarnival {
|
||||
mc.setTeam(0);
|
||||
mc.setFestivalPoints(0);
|
||||
mc.forceChangeMap(map, map.getPortal(redPortal));
|
||||
mc.dropMessage(6, LanguageConstants.Linguas(mc).CPQEntrada);
|
||||
mc.dropMessage(6, LanguageConstants.Languages(mc).CPQEntry);
|
||||
if (p1.getLeader().getId() == mc.getId()) {
|
||||
leader1 = mc;
|
||||
}
|
||||
@@ -69,7 +70,7 @@ public class MonsterCarnival {
|
||||
mc.setTeam(1);
|
||||
mc.setFestivalPoints(0);
|
||||
mc.forceChangeMap(map, map.getPortal(bluePortal));
|
||||
mc.dropMessage(6, LanguageConstants.Linguas(mc).CPQEntrada);
|
||||
mc.dropMessage(6, LanguageConstants.Languages(mc).CPQEntry);
|
||||
if (p2.getLeader().getId() == mc.getId()) {
|
||||
leader2 = mc;
|
||||
}
|
||||
@@ -78,16 +79,16 @@ public class MonsterCarnival {
|
||||
}
|
||||
if (Grupo1 == null || Grupo2 == null) {
|
||||
for (MaplePartyCharacter mpc : p2.getMembers()) {
|
||||
mpc.getPlayer().dropMessage(5, LanguageConstants.Linguas(mpc.getPlayer()).CPQErro);
|
||||
mpc.getPlayer().dropMessage(5, LanguageConstants.Languages(mpc.getPlayer()).CPQError);
|
||||
}
|
||||
for (MaplePartyCharacter mpc : p2.getMembers()) {
|
||||
mpc.getPlayer().dropMessage(5, LanguageConstants.Linguas(mpc.getPlayer()).CPQErro);
|
||||
mpc.getPlayer().dropMessage(5, LanguageConstants.Languages(mpc.getPlayer()).CPQError);
|
||||
}
|
||||
return;
|
||||
}
|
||||
Grupo1.getClient().announce(MaplePacketCreator.startMonsterCarnival(Grupo1, 0, 1));
|
||||
Grupo2.getClient().announce(MaplePacketCreator.startMonsterCarnival(Grupo2, 1, 0));
|
||||
startTime = System.currentTimeMillis() + 60 * 10000;
|
||||
|
||||
// thanks Atoot, Vcoc for noting double CPQ functional being sent to players in CPQ start
|
||||
|
||||
timer = TimerManager.getInstance().schedule(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
@@ -106,12 +107,8 @@ public class MonsterCarnival {
|
||||
respawn();
|
||||
}
|
||||
}, ServerConstants.RESPAWN_INTERVAL);
|
||||
TimerManager.getInstance().schedule(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
map.addClock(60 * 10);
|
||||
}
|
||||
}, 2000);
|
||||
|
||||
cs.initMonsterCarnival(cpq1, room);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -140,18 +137,18 @@ public class MonsterCarnival {
|
||||
String teamS = "";
|
||||
switch (team) {
|
||||
case 0:
|
||||
teamS = LanguageConstants.Linguas(chrMap).CPQVermelho;
|
||||
teamS = LanguageConstants.Languages(chrMap).CPQRed;
|
||||
break;
|
||||
case 1:
|
||||
teamS = LanguageConstants.Linguas(chrMap).CPQAzul;
|
||||
teamS = LanguageConstants.Languages(chrMap).CPQBlue;
|
||||
break;
|
||||
}
|
||||
chrMap.dropMessage(5, teamS + LanguageConstants.Linguas(chrMap).CPQPlayerExit);
|
||||
chrMap.dropMessage(5, teamS + LanguageConstants.Languages(chrMap).CPQPlayerExit);
|
||||
}
|
||||
earlyFinish();
|
||||
}
|
||||
|
||||
public void earlyFinish() {
|
||||
private void earlyFinish() {
|
||||
dispose(true);
|
||||
}
|
||||
|
||||
@@ -180,12 +177,12 @@ public class MonsterCarnival {
|
||||
}
|
||||
|
||||
protected void dispose(boolean warpout) {
|
||||
Channel cs = Server.getInstance().getWorld(p1.getLeader().getWorld()).getChannel(p1.getLeader().getChannel());
|
||||
Channel cs = map.getChannelServer();
|
||||
MapleMap out;
|
||||
if (!cpq1) { // cpq2
|
||||
out = cs.getMapFactory().getMap(980030000);
|
||||
out = cs.getMapFactory().getMap(980030010);
|
||||
} else {
|
||||
out = cs.getMapFactory().getMap(980000000);
|
||||
out = cs.getMapFactory().getMap(980000010);
|
||||
}
|
||||
for (MaplePartyCharacter mpc : leader1.getParty().getMembers()) {
|
||||
MapleCharacter mc = cs.getPlayerStorage().getCharacterById(mpc.getId());
|
||||
@@ -227,7 +224,8 @@ public class MonsterCarnival {
|
||||
leader2.getParty().setEnemy(null);
|
||||
map.dispose();
|
||||
map = null;
|
||||
|
||||
|
||||
cs.finishMonsterCarnival(cpq1, room);
|
||||
}
|
||||
|
||||
public void exit() {
|
||||
@@ -238,9 +236,9 @@ public class MonsterCarnival {
|
||||
return this.timer;
|
||||
}
|
||||
|
||||
public void finish(int winningTeam) {
|
||||
private void finish(int winningTeam) {
|
||||
try {
|
||||
Channel cs = Server.getInstance().getWorld(p1.getLeader().getWorld()).getChannel(p1.getLeader().getChannel());
|
||||
Channel cs = map.getChannelServer();
|
||||
if (winningTeam == 0) {
|
||||
for (MaplePartyCharacter mpc : leader1.getParty().getMembers()) {
|
||||
MapleCharacter mc = cs.getPlayerStorage().getCharacterById(mpc.getId());
|
||||
@@ -306,9 +304,9 @@ public class MonsterCarnival {
|
||||
}
|
||||
}
|
||||
|
||||
public void timeUp() {
|
||||
int cp1 = this.redTotalCP;
|
||||
int cp2 = this.blueTotalCP;
|
||||
private void timeUp() {
|
||||
int cp1 = this.redTimeupCP;
|
||||
int cp2 = this.blueTimeupCP;
|
||||
if (cp1 == cp2) {
|
||||
extendTime();
|
||||
return;
|
||||
@@ -328,11 +326,11 @@ public class MonsterCarnival {
|
||||
return (int) (getTimeLeft() / 1000);
|
||||
}
|
||||
|
||||
public void extendTime() {
|
||||
private void extendTime() {
|
||||
for (MapleCharacter chrMap : map.getAllPlayers()) {
|
||||
chrMap.dropMessage(5, LanguageConstants.Linguas(chrMap).CPQTempoExtendido);
|
||||
chrMap.dropMessage(5, LanguageConstants.Languages(chrMap).CPQExtendTime);
|
||||
}
|
||||
startTime = System.currentTimeMillis() + 3 * 1000;
|
||||
startTime = System.currentTimeMillis() + 3 * 60 * 1000;
|
||||
map.addClock(3 * 60);
|
||||
timer = TimerManager.getInstance().schedule(new Runnable() {
|
||||
@Override
|
||||
@@ -345,12 +343,16 @@ public class MonsterCarnival {
|
||||
public void run() {
|
||||
complete();
|
||||
}
|
||||
}, 3 * 60 * 1000 - 10);
|
||||
}, 3 * 60 * 1000 - 10 * 1000); // thanks Vcoc for noticing a time set issue here
|
||||
}
|
||||
|
||||
public void complete() {
|
||||
int cp1 = this.redTotalCP;
|
||||
int cp2 = this.blueTotalCP;
|
||||
|
||||
this.redTimeupCP = cp1;
|
||||
this.blueTimeupCP = cp2;
|
||||
|
||||
if (cp1 == cp2) {
|
||||
return;
|
||||
}
|
||||
@@ -361,7 +363,7 @@ public class MonsterCarnival {
|
||||
throw new RuntimeException("Os lideres estao em canais diferentes.");
|
||||
}
|
||||
|
||||
Channel cs = Server.getInstance().getWorld(p1.getLeader().getWorld()).getChannel(p1.getLeader().getChannel());
|
||||
Channel cs = map.getChannelServer();
|
||||
map.killAllMonsters();
|
||||
for (MaplePartyCharacter mpc : leader1.getParty().getMembers()) {
|
||||
MapleCharacter mc;
|
||||
@@ -508,4 +510,8 @@ public class MonsterCarnival {
|
||||
public int getRoom() {
|
||||
return this.room;
|
||||
}
|
||||
|
||||
public MapleMap getEventMap() {
|
||||
return this.map;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user