CPQ 1 CPQ 2 CASAMENTO

This commit is contained in:
Diego Armando de Freitas Matos
2019-03-06 21:55:47 -03:00
parent 799870df63
commit 90ad58f17f
60 changed files with 17442 additions and 15142 deletions

View File

@@ -50,7 +50,6 @@ import client.MapleCharacter;
import client.MapleDisease;
import client.MapleJob;
import client.MapleMount;
import client.MapleStat;
import client.Skill;
import client.SkillFactory;
import client.inventory.Item;
@@ -111,6 +110,10 @@ import constants.skills.SuperGM;
import constants.skills.ThunderBreaker;
import constants.skills.WhiteKnight;
import constants.skills.WindArcher;
import net.server.world.MapleParty;
import net.server.world.MaplePartyCharacter;
import server.partyquest.MapleCarnivalFactory;
import server.partyquest.MapleCarnivalFactory.MCSkill;
/**
* @author Matze
@@ -129,6 +132,8 @@ public class MapleStatEffect {
private boolean overTime, repeatEffect;
private int sourceid;
private int moveTo;
private int cp, nuffSkill;
private List<MapleDisease> cureDebuffs;
private boolean skill;
private List<Pair<MapleBuffStat, Integer>> statups;
private Map<MonsterStatus, Integer> monsterStatus;
@@ -155,17 +160,15 @@ public class MapleStatEffect {
}
private static byte mapProtection(int sourceid) {
if(sourceid == 2022001 || sourceid == 2022186) {
if (sourceid == 2022001 || sourceid == 2022186) {
return 1; //elnath cold
}
else if(sourceid == 2022040) {
} else if (sourceid == 2022040) {
return 2; //aqua road underwater
} else {
return 0;
}
else return 0;
}
private static MapleStatEffect loadFromData(MapleData source, int sourceid, boolean skill, boolean overTime) {
MapleStatEffect ret = new MapleStatEffect();
ret.duration = MapleDataTool.getIntConvert("time", source, -1);
@@ -177,6 +180,27 @@ public class MapleStatEffect {
ret.hpCon = (short) MapleDataTool.getInt("hpCon", source, 0);
int iprop = MapleDataTool.getInt("prop", source, 100);
ret.prop = iprop / 100.0;
ret.cp = MapleDataTool.getInt("cp", source, 0);
List<MapleDisease> cure = new ArrayList<MapleDisease>(5);
if (MapleDataTool.getInt("poison", source, 0) > 0) {
cure.add(MapleDisease.POISON);
}
if (MapleDataTool.getInt("seal", source, 0) > 0) {
cure.add(MapleDisease.SEAL);
}
if (MapleDataTool.getInt("darkness", source, 0) > 0) {
cure.add(MapleDisease.DARKNESS);
}
if (MapleDataTool.getInt("weakness", source, 0) > 0) {
cure.add(MapleDisease.WEAKEN);
}
if (MapleDataTool.getInt("curse", source, 0) > 0) {
cure.add(MapleDisease.CURSE);
}
ret.cureDebuffs = cure;
ret.nuffSkill = MapleDataTool.getInt("nuffSkill", source, 0);
ret.mobCount = MapleDataTool.getInt("mobCount", source, 1);
ret.cooldown = MapleDataTool.getInt("cooltime", source, 0);
ret.morphId = MapleDataTool.getInt("morph", source, 0);
@@ -192,7 +216,7 @@ public class MapleStatEffect {
ret.duration *= 1000; // items have their times stored in ms, of course
ret.overTime = overTime;
}
ArrayList<Pair<MapleBuffStat, Integer>> statups = new ArrayList<>();
ret.watk = (short) MapleDataTool.getInt("pad", source, 0);
ret.wdef = (short) MapleDataTool.getInt("pdd", source, 0);
@@ -200,23 +224,23 @@ public class MapleStatEffect {
ret.mdef = (short) MapleDataTool.getInt("mdd", source, 0);
ret.acc = (short) MapleDataTool.getIntConvert("acc", source, 0);
ret.avoid = (short) MapleDataTool.getInt("eva", source, 0);
ret.speed = (short) MapleDataTool.getInt("speed", source, 0);
ret.jump = (short) MapleDataTool.getInt("jump", source, 0);
ret.mapProtection = mapProtection(sourceid);
addBuffStatPairToListIfNotZero(statups, MapleBuffStat.MAP_PROTECTION, Integer.valueOf(ret.mapProtection));
if (ret.overTime && ret.getSummonMovementType() == null) {
if(!skill) {
if(isPyramidBuff(sourceid)) {
if (!skill) {
if (isPyramidBuff(sourceid)) {
ret.berserk = MapleDataTool.getInt("berserk", source, 0);
ret.booster = MapleDataTool.getInt("booster", source, 0);
addBuffStatPairToListIfNotZero(statups, MapleBuffStat.BERSERK, Integer.valueOf(ret.berserk));
addBuffStatPairToListIfNotZero(statups, MapleBuffStat.BOOSTER, Integer.valueOf(ret.booster));
} else if(isDojoBuff(sourceid) || isHpMpRecovery(sourceid)) {
} else if (isDojoBuff(sourceid) || isHpMpRecovery(sourceid)) {
ret.mhpR = (byte) MapleDataTool.getInt("mhpR", source, 0);
ret.mhpRRate = (short) (MapleDataTool.getInt("mhpRRate", source, 0) * 100);
ret.mmpR = (byte) MapleDataTool.getInt("mmpR", source, 0);
@@ -224,9 +248,9 @@ public class MapleStatEffect {
addBuffStatPairToListIfNotZero(statups, MapleBuffStat.HPREC, Integer.valueOf(ret.mhpR));
addBuffStatPairToListIfNotZero(statups, MapleBuffStat.MPREC, Integer.valueOf(ret.mmpR));
} else if(isRateCoupon(sourceid)) {
switch(MapleDataTool.getInt("expR", source, 0)) {
} else if (isRateCoupon(sourceid)) {
switch (MapleDataTool.getInt("expR", source, 0)) {
case 1:
addBuffStatPairToListIfNotZero(statups, MapleBuffStat.COUPON_EXP1, 1);
break;
@@ -244,7 +268,7 @@ public class MapleStatEffect {
break;
}
switch(MapleDataTool.getInt("drpR", source, 0)) {
switch (MapleDataTool.getInt("drpR", source, 0)) {
case 1:
addBuffStatPairToListIfNotZero(statups, MapleBuffStat.COUPON_DRP1, 1);
break;
@@ -257,18 +281,18 @@ public class MapleStatEffect {
addBuffStatPairToListIfNotZero(statups, MapleBuffStat.COUPON_DRP3, 1);
break;
}
} else if(isExpIncrease(sourceid)) {
} else if (isExpIncrease(sourceid)) {
addBuffStatPairToListIfNotZero(statups, MapleBuffStat.EXP_INCREASE, MapleDataTool.getInt("expinc", source, 0));
}
} else {
if(isMapChair(sourceid)) {
if (isMapChair(sourceid)) {
addBuffStatPairToListIfNotZero(statups, MapleBuffStat.MAP_CHAIR, 1);
} else if((sourceid == Beginner.NIMBLE_FEET || sourceid == Noblesse.NIMBLE_FEET || sourceid == Evan.NIMBLE_FEET || sourceid == Legend.AGILE_BODY) && ServerConstants.USE_ULTRA_NIMBLE_FEET == true) {
ret.jump = (short)(ret.speed * 4);
} else if ((sourceid == Beginner.NIMBLE_FEET || sourceid == Noblesse.NIMBLE_FEET || sourceid == Evan.NIMBLE_FEET || sourceid == Legend.AGILE_BODY) && ServerConstants.USE_ULTRA_NIMBLE_FEET == true) {
ret.jump = (short) (ret.speed * 4);
ret.speed *= 15;
}
}
addBuffStatPairToListIfNotZero(statups, MapleBuffStat.WATK, Integer.valueOf(ret.watk));
addBuffStatPairToListIfNotZero(statups, MapleBuffStat.WDEF, Integer.valueOf(ret.wdef));
addBuffStatPairToListIfNotZero(statups, MapleBuffStat.MATK, Integer.valueOf(ret.matk));
@@ -278,26 +302,26 @@ public class MapleStatEffect {
addBuffStatPairToListIfNotZero(statups, MapleBuffStat.SPEED, Integer.valueOf(ret.speed));
addBuffStatPairToListIfNotZero(statups, MapleBuffStat.JUMP, Integer.valueOf(ret.jump));
}
MapleData ltd = source.getChildByPath("lt");
if (ltd != null) {
ret.lt = (Point) ltd.getData();
ret.rb = (Point) source.getChildByPath("rb").getData();
if(ServerConstants.USE_MAXRANGE_ECHO_OF_HERO && (sourceid == Beginner.ECHO_OF_HERO || sourceid == Noblesse.ECHO_OF_HERO || sourceid == Legend.ECHO_OF_HERO || sourceid == Evan.ECHO_OF_HERO)) {
if (ServerConstants.USE_MAXRANGE_ECHO_OF_HERO && (sourceid == Beginner.ECHO_OF_HERO || sourceid == Noblesse.ECHO_OF_HERO || sourceid == Legend.ECHO_OF_HERO || sourceid == Evan.ECHO_OF_HERO)) {
ret.lt = new Point(Integer.MIN_VALUE, Integer.MIN_VALUE);
ret.rb = new Point(Integer.MAX_VALUE, Integer.MAX_VALUE);
}
}
int x = MapleDataTool.getInt("x", source, 0);
if((sourceid == Beginner.RECOVERY || sourceid == Noblesse.RECOVERY || sourceid == Evan.RECOVERY || sourceid == Legend.RECOVERY) && ServerConstants.USE_ULTRA_RECOVERY == true) {
if ((sourceid == Beginner.RECOVERY || sourceid == Noblesse.RECOVERY || sourceid == Evan.RECOVERY || sourceid == Legend.RECOVERY) && ServerConstants.USE_ULTRA_RECOVERY == true) {
x *= 10;
}
ret.x = x;
ret.y = MapleDataTool.getInt("y", source, 0);
ret.damage = MapleDataTool.getIntConvert("damage", source, 100);
ret.fixdamage = MapleDataTool.getIntConvert("fixdamage", source, -1);
ret.attackCount = MapleDataTool.getIntConvert("attackCount", source, 1);
@@ -416,8 +440,8 @@ public class MapleStatEffect {
break;
case BlazeWizard.ELEMENTAL_RESET:
case Evan.ELEMENTAL_RESET:
statups.add(new Pair<>(MapleBuffStat.ELEMENTAL_RESET, Integer.valueOf(x)));
break;
statups.add(new Pair<>(MapleBuffStat.ELEMENTAL_RESET, Integer.valueOf(x)));
break;
case Evan.MAGIC_SHIELD:
statups.add(new Pair<>(MapleBuffStat.MAGIC_SHIELD, Integer.valueOf(x)));
break;
@@ -425,7 +449,7 @@ public class MapleStatEffect {
statups.add(new Pair<>(MapleBuffStat.MAGIC_RESISTANCE, Integer.valueOf(x)));
break;
case Evan.SLOW:
statups.add(new Pair<>(MapleBuffStat.SLOW, Integer.valueOf(x)));
statups.add(new Pair<>(MapleBuffStat.SLOW, Integer.valueOf(x)));
// BOWMAN
case Priest.MYSTIC_DOOR:
case Hunter.SOUL_ARROW:
@@ -474,7 +498,7 @@ public class MapleStatEffect {
break;
case ChiefBandit.PICKPOCKET:
statups.add(new Pair<>(MapleBuffStat.PICKPOCKET, Integer.valueOf(x)));
break;
break;
case NightLord.SHADOW_STARS:
statups.add(new Pair<>(MapleBuffStat.SHADOW_CLAW, Integer.valueOf(0)));
break;
@@ -605,7 +629,7 @@ public class MapleStatEffect {
case Buccaneer.BARRAGE:
case Gunslinger.BLANK_SHOT:
case DawnWarrior.COMA:
case ThunderBreaker.BARRAGE:
case ThunderBreaker.BARRAGE:
case Aran.ROLLING_SPIN:
case Evan.FIRE_BREATH:
case Evan.BLAZE:
@@ -633,7 +657,7 @@ public class MapleStatEffect {
case ILWizard.SLOW:
case BlazeWizard.SLOW:
monsterStatus.put(MonsterStatus.SPEED, Integer.valueOf(ret.x));
break;
break;
case FPWizard.POISON_BREATH:
case FPMage.ELEMENT_COMPOSITION:
monsterStatus.put(MonsterStatus.POISON, Integer.valueOf(1));
@@ -655,7 +679,7 @@ public class MapleStatEffect {
monsterStatus.put(MonsterStatus.FREEZE, Integer.valueOf(1));
break;
case Evan.PHANTOM_IMPRINT:
monsterStatus.put(MonsterStatus.PHANTOM_IMPRINT, Integer.valueOf(x));
monsterStatus.put(MonsterStatus.PHANTOM_IMPRINT, Integer.valueOf(x));
//ARAN
case Aran.COMBO_ABILITY:
statups.add(new Pair<>(MapleBuffStat.ARAN_COMBO, Integer.valueOf(100)));
@@ -723,19 +747,19 @@ public class MapleStatEffect {
public boolean applyEchoOfHero(MapleCharacter applyfrom) {
Map<Integer, MapleCharacter> mapPlayers = applyfrom.getMap().getMapPlayers();
mapPlayers.remove(applyfrom.getId());
boolean hwResult = applyTo(applyfrom);
for (MapleCharacter chr : mapPlayers.values()) { // Echo of Hero not buffing players in the map detected thanks to Masterrulax
applyTo(applyfrom, chr, false, null, false, 1);
}
return hwResult;
}
public boolean applyTo(MapleCharacter chr) {
return applyTo(chr, chr, true, null, false, 1);
}
public boolean applyTo(MapleCharacter chr, boolean useMaxRange) {
return applyTo(chr, chr, true, null, useMaxRange, 1);
}
@@ -750,16 +774,16 @@ public class MapleStatEffect {
applyto.toggleHide(false);
return true;
}
if (primary && isHeal()) {
affectedPlayers = applyBuff(applyfrom, useMaxRange);
}
int hpchange = calcHPChange(applyfrom, primary, affectedPlayers);
int mpchange = calcMPChange(applyfrom, primary);
if (primary) {
if (itemConNo != 0) {
if(!applyto.getClient().getAbstractPlayerInteraction().hasItem(itemCon, itemConNo)) {
if (!applyto.getClient().getAbstractPlayerInteraction().hasItem(itemCon, itemConNo)) {
applyto.announce(MaplePacketCreator.enableActions());
return false;
}
@@ -771,7 +795,7 @@ public class MapleStatEffect {
applyto.broadcastStance(applyto.isFacingLeft() ? 5 : 4);
}
}
if (isDispel() && makeChanceResult()) {
applyto.dispelDebuffs();
} else if (isCureAllAbnormalStatus()) {
@@ -784,24 +808,26 @@ public class MapleStatEffect {
/*if (applyfrom.getMp() < getMpCon()) {
AutobanFactory.MPCON.addPoint(applyfrom.getAutobanManager(), "mpCon hack for skill:" + sourceid + "; Player MP: " + applyto.getMp() + " MP Needed: " + getMpCon());
} */
if (!applyto.applyHpMpChange(hpCon, hpchange, mpchange)) {
applyto.announce(MaplePacketCreator.enableActions());
return false;
}
if (moveTo != -1) {
if (moveTo != applyto.getMapId()) {
MapleMap target;
MaplePortal pt;
if (moveTo == 999999999) {
if(sourceid != 2030100) {
if (sourceid != 2030100) {
target = applyto.getMap().getReturnMap();
pt = target.getRandomPlayerSpawnpoint();
} else {
if(!applyto.canRecoverLastBanish()) return false;
if (!applyto.canRecoverLastBanish()) {
return false;
}
Pair<Integer, Integer> lastBanishInfo = applyto.getLastBanishData();
target = applyto.getWarpMap(lastBanishInfo.getLeft());
pt = target.getPortal(lastBanishInfo.getRight());
@@ -810,12 +836,12 @@ public class MapleStatEffect {
target = applyto.getClient().getWorldServer().getChannel(applyto.getClient().getChannel()).getMapFactory().getMap(moveTo);
int targetid = target.getId() / 10000000;
if (targetid != 60 && applyto.getMapId() / 10000000 != 61 && targetid != applyto.getMapId() / 10000000 && targetid != 21 && targetid != 20 && targetid != 12 && (applyto.getMapId() / 10000000 != 10 && applyto.getMapId() / 10000000 != 12)) {
return false;
return false;
}
pt = target.getRandomPlayerSpawnpoint();
}
applyto.changeMap(target, pt);
} else {
return false;
@@ -842,15 +868,15 @@ public class MapleStatEffect {
SummonMovementType summonMovementType = getSummonMovementType();
if (overTime || isCygnusFA() || summonMovementType != null) {
if (summonMovementType != null && pos != null) {
if(summonMovementType.getValue() == summonMovementType.STATIONARY.getValue()) {
if (summonMovementType.getValue() == summonMovementType.STATIONARY.getValue()) {
applyto.cancelBuffStats(MapleBuffStat.PUPPET);
} else {
applyto.cancelBuffStats(MapleBuffStat.SUMMON);
}
applyto.announce(MaplePacketCreator.enableActions());
}
applyBuffEffect(applyfrom, applyto, primary);
}
@@ -863,7 +889,7 @@ public class MapleStatEffect {
applyMonsterBuff(applyfrom);
}
}
if (this.getFatigue() != 0) {
applyto.getMount().setTiredness(applyto.getMount().getTiredness() + this.getFatigue());
}
@@ -880,25 +906,29 @@ public class MapleStatEffect {
if (isMagicDoor() && !FieldLimit.DOOR.check(applyto.getMap().getFieldLimit())) { // Magic Door
int y = applyto.getFh();
if (y == 0) {
y = applyto.getPosition().y;
y = applyto.getPosition().y;
}
Point doorPosition = new Point(applyto.getPosition().x, y);
MapleDoor door = new MapleDoor(applyto, doorPosition);
if(door.getOwnerId() >= 0) {
if (door.getOwnerId() >= 0) {
applyto.applyPartyDoor(door, false);
door.getTarget().spawnDoor(door.getAreaDoor());
door.getTown().spawnDoor(door.getTownDoor());
applyto.disableDoorSpawn();
} else {
MapleInventoryManipulator.addFromDrop(applyto.getClient(), new Item(4006000, (short) 0, (short) 1), false);
if(door.getOwnerId() == -3) applyto.dropMessage(5, "Mystic Door cannot be cast far from a spawn point. Nearest one is at " + door.getDoorStatus().getRight() + "pts " + door.getDoorStatus().getLeft());
else if(door.getOwnerId() == -2) applyto.dropMessage(5, "Mystic Door cannot be cast on a slope, try elsewhere.");
else applyto.dropMessage(5, "There are no door portals available for the town at this moment. Try again later.");
if (door.getOwnerId() == -3) {
applyto.dropMessage(5, "Mystic Door cannot be cast far from a spawn point. Nearest one is at " + door.getDoorStatus().getRight() + "pts " + door.getDoorStatus().getLeft());
} else if (door.getOwnerId() == -2) {
applyto.dropMessage(5, "Mystic Door cannot be cast on a slope, try elsewhere.");
} else {
applyto.dropMessage(5, "There are no door portals available for the town at this moment. Try again later.");
}
applyto.cancelBuffStats(MapleBuffStat.SOULARROW); // cancel door buff
}
} else if (isMist()) {
@@ -907,14 +937,51 @@ public class MapleStatEffect {
applyfrom.getMap().spawnMist(mist, getDuration(), mist.isPoisonMist(), false, mist.isRecoveryMist());
} else if (isTimeLeap()) {
applyto.removeAllCooldownsExcept(Buccaneer.TIME_LEAP, true);
} else if (cp != 0 && applyto.getMonsterCarnival() != null) {
applyto.gainCP(cp);
} else if (nuffSkill != 0 && applyto.getParty() != null && applyto.getMap().isCPQMap()) {
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());
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());
}
}
}
}
}
} else if (cureDebuffs.size() > 0) {
for (final MapleDisease debuff : cureDebuffs) {
if (applyfrom.getParty() != null) {
for (MaplePartyCharacter chrs : applyfrom.getParty().getPartyMembers()) {
chrs.getPlayer().dispelDebuff(debuff);
}
} else {
applyfrom.dispelDebuff(debuff);
}
}
}
return true;
}
private int applyBuff(MapleCharacter applyfrom, boolean useMaxRange) {
int affectedc = 1;
if (isPartyBuff() && (applyfrom.getParty() != null || isGmBuff())) {
Rectangle bounds = (!useMaxRange) ? calculateBoundingBox(applyfrom.getPosition(), applyfrom.isFacingLeft()) : new Rectangle(Integer.MIN_VALUE / 2, Integer.MIN_VALUE / 2, Integer.MAX_VALUE, Integer.MAX_VALUE);
List<MapleMapObject> affecteds = applyfrom.getMap().getMapObjectsInRect(bounds, Arrays.asList(MapleMapObjectType.PLAYER));
@@ -933,7 +1000,7 @@ public class MapleStatEffect {
}
}
}
affectedc += affectedp.size(); // used for heal
for (MapleCharacter affected : affectedp) {
applyTo(applyfrom, affected, false, null, useMaxRange, affectedc);
@@ -941,7 +1008,7 @@ public class MapleStatEffect {
affected.getMap().broadcastMessage(affected, MaplePacketCreator.showBuffeffect(affected.getId(), sourceid, 2), false);
}
}
return affectedc;
}
@@ -952,15 +1019,15 @@ public class MapleStatEffect {
int i = 0;
for (MapleMapObject mo : affected) {
MapleMonster monster = (MapleMonster) mo;
if (isDispel()) {
monster.debuffMob(skill_.getId());
if (isDispel()) {
monster.debuffMob(skill_.getId());
} else {
if (makeChanceResult()) {
monster.applyStatus(applyfrom, new MonsterStatusEffect(getMonsterStati(), skill_, null, false), isPoison(), getDuration());
if (isCrash()) {
monster.debuffMob(skill_.getId());
}
if (makeChanceResult()) {
monster.applyStatus(applyfrom, new MonsterStatusEffect(getMonsterStati(), skill_, null, false), isPoison(), getDuration());
if (isCrash()) {
monster.debuffMob(skill_.getId());
}
}
}
i++;
if (i >= mobCount) {
@@ -982,17 +1049,17 @@ public class MapleStatEffect {
Rectangle bounds = new Rectangle(mylt.x, mylt.y, myrb.x - mylt.x, myrb.y - mylt.y);
return bounds;
}
public int getBuffLocalDuration() {
return !ServerConstants.USE_BUFF_EVERLASTING ? duration : Integer.MAX_VALUE;
}
public void silentApplyBuff(MapleCharacter chr, long localStartTime) {
int localDuration = getBuffLocalDuration();
localDuration = alchemistModifyVal(chr, localDuration, false);
//CancelEffectAction cancelAction = new CancelEffectAction(chr, this, starttime);
//ScheduledFuture<?> schedule = TimerManager.getInstance().schedule(cancelAction, ((starttime + localDuration) - Server.getInstance().getCurrentTime()));
chr.registerEffect(this, localStartTime, localStartTime + localDuration, true);
SummonMovementType summonMovementType = getSummonMovementType();
if (summonMovementType != null) {
@@ -1016,7 +1083,7 @@ public class MapleStatEffect {
// final ScheduledFuture<?> schedule = TimerManager.getInstance().schedule(cancelAction, ((starttime + 99999) - Server.getInstance().getCurrentTime()));
applyto.registerEffect(this, starttime, Long.MAX_VALUE, false);
}
public final void applyBeaconBuff(final MapleCharacter applyto, int objectid) { // thanks Thora & Hyun for reporting an issue with homing beacon autoflagging mobs when changing maps
final List<Pair<MapleBuffStat, Integer>> stat = Collections.singletonList(new Pair<>(MapleBuffStat.HOMING_BEACON, objectid));
applyto.announce(MaplePacketCreator.giveBuff(1, sourceid, stat));
@@ -1024,14 +1091,14 @@ public class MapleStatEffect {
final long starttime = Server.getInstance().getCurrentTime();
applyto.registerEffect(this, starttime, Long.MAX_VALUE, false);
}
public void updateBuffEffect(MapleCharacter target, List<Pair<MapleBuffStat, Integer>> activeStats, long starttime) {
int localDuration = getBuffLocalDuration();
localDuration = alchemistModifyVal(target, localDuration, false);
long leftDuration = (starttime + localDuration) - Server.getInstance().getCurrentTime();
if(leftDuration > 0) {
target.announce(MaplePacketCreator.giveBuff((skill ? sourceid : -sourceid), (int)leftDuration, activeStats));
if (leftDuration > 0) {
target.announce(MaplePacketCreator.giveBuff((skill ? sourceid : -sourceid), (int) leftDuration, activeStats));
}
}
@@ -1067,7 +1134,7 @@ public class MapleStatEffect {
if (applyto.getMount() == null) {
applyto.mount(ridingMountId, sourceid);
}
applyto.getClient().getWorldServer().registerMountHunger(applyto);
}
if (sourceid == Corsair.BATTLE_SHIP) {
@@ -1089,8 +1156,8 @@ public class MapleStatEffect {
localsourceid = ridingMountId;
localstatups = Collections.singletonList(new Pair<>(MapleBuffStat.MONSTER_RIDING, 0));
} else if (isSkillMorph()) {
for(int i = 0; i < localstatups.size(); i++) {
if(localstatups.get(i).getLeft().equals(MapleBuffStat.MORPH)) {
for (int i = 0; i < localstatups.size(); i++) {
if (localstatups.get(i).getLeft().equals(MapleBuffStat.MORPH)) {
localstatups.set(i, new Pair<>(MapleBuffStat.MORPH, getMorph(applyto)));
break;
}
@@ -1110,7 +1177,7 @@ public class MapleStatEffect {
buff = MaplePacketCreator.givePirateBuff(statups, sourceid, seconds);
mbuff = MaplePacketCreator.giveForeignPirateBuff(applyto.getId(), sourceid, seconds, localstatups);
} else if (isInfusion()) {
buff = MaplePacketCreator.givePirateBuff(localstatups, sourceid, seconds);
buff = MaplePacketCreator.givePirateBuff(localstatups, sourceid, seconds);
mbuff = MaplePacketCreator.giveForeignPirateBuff(applyto.getId(), sourceid, seconds, localstatups);
} else if (isDs()) {
List<Pair<MapleBuffStat, Integer>> dsstat = Collections.singletonList(new Pair<>(MapleBuffStat.DARKSIGHT, 0));
@@ -1125,10 +1192,10 @@ public class MapleStatEffect {
if (applyto.getBattleshipHp() <= 0) {
applyto.resetBattleshipHp();
}
localstatups = statups;
}
buff = MaplePacketCreator.giveBuff(localsourceid, localDuration, localstatups);
mbuff = MaplePacketCreator.showMonsterRiding(applyto.getId(), givemount);
localDuration = duration;
@@ -1144,15 +1211,15 @@ public class MapleStatEffect {
List<Pair<MapleBuffStat, Integer>> stat = Collections.singletonList(new Pair<>(MapleBuffStat.MORPH, Integer.valueOf(getMorph(applyto))));
mbuff = MaplePacketCreator.giveForeignBuff(applyto.getId(), stat);
}
if (buff != null) {
if (!hasNoIcon()) { //Thanks flav for such a simple release! :)
if (!hasNoIcon()) { //Thanks flav for such a simple release! :)
applyto.announce(buff);
} else {
} else {
System.out.println("<Error> NO buff icon for id " + sourceid);
}
}
long starttime = Server.getInstance().getCurrentTime();
//CancelEffectAction cancelAction = new CancelEffectAction(applyto, this, starttime);
//ScheduledFuture<?> schedule = TimerManager.getInstance().schedule(cancelAction, localDuration);
@@ -1273,7 +1340,7 @@ public class MapleStatEffect {
case Beginner.ECHO_OF_HERO:
case Noblesse.ECHO_OF_HERO:
case Legend.ECHO_OF_HERO:
case Evan.ECHO_OF_HERO:
case Evan.ECHO_OF_HERO:
case SuperGM.HEAL_PLUS_DISPEL:
case SuperGM.HASTE:
case SuperGM.HOLY_SYMBOL:
@@ -1346,45 +1413,44 @@ public class MapleStatEffect {
public boolean isRecovery() {
return sourceid == Beginner.RECOVERY || sourceid == Noblesse.RECOVERY || sourceid == Legend.RECOVERY || sourceid == Evan.RECOVERY;
}
public boolean isMapChair() {
return sourceid == Beginner.MAP_CHAIR || sourceid == Noblesse.MAP_CHAIR || sourceid == Legend.MAP_CHAIR;
}
public static boolean isMapChair(int sourceid) {
return sourceid == Beginner.MAP_CHAIR || sourceid == Noblesse.MAP_CHAIR || sourceid == Legend.MAP_CHAIR;
}
public boolean isDojoBuff() {
return sourceid >= 2022359 && sourceid <= 2022421;
}
public static boolean isDojoBuff(int sourceid) {
return sourceid >= 2022359 && sourceid <= 2022421;
}
public static boolean isHpMpRecovery(int sourceid) {
return sourceid == 2022198 || sourceid == 2022337;
}
public static boolean isPyramidBuff(int sourceid) {
return sourceid >= 2022585 && sourceid <= 2022617;
}
public static boolean isRateCoupon(int sourceid) {
int itemType = sourceid / 1000;
return itemType == 5211 || itemType == 5360;
}
public static boolean isExpIncrease(int sourceid) {
return sourceid >= 2022450 && sourceid <= 2022452;
}
private boolean isDs() {
return skill && (sourceid == Rogue.DARK_SIGHT || sourceid == NightWalker.DARK_SIGHT);
}
private boolean isWw() {
return skill && (sourceid == WindArcher.WIND_WALK);
}
@@ -1412,11 +1478,11 @@ public class MapleStatEffect {
private boolean isCouponBuff() {
return isRateCoupon(sourceid);
}
private boolean isMysticDoor() {
return skill && sourceid == Priest.MYSTIC_DOOR;
}
public boolean isMonsterRiding() {
return skill && (sourceid % 10000000 == 1004 || sourceid == Corsair.BATTLE_SHIP || sourceid == Beginner.SPACESHIP || sourceid == Noblesse.SPACESHIP
|| sourceid == Beginner.YETI_MOUNT1 || sourceid == Beginner.YETI_MOUNT2 || sourceid == Beginner.WITCH_BROOMSTICK || sourceid == Beginner.BALROG_MOUNT
@@ -1431,11 +1497,11 @@ public class MapleStatEffect {
public boolean isPoison() {
return skill && (sourceid == FPMage.POISON_MIST || sourceid == FPWizard.POISON_BREATH || sourceid == FPMage.ELEMENT_COMPOSITION || sourceid == NightWalker.POISON_BOMB || sourceid == BlazeWizard.FLAME_GEAR);
}
public boolean isMorph() {
return morphId > 0;
}
public boolean isMorphWithoutAttack() {
return morphId > 0 && morphId < 100; // Every morph item I have found has been under 100, pirate skill transforms start at 1000.
}
@@ -1453,9 +1519,9 @@ public class MapleStatEffect {
}
private boolean isCrash() {
return skill && (sourceid == DragonKnight.POWER_CRASH || sourceid == Crusader.ARMOR_CRASH || sourceid == WhiteKnight.MAGIC_CRASH);
return skill && (sourceid == DragonKnight.POWER_CRASH || sourceid == Crusader.ARMOR_CRASH || sourceid == WhiteKnight.MAGIC_CRASH);
}
private boolean isDispel() {
return skill && (sourceid == Priest.DISPEL || sourceid == SuperGM.HEAL_PLUS_DISPEL);
}
@@ -1463,13 +1529,15 @@ public class MapleStatEffect {
private boolean isCureAllAbnormalStatus() {
if (skill) {
return isHerosWill(sourceid);
} else if (sourceid == 2022544) return true;
} else if (sourceid == 2022544) {
return true;
}
return false;
}
public static boolean isHerosWill(int skillid) {
switch(skillid) {
switch (skillid) {
case Hero.HEROS_WILL:
case Paladin.HEROS_WILL:
case DarkKnight.HEROS_WILL:
@@ -1504,7 +1572,7 @@ public class MapleStatEffect {
private boolean isCygnusFA() {
return skill && (sourceid == DawnWarrior.FINAL_ATTACK || sourceid == WindArcher.FINAL_ATTACK);
}
private boolean isHyperBody() {
return skill && (sourceid == Spearman.HYPER_BODY || sourceid == GM.HYPER_BODY || sourceid == SuperGM.HYPER_BODY);
}
@@ -1561,17 +1629,16 @@ public class MapleStatEffect {
return null;
}
public boolean hasNoIcon() {
return (sourceid == 3111002 || sourceid == 3211002 || + // puppet, puppet
sourceid == 3211005 || + // golden eagle
sourceid == 3211005 || + // golden eagle
sourceid == 2121005 || sourceid == 2221005 || + // elquines, ifrit
sourceid == 2321003 || sourceid == 3121006 || + // bahamut, phoenix
sourceid == 3221005 || sourceid == 3111005 || + // frostprey, silver hawk
sourceid == 2311006 || sourceid == 5220002 || + // summon dragon, wrath of the octopi
sourceid == 5211001 || sourceid == 5211002); // octopus, gaviota
}
public boolean isSkill() {
return skill;
}
@@ -1579,7 +1646,7 @@ public class MapleStatEffect {
public int getSourceId() {
return sourceid;
}
public int getBuffSourceId() {
return skill ? sourceid : -sourceid;
}
@@ -1589,28 +1656,27 @@ public class MapleStatEffect {
}
/*
private static class CancelEffectAction implements Runnable {
private static class CancelEffectAction implements Runnable {
private MapleStatEffect effect;
private WeakReference<MapleCharacter> target;
private long startTime;
private MapleStatEffect effect;
private WeakReference<MapleCharacter> target;
private long startTime;
public CancelEffectAction(MapleCharacter target, MapleStatEffect effect, long startTime) {
this.effect = effect;
this.target = new WeakReference<>(target);
this.startTime = startTime;
}
@Override
public void run() {
MapleCharacter realTarget = target.get();
if (realTarget != null) {
realTarget.cancelEffect(effect, false, startTime);
}
}
}
*/
public CancelEffectAction(MapleCharacter target, MapleStatEffect effect, long startTime) {
this.effect = effect;
this.target = new WeakReference<>(target);
this.startTime = startTime;
}
@Override
public void run() {
MapleCharacter realTarget = target.get();
if (realTarget != null) {
realTarget.cancelEffect(effect, false, startTime);
}
}
}
*/
public short getHp() {
return hp;
}
@@ -1618,7 +1684,7 @@ public class MapleStatEffect {
public short getMp() {
return mp;
}
public double getHpRate() {
return hpR;
}
@@ -1626,7 +1692,7 @@ public class MapleStatEffect {
public double getMpRate() {
return mpR;
}
public byte getHpR() {
return mhpR;
}
@@ -1634,7 +1700,7 @@ public class MapleStatEffect {
public byte getMpR() {
return mmpR;
}
public short getHpRRate() {
return mhpRRate;
}
@@ -1654,7 +1720,7 @@ public class MapleStatEffect {
public short getMatk() {
return matk;
}
public short getWatk() {
return watk;
}
@@ -1714,4 +1780,4 @@ public class MapleStatEffect {
public Map<MonsterStatus, Integer> getMonsterStati() {
return monsterStatus;
}
}
}