Vegas's spell + pet/mounts schedule revamp + CafePQ

Added Vega's Spell feature. Refactored mounts and pets schedules (now
one thread runs globally updating stats). Fixed Pet Ignore now saving to
DB. Fixed Flash Jump animation not appearing for other players just
after changing jobs. Fixed 3rd job, now as a proper event with timeout.
Introducing Brand-new PQ: CafePQ.
This commit is contained in:
ronancpl
2017-09-08 14:36:58 -03:00
parent 74b4ca4132
commit e064d5cbfa
210 changed files with 35387 additions and 46797 deletions

View File

@@ -537,7 +537,7 @@ public class MapleInventoryManipulator {
c.getPlayer().setChalkboard(null);
}
}
if ((!ItemConstants.isRechargable(itemId) && c.getPlayer().getItemQuantity(itemId, true) < quantity) || quantity < 0 || source == null) {
if (source == null || (!ItemConstants.isRechargable(itemId) && source.getQuantity() < quantity) || quantity < 0) {
return;
}
Point dropPos = new Point(c.getPlayer().getPosition());

View File

@@ -559,7 +559,7 @@ public class MapleItemInformationProvider {
return (short)Math.min(Short.MAX_VALUE, value);
}
public Item scrollEquipWithId(Item equip, int scrollId, boolean usingWhiteScroll, boolean isGM) {
public Item scrollEquipWithId(Item equip, int scrollId, boolean usingWhiteScroll, int vegaItemId, boolean isGM) {
if (equip instanceof Equip) {
Equip nEquip = (Equip) equip;
@@ -567,7 +567,14 @@ public class MapleItemInformationProvider {
Map<String, Integer> eqstats = this.getEquipStats(equip.getItemId());
if (((nEquip.getUpgradeSlots() > 0 || ItemConstants.isCleanSlate(scrollId))) || isGM) {
if(isGM || rollSuccessChance((double)stats.get("success"))) {
double prop = (double)stats.get("success");
if (vegaItemId == 5610000) {
prop = 30.0;
} else if (vegaItemId == 5610001) {
prop = 90.0;
}
if(isGM || rollSuccessChance(prop)) {
short flag = nEquip.getFlag();
switch (scrollId) {
case 2040727:

View File

@@ -752,7 +752,7 @@ public class MapleStatEffect {
}
if (isDispel() && makeChanceResult()) {
applyto.dispelDebuffs();
} else if (isHeroWill()) {
} else if (isCureAllAbnormalStatus()) {
applyto.dispelDebuff(MapleDisease.SEDUCE);
applyto.dispelDebuff(MapleDisease.ZOMBIFY);
applyto.dispelDebuffs();
@@ -1042,9 +1042,7 @@ public class MapleStatEffect {
applyto.mount(ridingLevel, sourceid);
}
if(!(ServerConstants.PETS_NEVER_HUNGRY || applyto.isGM() && ServerConstants.GM_PETS_NEVER_HUNGRY)) {
applyto.getMount().startSchedule();
}
applyto.getClient().getWorldServer().registerMountHunger(applyto);
}
if (sourceid == Corsair.BATTLE_SHIP) {
givemount = new MapleMount(applyto, 1932000, sourceid);
@@ -1399,7 +1397,7 @@ public class MapleStatEffect {
return skill && (sourceid == Priest.DISPEL || sourceid == SuperGM.HEAL_PLUS_DISPEL);
}
private boolean isHeroWill() {
private boolean isCureAllAbnormalStatus() {
if (skill) {
switch (sourceid) {
case Hero.HEROS_WILL:
@@ -1418,7 +1416,8 @@ public class MapleStatEffect {
default:
return false;
}
}
} else if (sourceid == 2022544) return true;
return false;
}

View File

@@ -150,7 +150,7 @@ public class MapleMonster extends AbstractLoadedMapleLife {
return stats.getExp();
}
int getLevel() {
public int getLevel() {
return stats.getLevel();
}

View File

@@ -99,6 +99,7 @@ public class MapleMap {
private LinkedList<WeakReference<MapleMapObject>> registeredDrops = new LinkedList<>();
private List<Rectangle> areas = new ArrayList<>();
private MapleFootholdTree footholds = null;
private Rectangle mapArea = new Rectangle();
private int mapid;
private AtomicInteger runningOid = new AtomicInteger(100);
private int returnMapId;
@@ -433,7 +434,15 @@ public class MapleMap {
Point ret = calcPointBelow(new Point(initial.x, initial.y - 85));
if (ret == null) {
return fallback;
} else if(!mapArea.contains(ret)) {
if(initial.y > mapArea.y + mapArea.height) return fallback; // found drop pos underneath the map :O
int borderX = (initial.x < mapArea.x) ? mapArea.x : mapArea.x + mapArea.width;
ret = calcPointBelow(new Point(borderX, initial.y - 85));
if(ret == null) return fallback;
}
return ret;
}
@@ -1886,7 +1895,7 @@ public class MapleMap {
}, 30 * 60 * 1000);
}
MaplePet[] pets = chr.getPets();
for (int i = 0; i < chr.getPets().length; i++) {
for (int i = 0; i < pets.length; i++) {
if (pets[i] != null) {
pets[i].setPos(getGroundBelow(chr.getPosition()));
chr.announce(MaplePacketCreator.showPet(chr, pets[i], false, false));
@@ -2314,7 +2323,15 @@ public class MapleMap {
public MapleFootholdTree getFootholds() {
return footholds;
}
public void setMapPointBoundings(int px, int py, int h, int w) {
mapArea.setBounds(px, py, w, h);
}
public void setMapLineBoundings(int vrTop, int vrBottom, int vrLeft, int vrRight) {
mapArea.setBounds(vrLeft, vrTop, vrRight - vrLeft, vrBottom - vrTop);
}
/**
* it's threadsafe, gtfo :D
*
@@ -2667,6 +2684,26 @@ public class MapleMap {
}
}
public void instanceMapForceRespawn() {
if(!allowSummons) return;
final int numShouldSpawn = (short) ((monsterSpawn.size() - spawnedMonstersOnMap.get()));//Fking lol'd
if (numShouldSpawn > 0) {
List<SpawnPoint> randomSpawn = new ArrayList<>(monsterSpawn);
Collections.shuffle(randomSpawn);
int spawned = 0;
for (SpawnPoint spawnPoint : randomSpawn) {
if(spawnPoint.shouldForceSpawn()) {
spawnMonster(spawnPoint.getMonster());
spawned++;
if (spawned >= numShouldSpawn) {
break;
}
}
}
}
}
public void restoreMapSpawnPoints() {
for (SpawnPoint spawnPoint : monsterSpawn) {
spawnPoint.setDenySpawn(false);

View File

@@ -127,6 +127,27 @@ public class MapleMapFactory {
MapleDataTool.getString(timeMob.getChildByPath("message")));
}
int bounds[] = new int[4];
bounds[0] = MapleDataTool.getInt(infoData.getChildByPath("VRTop"));
bounds[1] = MapleDataTool.getInt(infoData.getChildByPath("VRBottom"));
if(bounds[0] == bounds[1]) { // old-style baked map
MapleData minimapData = mapData.getChildByPath("miniMap");
if(minimapData != null) {
bounds[0] = MapleDataTool.getInt(minimapData.getChildByPath("centerX")) * -1;
bounds[1] = MapleDataTool.getInt(minimapData.getChildByPath("centerY")) * -1;
bounds[2] = MapleDataTool.getInt(minimapData.getChildByPath("height"));
bounds[3] = MapleDataTool.getInt(minimapData.getChildByPath("width"));
map.setMapPointBoundings(bounds[0], bounds[1], bounds[2], bounds[3]);
}
} else {
bounds[2] = MapleDataTool.getInt(infoData.getChildByPath("VRLeft"));
bounds[3] = MapleDataTool.getInt(infoData.getChildByPath("VRRight"));
map.setMapLineBoundings(bounds[0], bounds[1], bounds[2], bounds[3]);
}
List<MapleFoothold> allFootholds = new LinkedList<>();
Point lBound = new Point();
Point uBound = new Point();

View File

@@ -58,8 +58,8 @@ public class MinTamenessRequirement extends MapleQuestRequirement {
for(MaplePet pet : chr.getPets()) {
if(pet == null) continue;
if(pet.getCloseness() > curCloseness)
curCloseness = pet.getCloseness();
if(pet.getCloseness() > curCloseness)
curCloseness = pet.getCloseness();
}
return curCloseness >= minTameness;