AmoriaPQ + ItemSort fix + revamped GMShop

Implemented AmoriaPQ. Fixed an issue with ItemIdSortHandler where empty
vectors given to the sorting module would cause an exception thrown,
wiping players inventory items. Thanks to Vcoc, revamped shop data for
GMShop (shop id 1337). Mount quest for explorers now uses event script.
This commit is contained in:
ronancpl
2017-09-15 21:32:15 -03:00
parent 6abbc2947e
commit 1ffcf47f79
133 changed files with 63565 additions and 60865 deletions

View File

@@ -196,7 +196,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
private boolean hidden, canDoor = true, Berserk, hasMerchant, whiteChat = false;
private int linkedLevel = 0;
private String linkedName = null;
private boolean finishedDojoTutorial, dojoParty;
private boolean finishedDojoTutorial;
private String name;
private String chalktext;
private String dataString;
@@ -245,7 +245,6 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
private EnumMap<MapleDisease, MapleDiseaseValueHolder> diseases = new EnumMap<>(MapleDisease.class);
private Map<Integer, MapleDoor> doors = new LinkedHashMap<>();
private ScheduledFuture<?> dragonBloodSchedule;
private ScheduledFuture<?>[] fullnessSchedule = new ScheduledFuture<?>[3];
private ScheduledFuture<?> hpDecreaseTask;
private ScheduledFuture<?> beholderHealingSchedule, beholderBuffSchedule, BerserkSchedule;
private ScheduledFuture<?> expiretask;
@@ -4082,8 +4081,8 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
statup.add(new Pair<>(MapleStat.LEVEL, level));
statup.add(new Pair<>(MapleStat.MAXHP, maxhp));
statup.add(new Pair<>(MapleStat.MAXMP, maxmp));
statup.add(new Pair<>(MapleStat.STR, str));
statup.add(new Pair<>(MapleStat.DEX, dex));
statup.add(new Pair<>(MapleStat.STR, Math.min(str, Short.MAX_VALUE)));
statup.add(new Pair<>(MapleStat.DEX, Math.min(dex, Short.MAX_VALUE)));
if (job.getId() % 1000 > 0) {
remainingSp[GameConstants.getSkillBook(job.getId())] += 3;
statup.add(new Pair<>(MapleStat.AVAILABLESP, remainingSp[GameConstants.getSkillBook(job.getId())]));

View File

@@ -812,7 +812,7 @@ public class MapleClient {
}
}
public final void disconnect(boolean shutdown, boolean cashshop) {//once per MapleClient instance
public final synchronized void disconnect(boolean shutdown, boolean cashshop) {//once per MapleClient instance
if (disconnecting) {
return;
}

View File

@@ -98,7 +98,6 @@ import client.inventory.Equip;
import client.inventory.MapleInventory;
import client.inventory.MapleInventoryType;
import client.inventory.MaplePet;
import constants.GameConstants;
import constants.ItemConstants;
import constants.ServerConstants;
import java.util.ArrayList;
@@ -1252,6 +1251,12 @@ public class Commands {
continue;
}
}
if(player.getJob().isA(MapleJob.ARAN1)) {
skill = SkillFactory.getSkill(5001005);
player.changeSkillLevel(skill, (byte) -1, -1, -1);
}
player.yellowMessage("Skills maxed out.");
break;
@@ -1659,7 +1664,7 @@ public class Commands {
case "givems":
if (sub.length < 3){
player.yellowMessage("Syntax: !givemx <playername> <gainmx>");
player.yellowMessage("Syntax: !givems <playername> <gainmx>");
break;
}
@@ -1783,7 +1788,7 @@ public class Commands {
player.getMap().getPortal(sub[1]).setPortalState(true);
break;
case "closeportals":
case "closeportal":
if (sub.length < 2){
player.yellowMessage("Syntax: !closeportal <portalid>");
break;
@@ -1844,10 +1849,11 @@ public class Commands {
for (MapleCharacter chr : ch.getPlayerStorage().getAllCharacters()) {
s += MapleCharacter.makeMapleReadable(chr.getName()) + ", ";
}
player.dropMessage(s.substring(0, s.length() - 2));
player.dropMessage(6, s.substring(0, s.length() - 2));
}
}
player.dropMessage("There are a total of " + total + " players online.");
player.dropMessage(6, "There are a total of " + total + " players online.");
player.showHint("Players online: #e#r" + total + "#k#n.");
break;
case "warpsnowball":
@@ -2273,14 +2279,14 @@ public class Commands {
break;
case "playernpc":
if (sub.length < 3){
if (sub.length < 3){
player.yellowMessage("Syntax: !playernpc <playername> <npcid>");
break;
}
player.playerNPC(c.getChannelServer().getPlayerStorage().getCharacterByName(sub[1]), Integer.parseInt(sub[2]));
player.playerNPC(c.getChannelServer().getPlayerStorage().getCharacterByName(sub[1]), Integer.parseInt(sub[2]));
break;
default:
default:
return false;
}

View File

@@ -287,7 +287,7 @@ public class Equip extends Item {
}
private int randomizeStatUpgrade(int top) {
int limit = Math.min(top, ServerConstants.MAX_EQUIPMNT_LVLUP_STAT_GAIN);
int limit = Math.min(top, ServerConstants.MAX_EQUIPMNT_LVLUP_STAT_UP);
int poolCount = (limit * (limit + 1) / 2) + limit;
int rnd = Randomizer.rand(0, poolCount);

View File

@@ -79,7 +79,7 @@ public class GameConstants {
public static boolean isAranSkills(final int skill) {
return Aran.FULL_SWING == skill || Aran.OVER_SWING == skill || Aran.COMBO_TEMPEST == skill || Aran.COMBO_PENRIL == skill || Aran.COMBO_DRAIN == skill
return Aran.FULL_SWING == skill || Aran.OVER_SWING == skill || Aran.COMBO_TEMPEST == skill || Aran.COMBO_FENRIR == skill || Aran.COMBO_DRAIN == skill
|| Aran.HIDDEN_FULL_DOUBLE == skill || Aran.HIDDEN_FULL_TRIPLE == skill || Aran.HIDDEN_OVER_DOUBLE == skill || Aran.HIDDEN_OVER_TRIPLE == skill
|| Aran.COMBO_SMASH == skill || Aran.DOUBLE_SWING == skill || Aran.TRIPLE_SWING == skill;
}

View File

@@ -71,6 +71,7 @@ public class ServerConstants {
//Some Gameplay Enhancing Configurations
//Scroll Configuration
public static final boolean USE_PERFECT_GM_SCROLL = true; //Scrolls from GMs never uses up slots nor fails.
public static final boolean USE_PERFECT_SCROLLING = true; //Scrolls doesn't use slots upon failure.
public static final boolean USE_ENHANCED_CHSCROLL = true; //Equips even more powerful with chaos upgrade.
public static final boolean USE_ENHANCED_CRAFTING = true; //Applys chaos scroll on every equip crafted.
@@ -93,8 +94,8 @@ public class ServerConstants {
public static final boolean USE_EQUIPMNT_LVLUP_POWER = true;//Enable more powerful stats upgrades at equip level up.
public static final boolean USE_SPIKES_AVOID_BANISH = true; //Shoes equipped with spikes prevents mobs from banishing wearer.
public static final boolean USE_CHAIR_EXTRAHEAL = true; //Enable map chairs to further recover player's HP and MP.
public static final int MAX_EQUIPMNT_LVLUP_STAT_GAIN = 10000; //Max stat upgrade an equipment can have on a levelup.
public static final int MAX_EQUIPMNT_STAT = 32767; //Max stat on an equipment by leveling up.
public static final int MAX_EQUIPMNT_LVLUP_STAT_UP = 10000; //Max stat upgrade an equipment can have on a levelup.
public static final int MAX_EQUIPMNT_STAT = 32767; //Max stat on an equipment by leveling up.
public static final int USE_EQUIPMNT_LVLUP = 7; //All equips lvlup at max level of N, set 1 to disable.
public static final byte CHAIR_EXTRA_HEAL_HP = 70; //Each chair extra heal proc increasing HP.
public static final byte CHAIR_EXTRA_HEAL_MP = 42; //Each chair extra heal proc increasing MP.

View File

@@ -37,7 +37,7 @@ public class Aran {
public static final int BODY_PRESSURE = 21101003;
public static final int COMBO_DRAIN = 21100005;
public static final int COMBO_SMASH = 21100004;
public static final int COMBO_PENRIL = 21110004;
public static final int COMBO_FENRIR = 21110004;
public static final int COMBO_CRITICAL = 21110000;
public static final int FULL_SWING = 21110002;
public static final int ROLLING_SPIN = 21110006;

View File

@@ -240,8 +240,8 @@ public final class Channel {
@Override
public void run() {
for (Entry<Integer, MapleMap> map : mapFactory.getMaps().entrySet()) {
map.getValue().respawn();
for (MapleMap map : mapFactory.getMaps().values()) {
map.respawn();
}
}
}

View File

@@ -193,7 +193,7 @@ public abstract class AbstractDealDamageHandler extends AbstractMaplePacketHandl
}
//WTF IS THIS F3,1
/*if (attackCount != attack.numDamage && attack.skill != ChiefBandit.MESO_EXPLOSION && attack.skill != NightWalker.VAMPIRE && attack.skill != WindArcher.WIND_SHOT && attack.skill != Aran.COMBO_SMASH && attack.skill != Aran.COMBO_PENRIL && attack.skill != Aran.COMBO_TEMPEST && attack.skill != NightLord.NINJA_AMBUSH && attack.skill != Shadower.NINJA_AMBUSH) {
/*if (attackCount != attack.numDamage && attack.skill != ChiefBandit.MESO_EXPLOSION && attack.skill != NightWalker.VAMPIRE && attack.skill != WindArcher.WIND_SHOT && attack.skill != Aran.COMBO_SMASH && attack.skill != Aran.COMBO_FENRIR && attack.skill != Aran.COMBO_TEMPEST && attack.skill != NightLord.NINJA_AMBUSH && attack.skill != Shadower.NINJA_AMBUSH) {
return;
}*/

View File

@@ -303,15 +303,15 @@ public class AutoAssignHandler extends AbstractMaplePacketHandler {
int extras = 0;
extras = gainStatByType(chr, primary, statGain, statEqpd, prStat + extras);
extras = gainStatByType(chr, secondary, statGain, statEqpd, scStat + extras);
extras = gainStatByType(chr, tertiary, statGain, statEqpd, trStat + extras);
extras = gainStatByType(chr, primary, statGain, prStat + extras);
extras = gainStatByType(chr, secondary, statGain, scStat + extras);
extras = gainStatByType(chr, tertiary, statGain, trStat + extras);
if(extras > 0) { //redistribute surplus in priority order
extras = gainStatByType(chr, primary, statGain, statEqpd, extras);
extras = gainStatByType(chr, secondary, statGain, statEqpd, extras);
extras = gainStatByType(chr, tertiary, statGain, statEqpd, extras);
gainStatByType(chr, getQuaternaryStat(stance), statGain, statEqpd, extras);
extras = gainStatByType(chr, primary, statGain, extras);
extras = gainStatByType(chr, secondary, statGain, extras);
extras = gainStatByType(chr, tertiary, statGain, extras);
gainStatByType(chr, getQuaternaryStat(stance), statGain, extras);
}
int remainingAp = (chr.getRemainingAp() - getAccumulatedStatGain(statGain));
@@ -350,7 +350,7 @@ public class AutoAssignHandler extends AbstractMaplePacketHandler {
return;
}
total += tempVal;
extras += gainStatByType(chr, MapleStat.getBy5ByteEncoding(type), statGain, statEqpd, tempVal);
extras += gainStatByType(chr, MapleStat.getBy5ByteEncoding(type), statGain, tempVal);
}
int remainingAp = (chr.getRemainingAp() - total) + extras;
chr.setRemainingAp(remainingAp);
@@ -359,42 +359,42 @@ public class AutoAssignHandler extends AbstractMaplePacketHandler {
}
}
private int gainStatByType(MapleCharacter chr, MapleStat type, int[] statGain, int[] statEqpd, int gain) {
private int gainStatByType(MapleCharacter chr, MapleStat type, int[] statGain, int gain) {
if(gain <= 0) return 0;
int newVal = 0;
if (type.equals(MapleStat.STR)) {
newVal = chr.getStr() + statEqpd[0] + gain;
newVal = chr.getStr() + gain;
if (newVal > ServerConstants.MAX_AP) {
statGain[0] += gain - (newVal - ServerConstants.MAX_AP);
chr.setStr(ServerConstants.MAX_AP - statEqpd[0]);
statGain[0] += (gain - (newVal - ServerConstants.MAX_AP));
chr.setStr(ServerConstants.MAX_AP);
} else {
statGain[0] += gain;
chr.setStr(newVal);
}
} else if (type.equals(MapleStat.INT)) {
newVal = chr.getInt() + statEqpd[3] + gain;
newVal = chr.getInt() + gain;
if (newVal > ServerConstants.MAX_AP) {
statGain[3] += gain - (newVal - ServerConstants.MAX_AP);
chr.setInt(ServerConstants.MAX_AP - statEqpd[3]);
statGain[3] += (gain - (newVal - ServerConstants.MAX_AP));
chr.setInt(ServerConstants.MAX_AP);
} else {
statGain[3] += gain;
chr.setInt(newVal);
}
} else if (type.equals(MapleStat.LUK)) {
newVal = chr.getLuk() + statEqpd[2] + gain;
newVal = chr.getLuk() + gain;
if (newVal > ServerConstants.MAX_AP) {
statGain[2] += gain - (newVal - ServerConstants.MAX_AP);
chr.setLuk(ServerConstants.MAX_AP - statEqpd[2]);
statGain[2] += (gain - (newVal - ServerConstants.MAX_AP));
chr.setLuk(ServerConstants.MAX_AP);
} else {
statGain[2] += gain;
chr.setLuk(newVal);
}
} else if (type.equals(MapleStat.DEX)) {
newVal = chr.getDex() + statEqpd[1] + gain;
newVal = chr.getDex() + gain;
if (newVal > ServerConstants.MAX_AP) {
statGain[1] += gain - (newVal - ServerConstants.MAX_AP);
chr.setDex(ServerConstants.MAX_AP - statEqpd[1]);
statGain[1] += (gain - (newVal - ServerConstants.MAX_AP));
chr.setDex(ServerConstants.MAX_AP);
} else {
statGain[1] += gain;
chr.setDex(newVal);

View File

@@ -167,7 +167,7 @@ class PairedQuicksort {
public PairedQuicksort(ArrayList<Item> A, int primarySort, int secondarySort) {
intersect = new ArrayList<>();
MapleQuicksort(0, A.size() - 1, A, primarySort);
if(A.size() > 0) MapleQuicksort(0, A.size() - 1, A, primarySort);
intersect.add(0);
for(int ind = 1; ind < A.size(); ind++) {
@@ -178,7 +178,7 @@ class PairedQuicksort {
intersect.add(A.size());
for(int ind = 0; ind < intersect.size() - 1; ind++) {
MapleQuicksort(intersect.get(ind), intersect.get(ind + 1) - 1, A, secondarySort);
if(intersect.get(ind + 1) > intersect.get(ind)) MapleQuicksort(intersect.get(ind), intersect.get(ind + 1) - 1, A, secondarySort);
}
}
}

View File

@@ -56,7 +56,7 @@ public final class MobDamageMobFriendlyHandler extends AbstractMaplePacketHandle
monster.getMap().broadcastMessage(MaplePacketCreator.serverNotice(6, "The Moon Bunny went home because he was sick."));
}
else if(monster.getId() == 9300093) { //tylus
monster.getMap().broadcastMessage(MaplePacketCreator.serverNotice(6, "Tylus has fallen by the overwhelming forces of this ambush."));
monster.getMap().broadcastMessage(MaplePacketCreator.serverNotice(6, "Tylus has fallen by the overwhelming forces of the ambush."));
}
else if(monster.getId() == 9300137) { //juliet
monster.getMap().broadcastMessage(MaplePacketCreator.serverNotice(6, "Juliet has fainted on the middle of the combat."));

View File

@@ -79,12 +79,12 @@ public final class RangedAttackHandler extends AbstractDealDamageHandler {
if (attack.skill == Buccaneer.ENERGY_ORB || attack.skill == ThunderBreaker.SPARK || attack.skill == Shadower.TAUNT || attack.skill == NightLord.TAUNT) {
player.getMap().broadcastMessage(player, MaplePacketCreator.rangedAttack(player, attack.skill, attack.skilllevel, attack.stance, attack.numAttackedAndDamage, 0, attack.allDamage, attack.speed, attack.direction, attack.display), false);
applyAttack(attack, player, 1);
} else if (attack.skill == Aran.COMBO_SMASH || attack.skill == Aran.COMBO_PENRIL || attack.skill == Aran.COMBO_TEMPEST) {
} else if (attack.skill == Aran.COMBO_SMASH || attack.skill == Aran.COMBO_FENRIR || attack.skill == Aran.COMBO_TEMPEST) {
player.getMap().broadcastMessage(player, MaplePacketCreator.rangedAttack(player, attack.skill, attack.skilllevel, attack.stance, attack.numAttackedAndDamage, 0, attack.allDamage, attack.speed, attack.direction, attack.display), false);
if (attack.skill == Aran.COMBO_SMASH && player.getCombo() >= 30) {
player.setCombo((short) 0);
applyAttack(attack, player, 1);
} else if (attack.skill == Aran.COMBO_PENRIL && player.getCombo() >= 100) {
} else if (attack.skill == Aran.COMBO_FENRIR && player.getCombo() >= 100) {
player.setCombo((short) 0);
applyAttack(attack, player, 2);
} else if (attack.skill == Aran.COMBO_TEMPEST && player.getCombo() >= 200) {

View File

@@ -45,7 +45,6 @@ import constants.skills.DarkKnight;
import constants.skills.Hero;
import constants.skills.Paladin;
import constants.skills.Priest;
import constants.skills.Hermit;
import constants.skills.SuperGM;

View File

@@ -1084,6 +1084,17 @@ public class EventInstanceManager {
}
}
public final void linkPortalToScript(int thisStage, String portalName, String scriptName, int thisMapId) {
giveEventPlayersStageReward(thisStage);
thisStage--; //stages counts from ONE, scripts from ZERO
MapleMap nextStage = getMapInstance(thisMapId);
MaplePortal portal = nextStage.getPortal(portalName);
if (portal != null) {
portal.setScriptName(scriptName);
}
}
// registers a player status in an event
public final void gridInsert(MapleCharacter chr, int newStatus) {
wL.lock();

View File

@@ -560,13 +560,15 @@ public class MapleItemInformationProvider {
}
public Item scrollEquipWithId(Item equip, int scrollId, boolean usingWhiteScroll, int vegaItemId, boolean isGM) {
boolean assertGM = (isGM && ServerConstants.USE_PERFECT_GM_SCROLL);
if (equip instanceof Equip) {
Equip nEquip = (Equip) equip;
Map<String, Integer> stats = this.getEquipStats(scrollId);
Map<String, Integer> eqstats = this.getEquipStats(equip.getItemId());
if (((nEquip.getUpgradeSlots() > 0 || ItemConstants.isCleanSlate(scrollId))) || isGM) {
if (((nEquip.getUpgradeSlots() > 0 || ItemConstants.isCleanSlate(scrollId))) || assertGM) {
double prop = (double)stats.get("success");
if (vegaItemId == 5610000) {
prop = 30.0;
@@ -574,7 +576,7 @@ public class MapleItemInformationProvider {
prop = 90.0;
}
if(isGM || rollSuccessChance(prop)) {
if(assertGM || rollSuccessChance(prop)) {
short flag = nEquip.getFlag();
switch (scrollId) {
case 2040727:
@@ -900,7 +902,7 @@ public class MapleItemInformationProvider {
break;
}
if (!ItemConstants.isCleanSlate(scrollId)) {
if (ServerConstants.USE_PERFECT_SCROLLING == true && !isGM && !usingWhiteScroll) {
if (ServerConstants.USE_PERFECT_SCROLLING == true && !assertGM && !usingWhiteScroll) {
nEquip.setUpgradeSlots((byte) (nEquip.getUpgradeSlots() - 1));
}
nEquip.setLevel((byte) (nEquip.getLevel() + 1));
@@ -908,13 +910,13 @@ public class MapleItemInformationProvider {
}
if (ServerConstants.USE_PERFECT_SCROLLING == false && !ItemConstants.isCleanSlate(scrollId)) {
if (!isGM && !usingWhiteScroll) {
if (!assertGM && !usingWhiteScroll) {
nEquip.setUpgradeSlots((byte) (nEquip.getUpgradeSlots() - 1));
}
//nEquip.setLevel((byte) (nEquip.getLevel() + 1));
}
} else {
if (!usingWhiteScroll && !ItemConstants.isCleanSlate(scrollId) && !isGM) {
if (!usingWhiteScroll && !ItemConstants.isCleanSlate(scrollId) && !assertGM) {
nEquip.setUpgradeSlots((byte) (nEquip.getUpgradeSlots() - 1));
}
if (Randomizer.nextInt(101) < stats.get("cursed")) {

View File

@@ -1386,7 +1386,7 @@ public class MapleMap {
final ScheduledFuture<?> monsterItemDrop = TimerManager.getInstance().register(new Runnable() {
@Override
public void run() {
if (MapleMap.this.getMonsterById(m.getId()) != null && !MapleMap.this.getPlayers().isEmpty()) {
if (m.isAlive() && !MapleMap.this.getPlayers().isEmpty()) {
if (item.getItemId() == 4001101) {
MapleMap.this.riceCakes++;
MapleMap.this.broadcastMessage(MaplePacketCreator.serverNotice(6, "The Moon Bunny made rice cake number " + (MapleMap.this.riceCakes)));
@@ -1395,7 +1395,7 @@ public class MapleMap {
}
}
}, delay, delay);
if (getMonsterById(m.getId()) == null) {
if (!m.isAlive()) {
monsterItemDrop.cancel(true);
}
}