ariantpq + correct use catch item

This commit is contained in:
Diego Armando de Freitas Matos
2019-03-20 19:51:45 -03:00
parent 0a8efa4238
commit 0d7e8daf8e
36 changed files with 2399 additions and 2444 deletions

View File

@@ -47,6 +47,7 @@ public enum MapleBuffStat {
GHOST_MORPH(0x20000L),
AURA(0x40000L),
CONFUSE(0x80000L),
ARIANT_PQ_SHIELD(0x40000L),
// ------ COUPON feature ------

View File

@@ -1,25 +1,3 @@
/*
This file is part of the OdinMS Maple Story Server
Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc>
Matthias Butz <matze@odinms.de>
Jan Christian Meyer <vimes@odinms.de>
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 otheer version of the GNU Affero General Public
License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; witout 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 client;
import java.awt.Point;
@@ -126,7 +104,6 @@ import client.newyear.NewYearCardRecord;
import constants.ExpTable;
import constants.GameConstants;
import constants.ItemConstants;
import constants.LinguaConstants;
import constants.ServerConstants;
import constants.skills.Aran;
import constants.skills.Beginner;
@@ -320,7 +297,9 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
private int banishSp = -1;
private long banishTime = 0;
private long lastExpGainTime;
public ScheduledFuture<?> pqMapleMap;
public ScheduledFuture<?> ariantScore;
private MapleCharacter() {
super.setListener(new AbstractCharacterListener() {
@Override
@@ -1944,12 +1923,14 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
this.getMonsterBook().addCard(client, mItem.getItemId());
}
} else if (MapleInventoryManipulator.addFromDrop(client, mItem, true)) {
} else if (mItem.getItemId() == 4031868) {
this.getMap().broadcastMessage(MaplePacketCreator.updateAriantPQRanking(this.getName(), this.getItemQuantity(4031868, false), false));
} else {
client.announce(MaplePacketCreator.enableActions());
return;
}
if (mItem.getItemId() == 4031868) {
updateAriantScore();
getMap().broadcastMessage(MaplePacketCreator.updateAriantPQRanking(this.getName(), this.getItemQuantity(4031868, false), false));
}
this.getMap().pickItemDrop(pickupPacket, mapitem);
} else if (!hasSpaceInventory) {
@@ -5780,6 +5761,22 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
if (hpDecreaseTask != null) {
hpDecreaseTask.cancel(false);
}
cancelPqMapleMap();
cancelAriantScore();
}
public void cancelPqMapleMap() {
if (pqMapleMap != null) {
pqMapleMap.cancel(true);
pqMapleMap = null;
}
}
public void cancelAriantScore() {
if (ariantScore != null) {
ariantScore.cancel(true);
ariantScore = null;
}
}
private int getChangedJobSp(MapleJob newJob) {
@@ -7007,12 +7004,12 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
private void playerDead() {
if (this.getMap().isCPQMap()) {
int lost = getCP();
if (lost > 6) {
lost = 6;
int losing = getMap().getDeathCP();
if (getCP() < losing) {
losing = getCP();
}
getMap().broadcastMessage(MaplePacketCreator.playerDiedMessage(getName(), lost, getTeam()));
gainCP(-lost);
getMap().broadcastMessage(MaplePacketCreator.playerDiedMessage(getName(), losing, getTeam()));
gainCP(-losing);
return;
}
cancelAllBuffs(false);
@@ -10226,4 +10223,41 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
getClient().getAbstractPlayerInteraction().gainItem(item.getItemId(), item.getQuantity());
}
}
public int getAriantScore() {
return this.countItem(4031868);
}
public void updateAriantScore() {
this.getMap().broadcastMessage(MaplePacketCreator.updateAriantPQRanking(this.getName(), getAriantScore(), false));
}
public void disease(int type, int level) {
if (MapleDisease.getBySkill(type) == null) {
return;
}
giveDebuff(MapleDisease.getBySkill(type), MobSkillFactory.getMobSkill(type, level));
}
public void shield() {
List<Pair<MapleBuffStat, Integer>> ldsstat = Collections.singletonList(new Pair<MapleBuffStat, Integer>(MapleBuffStat.ARIANT_PQ_SHIELD, 1));
getMap().broadcastMessage(this, MaplePacketCreator.giveForeignBuff(id, ldsstat), false);
}
public ScheduledFuture<?> getPqMapleMap() {
return pqMapleMap;
}
public void setPqMapleMap(ScheduledFuture<?> pqMapleMap) {
this.pqMapleMap = pqMapleMap;
}
public ScheduledFuture<?> getAriantScoreBord() {
return ariantScore;
}
public void setAriantScore(ScheduledFuture<?> ariantScore) {
this.ariantScore = ariantScore;
}
}

View File

@@ -81,6 +81,8 @@ import server.quest.MapleQuest;
import net.server.audit.locks.MonitoredLockType;
import net.server.audit.locks.factory.MonitoredReentrantLockFactory;
import net.server.coordinator.MapleLoginBypassCoordinator;
import server.expeditions.MapleExpedition;
import server.expeditions.MapleExpeditionType;
public class MapleClient {
@@ -767,7 +769,7 @@ public class MapleClient {
try {
Connection con = DatabaseConnection.getConnection();
try (PreparedStatement ps = con.prepareStatement("UPDATE accounts SET loggedin = ?, lastlogin = ? WHERE id = ?")) {
// using sql currenttime here could potentially break the login, thanks Arnah for pointing this out
// using sql currenttime here could potentially break the login, thanks Arnah for pointing this out
ps.setInt(1, newstate);
ps.setTimestamp(2, new java.sql.Timestamp(Server.getInstance().getCurrentTime()));
@@ -884,6 +886,9 @@ public class MapleClient {
if (player.getMonsterCarnival() != null) {
player.getMonsterCarnival().playerDisconnected(getPlayer().getId());
}
cancelarAriantPQ();
}
if (player.getMap() != null) {
@@ -899,6 +904,20 @@ public class MapleClient {
}
}
public void cancelarAriantPQ() {
MapleExpedition exp = null;
if (player.getMapId() == 980010101) {
exp = player.getClient().getAbstractPlayerInteraction().getExpedition(MapleExpeditionType.ARIANT);
} else if (player.getMapId() == 980010201) {
exp = player.getClient().getAbstractPlayerInteraction().getExpedition(MapleExpeditionType.ARIANT1);
} else {
exp = player.getClient().getAbstractPlayerInteraction().getExpedition(MapleExpeditionType.ARIANT2);
}
if (exp != null && (player.getMapId() == 980010101 || player.getMapId() == 980010201 || player.getMapId() == 980010301) && player.getMap().getAllPlayer().size() == 1) {
getAbstractPlayerInteraction().endExpedition(exp);
}
}
public final void disconnect(final boolean shutdown, final boolean cashshop) {
if (canDisconnect()) {
ThreadManager.getInstance().newTask(new Runnable() {
@@ -985,7 +1004,7 @@ public class MapleClient {
chrg.setCharacter(null);
}
wserv.removePlayer(player);
//getChannelServer().removePlayer(player); already being done
//getChannelServer().removePlayer(player); already being done
player.saveCooldowns();
player.cancelAllDebuffs();
@@ -1448,7 +1467,7 @@ public class MapleClient {
player.cancelDiseaseExpireTask();
player.cancelSkillCooldownTask();
player.cancelQuestExpirationTask();
//Cancelling magicdoor? Nope
//Cancelling magicdoor? Nope
//Cancelling mounts? Noty
player.getInventory(MapleInventoryType.EQUIPPED).checked(false); //test

View File

@@ -29,7 +29,7 @@ public enum MapleDisease {
SEDUCE(0x80, 128),
FISHABLE(0x100),
ZOMBIFY(0x4000),
CONFUSE(0x80000),
CONFUSE(0x80000, 132),
STUN(0x2000000000000L, 123),
POISON(0x4000000000000L, 125),
SEAL(0x8000000000000L, 120),