PlayerNPC patch + Wedding ring effects + Bypassable PIN/PIC + SP cap
Fixed an issue with delayed item pickups. Fixed ClearSlot command not removing rechargeables from inventory. Fixed Resurrection and Hyper Body animation effect not working for other players. Implemented bypassable PIN/PIC, applied on accounts after a successful authentication, remaining active while activity is detected for that account. Fixed anti-multiclient system not properly registering players logged in via all-chars-view. Fixed cases where players still could gain EXP from much higher-leveled mobs if they were on an event instance. Optimized scroll result method performance. Added a server flag for SP cap limit on the player's current job (missing amount are reobtained after changing jobs). PlayerNPCs now have overridable scripts. Fixed some mapobject issues with PlayerNPCs, potencially leading to disappearing from maps in certain circumstances. Fixed SpawnAllPnpcs command not properly spawning all PlayersNPCs. Added extra info on Abdula, now stating whether a book can be obtained from questline or not. Fixed marriage ring effects. Fixed some cases where marriage rings were being able to be sent out from the character owner. Fixed Duey allowing send untradeable items. New tool: MapleWorldmapChecker. It reads Map.wz XMLs, fetching mapids not properly referenced on the worldmap nodes.
This commit is contained in:
@@ -159,6 +159,8 @@ import server.life.MobSkillFactory;
|
||||
import server.maps.MapleMapItem;
|
||||
import net.server.audit.locks.MonitoredLockType;
|
||||
import net.server.audit.locks.factory.MonitoredReentrantLockFactory;
|
||||
import server.movement.AbsoluteLifeMovement;
|
||||
import server.movement.LifeMovementFragment;
|
||||
|
||||
public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
private static final MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();
|
||||
@@ -804,10 +806,14 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
blockCashShop = !blockCashShop;
|
||||
}
|
||||
|
||||
public void setClient(MapleClient c) {
|
||||
this.client = c;
|
||||
}
|
||||
|
||||
public void newClient(MapleClient c) {
|
||||
this.loggedIn = true;
|
||||
c.setAccountName(this.client.getAccountName());//No null's for accountName
|
||||
this.client = c;
|
||||
this.setClient(c);
|
||||
this.map = c.getChannelServer().getMapFactory().getMap(getMapId());
|
||||
MaplePortal portal = map.findClosestPlayerSpawnpoint(getPosition());
|
||||
if (portal == null) {
|
||||
@@ -833,7 +839,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
announce(MaplePacketCreator.getGMEffect(0x10, (byte) 0));
|
||||
List<MapleBuffStat> dsstat = Collections.singletonList(MapleBuffStat.DARKSIGHT);
|
||||
getMap().broadcastGMMessage(this, MaplePacketCreator.cancelForeignBuff(id, dsstat), false);
|
||||
getMap().broadcastMessage(this, MaplePacketCreator.spawnPlayerMapObject(this), false);
|
||||
getMap().broadcastSpawnPlayerMapObjectMessage(this, this, false);
|
||||
|
||||
for(MapleSummon ms: this.getSummonsValues()) {
|
||||
getMap().broadcastNONGMMessage(this, MaplePacketCreator.spawnSummon(ms, false), false);
|
||||
@@ -842,9 +848,8 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
this.hidden = true;
|
||||
announce(MaplePacketCreator.getGMEffect(0x10, (byte) 1));
|
||||
if (!login) {
|
||||
getMap().broadcastMessage(this, MaplePacketCreator.removePlayerFromMap(getId()), false);
|
||||
getMap().broadcastNONGMMessage(this, MaplePacketCreator.removePlayerFromMap(getId()), false);
|
||||
}
|
||||
getMap().broadcastGMMessage(this, MaplePacketCreator.spawnPlayerMapObject(this), false);
|
||||
List<Pair<MapleBuffStat, Integer>> ldsstat = Collections.singletonList(new Pair<MapleBuffStat, Integer>(MapleBuffStat.DARKSIGHT, 0));
|
||||
getMap().broadcastGMMessage(this, MaplePacketCreator.giveForeignBuff(id, ldsstat), false);
|
||||
for (MapleMonster mon : this.getControlledMonsters()) {
|
||||
@@ -1034,8 +1039,15 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
if (newJob.getId() % 10 == 2) {
|
||||
spGain += 2;
|
||||
}
|
||||
|
||||
if (ServerConstants.USE_ENFORCE_JOB_SP_RANGE) {
|
||||
spGain = getChangedJobSp(newJob);
|
||||
}
|
||||
}
|
||||
|
||||
if (spGain > 0) {
|
||||
gainSp(spGain, GameConstants.getSkillBook(newJob.getId()), true);
|
||||
}
|
||||
gainSp(spGain, GameConstants.getSkillBook(newJob.getId()), true);
|
||||
|
||||
if (newJob.getId() % 10 > 1) {
|
||||
gainAp(5, true);
|
||||
@@ -1160,6 +1172,19 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
}
|
||||
}
|
||||
|
||||
public void broadcastStance(int newStance) {
|
||||
setStance(newStance);
|
||||
broadcastStance();
|
||||
}
|
||||
|
||||
public void broadcastStance() {
|
||||
AbsoluteLifeMovement alm = new AbsoluteLifeMovement(0, getPosition(), 0, getStance());
|
||||
alm.setPixelsPerSecond(new Point(0, 0));
|
||||
List<LifeMovementFragment> moveUpdate = Collections.singletonList((LifeMovementFragment) alm);
|
||||
|
||||
map.broadcastMessage(this, MaplePacketCreator.movePlayer(id, moveUpdate), false);
|
||||
}
|
||||
|
||||
public MapleMap getWarpMap(int map) {
|
||||
MapleMap target;
|
||||
EventInstanceManager eim = getEventInstance();
|
||||
@@ -1743,7 +1768,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
|
||||
if (ob instanceof MapleMapItem) {
|
||||
MapleMapItem mapitem = (MapleMapItem) ob;
|
||||
if(Server.getInstance().getCurrentTime() - mapitem.getDropTime() < 900 || !mapitem.canBePickedBy(this)) {
|
||||
if (System.currentTimeMillis() - mapitem.getDropTime() < 900 || !mapitem.canBePickedBy(this)) {
|
||||
client.announce(MaplePacketCreator.enableActions());
|
||||
return;
|
||||
}
|
||||
@@ -2585,7 +2610,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
}
|
||||
|
||||
public void equipChanged() {
|
||||
getMap().broadcastMessage(this, MaplePacketCreator.updateCharLook(this), false);
|
||||
getMap().broadcastUpdateCharLookMessage(this, this);
|
||||
equipchanged = true;
|
||||
updateLocalStats();
|
||||
if (getMessenger() != null) {
|
||||
@@ -3939,8 +3964,14 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
extraRecInterval = effect.getMpRRate();
|
||||
}
|
||||
|
||||
stopExtraTask();
|
||||
startExtraTask(extraHpRec, extraMpRec, extraRecInterval); // HP & MP sharing the same task holder
|
||||
chrLock.lock();
|
||||
try {
|
||||
stopExtraTask();
|
||||
startExtraTask(extraHpRec, extraMpRec, extraRecInterval); // HP & MP sharing the same task holder
|
||||
} finally {
|
||||
chrLock.unlock();
|
||||
}
|
||||
|
||||
} else if (effect.isMapChair()) {
|
||||
startChairTask();
|
||||
}
|
||||
@@ -4504,6 +4535,18 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
return (inventory[MapleInventoryType.EQUIPPED.ordinal()].findById(itemid) != null);
|
||||
}
|
||||
|
||||
public boolean haveWeddingRing() {
|
||||
int rings[] = {1112806, 1112803, 1112807, 1112809};
|
||||
|
||||
for (int ringid : rings) {
|
||||
if (haveItemWithId(ringid, true)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public int getItemQuantity(int itemid, boolean checkEquipped) {
|
||||
int possesed = inventory[ItemConstants.getInventoryType(itemid).ordinal()].countById(itemid);
|
||||
if (checkEquipped) {
|
||||
@@ -5572,7 +5615,85 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
hpDecreaseTask.cancel(false);
|
||||
}
|
||||
}
|
||||
|
||||
private int getChangedJobSp(MapleJob newJob) {
|
||||
int curSp = getUsedSp(newJob) + getJobRemainingSp(newJob);
|
||||
int spGain = 0;
|
||||
int expectedSp = getJobLevelSp(level - 10, newJob, GameConstants.getJobBranch(newJob));
|
||||
if (curSp < expectedSp) {
|
||||
spGain += (expectedSp - curSp);
|
||||
}
|
||||
|
||||
return getSpGain(spGain, curSp, job);
|
||||
}
|
||||
|
||||
private int getUsedSp(MapleJob job) {
|
||||
int jobId = job.getId();
|
||||
int spUsed = 0;
|
||||
|
||||
for (Entry<Skill, SkillEntry> s : this.getSkills().entrySet()) {
|
||||
Skill skill = s.getKey();
|
||||
if (GameConstants.isInJobTree(skill.getId(), jobId) && !skill.isBeginnerSkill()) {
|
||||
spUsed += s.getValue().skillevel;
|
||||
}
|
||||
}
|
||||
|
||||
return spUsed;
|
||||
}
|
||||
|
||||
private int getJobLevelSp(int level, MapleJob job, int jobBranch) {
|
||||
if (getJobStyleInternal(job.getId(), (byte) 0x40) == MapleJob.MAGICIAN) {
|
||||
level += 2; // starts earlier, level 8
|
||||
}
|
||||
|
||||
return 3 * level + GameConstants.getChangeJobSpUpgrade(jobBranch);
|
||||
}
|
||||
|
||||
private int getJobMaxSp(MapleJob job) {
|
||||
int jobBranch = GameConstants.getJobBranch(job);
|
||||
int jobRange = GameConstants.getJobUpgradeLevelRange(jobBranch);
|
||||
return getJobLevelSp(jobRange, job, jobBranch);
|
||||
}
|
||||
|
||||
private int getJobRemainingSp(MapleJob job) {
|
||||
int skillBook = GameConstants.getSkillBook(job.getId());
|
||||
|
||||
int ret = 0;
|
||||
for (int i = 0; i <= skillBook; i++) {
|
||||
ret += this.getRemainingSp(i);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
private int getSpGain(int spGain, MapleJob job) {
|
||||
int curSp = getUsedSp(job) + getJobRemainingSp(job);
|
||||
return getSpGain(spGain, curSp, job);
|
||||
}
|
||||
|
||||
private int getSpGain(int spGain, int curSp, MapleJob job) {
|
||||
int maxSp = getJobMaxSp(job);
|
||||
|
||||
spGain = Math.min(spGain, maxSp - curSp);
|
||||
int jobBranch = GameConstants.getJobBranch(job);
|
||||
return spGain;
|
||||
}
|
||||
|
||||
private void levelUpGainSp() {
|
||||
if (GameConstants.getJobBranch(job) == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
int spGain = 3;
|
||||
if (ServerConstants.USE_ENFORCE_JOB_SP_RANGE && !GameConstants.hasSPTable(job)) {
|
||||
spGain = getSpGain(spGain, job);
|
||||
}
|
||||
|
||||
if (spGain > 0) {
|
||||
gainSp(spGain, GameConstants.getSkillBook(job.getId()), true);
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void levelUp(boolean takeexp) {
|
||||
Skill improvingMaxHP = null;
|
||||
Skill improvingMaxMP = null;
|
||||
@@ -5693,9 +5814,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
level = maxClassLevel; //To prevent levels past the maximum
|
||||
}
|
||||
|
||||
if (job.getId() % 1000 > 0) {
|
||||
gainSp(3, GameConstants.getSkillBook(job.getId()), true);
|
||||
}
|
||||
levelUpGainSp();
|
||||
|
||||
effLock.lock();
|
||||
statWlock.lock();
|
||||
@@ -8835,7 +8954,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
@Override
|
||||
public void sendSpawnData(MapleClient client) {
|
||||
if (!this.isHidden() || client.getPlayer().gmLevel() > 1) {
|
||||
client.announce(MaplePacketCreator.spawnPlayerMapObject(this));
|
||||
client.announce(MaplePacketCreator.spawnPlayerMapObject(client, this, false));
|
||||
|
||||
if(hasBuffFromSourceid(getJobMapChair(job))) {
|
||||
client.announce(MaplePacketCreator.giveForeignChairSkillEffect(id));
|
||||
|
||||
@@ -79,6 +79,7 @@ import server.quest.MapleQuest;
|
||||
|
||||
import net.server.audit.locks.MonitoredLockType;
|
||||
import net.server.audit.locks.factory.MonitoredReentrantLockFactory;
|
||||
import net.server.coordinator.MapleLoginBypassCoordinator;
|
||||
|
||||
public class MapleClient {
|
||||
|
||||
@@ -473,6 +474,7 @@ public class MapleClient {
|
||||
}
|
||||
if (pin.equals(other)) {
|
||||
pinattempt = 0;
|
||||
MapleLoginBypassCoordinator.getInstance().registerLoginBypassEntry(getNibbleHWID(), accId, false);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -499,7 +501,7 @@ public class MapleClient {
|
||||
}
|
||||
|
||||
public boolean checkPic(String other) {
|
||||
if(!ServerConstants.ENABLE_PIC) return true;
|
||||
if(!(ServerConstants.ENABLE_PIC && !canBypassPic())) return true;
|
||||
|
||||
picattempt++;
|
||||
if (picattempt > 5) {
|
||||
@@ -507,6 +509,7 @@ public class MapleClient {
|
||||
}
|
||||
if (pic.equals(other)) {
|
||||
picattempt = 0;
|
||||
MapleLoginBypassCoordinator.getInstance().registerLoginBypassEntry(getNibbleHWID(), accId, true);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -743,7 +746,7 @@ public class MapleClient {
|
||||
public int getAccID() {
|
||||
return accId;
|
||||
}
|
||||
|
||||
|
||||
public void updateLoginState(int newstate) {
|
||||
try {
|
||||
Connection con = DatabaseConnection.getConnection();
|
||||
@@ -1051,6 +1054,10 @@ public class MapleClient {
|
||||
public String getHWID() {
|
||||
return hwid;
|
||||
}
|
||||
|
||||
public void setHWID(String hwid) {
|
||||
this.hwid = hwid;
|
||||
}
|
||||
|
||||
public Set<String> getMacs() {
|
||||
return Collections.unmodifiableSet(macs);
|
||||
@@ -1232,8 +1239,8 @@ public class MapleClient {
|
||||
public void setCharacterSlots(byte slots) {
|
||||
characterSlots = slots;
|
||||
}
|
||||
|
||||
public synchronized boolean gainCharacterSlot() {
|
||||
|
||||
public synchronized boolean gainCharacterSlot() {
|
||||
if (characterSlots < 15) {
|
||||
Connection con = null;
|
||||
try {
|
||||
@@ -1462,4 +1469,16 @@ public class MapleClient {
|
||||
public void enableCSActions() {
|
||||
announce(MaplePacketCreator.enableCSUse(player));
|
||||
}
|
||||
|
||||
public String getNibbleHWID() {
|
||||
return (String) session.getAttribute(MapleClient.CLIENT_NIBBLEHWID);
|
||||
}
|
||||
|
||||
public boolean canBypassPin() {
|
||||
return MapleLoginBypassCoordinator.getInstance().canLoginBypass(getNibbleHWID(), accId, false);
|
||||
}
|
||||
|
||||
public boolean canBypassPic() {
|
||||
return MapleLoginBypassCoordinator.getInstance().canLoginBypass(getNibbleHWID(), accId, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -180,6 +180,7 @@ public class CommandsExecutor {
|
||||
addCommand("dex", StatDexCommand.class);
|
||||
addCommand("int", StatIntCommand.class);
|
||||
addCommand("luk", StatLukCommand.class);
|
||||
addCommand("enableauth", EnableAuthCommand.class);
|
||||
|
||||
commandsNameDesc.add(levelCommandsCursor);
|
||||
}
|
||||
|
||||
@@ -28,6 +28,10 @@ import client.command.Command;
|
||||
import client.processor.BuybackProcessor;
|
||||
|
||||
public class BuyBackCommand extends Command {
|
||||
{
|
||||
setDescription("");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(MapleClient c, String[] params) {
|
||||
if (params.length < 1) {
|
||||
|
||||
45
src/client/command/commands/gm0/EnableAuthCommand.java
Normal file
45
src/client/command/commands/gm0/EnableAuthCommand.java
Normal file
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
This file is part of the HeavenMS MapleStory Server, commands OdinMS-based
|
||||
Copyleft (L) 2016 - 2018 RonanLana
|
||||
|
||||
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 other version of the GNU Affero General Public
|
||||
License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without 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/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
@Author: Arthur L - Refactored command content into modules
|
||||
*/
|
||||
package client.command.commands.gm0;
|
||||
|
||||
import client.command.Command;
|
||||
import client.MapleClient;
|
||||
import net.server.coordinator.MapleLoginBypassCoordinator;
|
||||
|
||||
public class EnableAuthCommand extends Command {
|
||||
{
|
||||
setDescription("");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(MapleClient c, String[] params) {
|
||||
if (c.tryacquireClient()) {
|
||||
try {
|
||||
MapleLoginBypassCoordinator.getInstance().unregisterLoginBypassEntry(c.getNibbleHWID(), c.getAccID());
|
||||
} finally {
|
||||
c.releaseClient();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -49,31 +49,31 @@ public class ClearSlotCommand extends Command {
|
||||
Item tempItem = c.getPlayer().getInventory(MapleInventoryType.EQUIP).getItem((byte) i);
|
||||
if (tempItem == null)
|
||||
continue;
|
||||
MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.EQUIP, (byte) i, tempItem.getQuantity(), false, true);
|
||||
MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.EQUIP, (byte) i, tempItem.getQuantity(), false, false);
|
||||
}
|
||||
for (int i = 0; i < 101; i++) {
|
||||
Item tempItem = c.getPlayer().getInventory(MapleInventoryType.USE).getItem((byte) i);
|
||||
if (tempItem == null)
|
||||
continue;
|
||||
MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.USE, (byte) i, tempItem.getQuantity(), false, true);
|
||||
MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.USE, (byte) i, tempItem.getQuantity(), false, false);
|
||||
}
|
||||
for (int i = 0; i < 101; i++) {
|
||||
Item tempItem = c.getPlayer().getInventory(MapleInventoryType.ETC).getItem((byte) i);
|
||||
if (tempItem == null)
|
||||
continue;
|
||||
MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.ETC, (byte) i, tempItem.getQuantity(), false, true);
|
||||
MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.ETC, (byte) i, tempItem.getQuantity(), false, false);
|
||||
}
|
||||
for (int i = 0; i < 101; i++) {
|
||||
Item tempItem = c.getPlayer().getInventory(MapleInventoryType.SETUP).getItem((byte) i);
|
||||
if (tempItem == null)
|
||||
continue;
|
||||
MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.SETUP, (byte) i, tempItem.getQuantity(), false, true);
|
||||
MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.SETUP, (byte) i, tempItem.getQuantity(), false, false);
|
||||
}
|
||||
for (int i = 0; i < 101; i++) {
|
||||
Item tempItem = c.getPlayer().getInventory(MapleInventoryType.CASH).getItem((byte) i);
|
||||
if (tempItem == null)
|
||||
continue;
|
||||
MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.CASH, (byte) i, tempItem.getQuantity(), false, true);
|
||||
MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.CASH, (byte) i, tempItem.getQuantity(), false, false);
|
||||
}
|
||||
player.yellowMessage("All Slots Cleared.");
|
||||
break;
|
||||
@@ -82,7 +82,7 @@ public class ClearSlotCommand extends Command {
|
||||
Item tempItem = c.getPlayer().getInventory(MapleInventoryType.EQUIP).getItem((byte) i);
|
||||
if (tempItem == null)
|
||||
continue;
|
||||
MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.EQUIP, (byte) i, tempItem.getQuantity(), false, true);
|
||||
MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.EQUIP, (byte) i, tempItem.getQuantity(), false, false);
|
||||
}
|
||||
player.yellowMessage("Equipment Slot Cleared.");
|
||||
break;
|
||||
@@ -91,7 +91,7 @@ public class ClearSlotCommand extends Command {
|
||||
Item tempItem = c.getPlayer().getInventory(MapleInventoryType.USE).getItem((byte) i);
|
||||
if (tempItem == null)
|
||||
continue;
|
||||
MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.USE, (byte) i, tempItem.getQuantity(), false, true);
|
||||
MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.USE, (byte) i, tempItem.getQuantity(), false, false);
|
||||
}
|
||||
player.yellowMessage("Use Slot Cleared.");
|
||||
break;
|
||||
@@ -100,7 +100,7 @@ public class ClearSlotCommand extends Command {
|
||||
Item tempItem = c.getPlayer().getInventory(MapleInventoryType.SETUP).getItem((byte) i);
|
||||
if (tempItem == null)
|
||||
continue;
|
||||
MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.SETUP, (byte) i, tempItem.getQuantity(), false, true);
|
||||
MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.SETUP, (byte) i, tempItem.getQuantity(), false, false);
|
||||
}
|
||||
player.yellowMessage("Set-Up Slot Cleared.");
|
||||
break;
|
||||
@@ -109,7 +109,7 @@ public class ClearSlotCommand extends Command {
|
||||
Item tempItem = c.getPlayer().getInventory(MapleInventoryType.ETC).getItem((byte) i);
|
||||
if (tempItem == null)
|
||||
continue;
|
||||
MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.ETC, (byte) i, tempItem.getQuantity(), false, true);
|
||||
MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.ETC, (byte) i, tempItem.getQuantity(), false, false);
|
||||
}
|
||||
player.yellowMessage("ETC Slot Cleared.");
|
||||
break;
|
||||
@@ -118,7 +118,7 @@ public class ClearSlotCommand extends Command {
|
||||
Item tempItem = c.getPlayer().getInventory(MapleInventoryType.CASH).getItem((byte) i);
|
||||
if (tempItem == null)
|
||||
continue;
|
||||
MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.CASH, (byte) i, tempItem.getQuantity(), false, true);
|
||||
MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.CASH, (byte) i, tempItem.getQuantity(), false, false);
|
||||
}
|
||||
player.yellowMessage("Cash Slot Cleared.");
|
||||
break;
|
||||
|
||||
@@ -56,5 +56,6 @@ public class MaxSkillCommand extends Command {
|
||||
player.changeSkillLevel(skill, (byte) -1, -1, -1);
|
||||
}
|
||||
|
||||
player.yellowMessage("Skills maxed out.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,10 +31,12 @@ import provider.MapleDataProvider;
|
||||
import provider.MapleDataProviderFactory;
|
||||
import provider.MapleDataTool;
|
||||
import server.MapleItemInformationProvider;
|
||||
import server.quest.MapleQuest;
|
||||
import tools.MaplePacketCreator;
|
||||
import tools.Pair;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
public class SearchCommand extends Command {
|
||||
private static MapleData npcStringData;
|
||||
@@ -65,7 +67,7 @@ public class SearchCommand extends Command {
|
||||
long start = System.currentTimeMillis();//for the lulz
|
||||
MapleData data = null;
|
||||
if (!params[0].equalsIgnoreCase("ITEM")) {
|
||||
boolean mapSearch = false;
|
||||
int searchType = 0;
|
||||
|
||||
if (params[0].equalsIgnoreCase("NPC")) {
|
||||
data = npcStringData;
|
||||
@@ -75,21 +77,24 @@ public class SearchCommand extends Command {
|
||||
data = skillStringData;
|
||||
} else if (params[0].equalsIgnoreCase("MAP")) {
|
||||
data = mapStringData;
|
||||
mapSearch = true;
|
||||
searchType = 1;
|
||||
} else if (params[0].equalsIgnoreCase("QUEST")) {
|
||||
data = mapStringData;
|
||||
searchType = 2;
|
||||
} else {
|
||||
sb.append("#bInvalid search.\r\nSyntax: '!search [type] [name]', where [type] is MAP, NPC, ITEM, MOB, or SKILL.");
|
||||
sb.append("#bInvalid search.\r\nSyntax: '!search [type] [name]', where [type] is MAP, QUEST, NPC, ITEM, MOB, or SKILL.");
|
||||
}
|
||||
if (data != null) {
|
||||
String name;
|
||||
|
||||
if (!mapSearch) {
|
||||
if (searchType == 0) {
|
||||
for (MapleData searchData : data.getChildren()) {
|
||||
name = MapleDataTool.getString(searchData.getChildByPath("name"), "NO-NAME");
|
||||
if (name.toLowerCase().contains(search.toLowerCase())) {
|
||||
sb.append("#b").append(Integer.parseInt(searchData.getName())).append("#k - #r").append(name).append("\r\n");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
} else if (searchType == 1) {
|
||||
String mapName, streetName;
|
||||
|
||||
for (MapleData searchDataDir : data.getChildren()) {
|
||||
@@ -102,6 +107,16 @@ public class SearchCommand extends Command {
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (MapleQuest mq : MapleQuest.getMatchedQuests(search)) {
|
||||
sb.append("#b").append(mq.getId()).append("#k - #r");
|
||||
|
||||
String parentName = mq.getParentName();
|
||||
if (!parentName.isEmpty()) {
|
||||
sb.append(parentName).append(" - ");
|
||||
}
|
||||
sb.append(mq.getName()).append("\r\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -28,7 +28,9 @@ import client.MapleClient;
|
||||
import client.MapleCharacter;
|
||||
import server.life.MapleMonster;
|
||||
import server.life.MapleNPC;
|
||||
import server.life.MaplePlayerNPC;
|
||||
import server.maps.MapleMapObject;
|
||||
import java.util.HashSet;
|
||||
|
||||
public class WhereaMiCommand extends Command {
|
||||
{
|
||||
@@ -38,23 +40,54 @@ public class WhereaMiCommand extends Command {
|
||||
@Override
|
||||
public void execute(MapleClient c, String[] params) {
|
||||
MapleCharacter player = c.getPlayer();
|
||||
|
||||
HashSet<MapleCharacter> chars = new HashSet<>();
|
||||
HashSet<MapleNPC> npcs = new HashSet<>();
|
||||
HashSet<MaplePlayerNPC> playernpcs = new HashSet<>();
|
||||
HashSet<MapleMonster> mobs = new HashSet<>();
|
||||
|
||||
for (MapleMapObject mmo : player.getMap().getMapObjects()) {
|
||||
if (mmo instanceof MapleNPC) {
|
||||
MapleNPC npc = (MapleNPC) mmo;
|
||||
npcs.add(npc);
|
||||
} else if (mmo instanceof MapleCharacter) {
|
||||
MapleCharacter mc = (MapleCharacter) mmo;
|
||||
chars.add(mc);
|
||||
} else if (mmo instanceof MapleMonster) {
|
||||
MapleMonster mob = (MapleMonster) mmo;
|
||||
if (mob.isAlive()) {
|
||||
mobs.add(mob);
|
||||
}
|
||||
} else if (mmo instanceof MaplePlayerNPC) {
|
||||
MaplePlayerNPC npc = (MaplePlayerNPC) mmo;
|
||||
playernpcs.add(npc);
|
||||
}
|
||||
}
|
||||
|
||||
player.yellowMessage("Map ID: " + player.getMap().getId());
|
||||
|
||||
player.yellowMessage("Players on this map:");
|
||||
for (MapleMapObject mmo : player.getMap().getPlayers()) {
|
||||
MapleCharacter chr = (MapleCharacter) mmo;
|
||||
for (MapleCharacter chr : chars) {
|
||||
player.dropMessage(5, ">> " + chr.getName() + " - " + chr.getId() + " - Oid: " + chr.getObjectId());
|
||||
}
|
||||
player.yellowMessage("NPCs on this map:");
|
||||
for (MapleMapObject npcs : player.getMap().getMapObjects()) {
|
||||
if (npcs instanceof MapleNPC) {
|
||||
MapleNPC npc = (MapleNPC) npcs;
|
||||
|
||||
if (!playernpcs.isEmpty()) {
|
||||
player.yellowMessage("PlayerNPCs on this map:");
|
||||
for (MaplePlayerNPC pnpc : playernpcs) {
|
||||
player.dropMessage(5, ">> " + pnpc.getName() + " - Scriptid: " + pnpc.getScriptId() + " - Oid: " + pnpc.getObjectId());
|
||||
}
|
||||
}
|
||||
|
||||
if (!npcs.isEmpty()) {
|
||||
player.yellowMessage("NPCs on this map:");
|
||||
for (MapleNPC npc : npcs) {
|
||||
player.dropMessage(5, ">> " + npc.getName() + " - " + npc.getId() + " - Oid: " + npc.getObjectId());
|
||||
}
|
||||
}
|
||||
player.yellowMessage("Monsters on this map:");
|
||||
for (MapleMapObject mobs : player.getMap().getMapObjects()) {
|
||||
if (mobs instanceof MapleMonster) {
|
||||
MapleMonster mob = (MapleMonster) mobs;
|
||||
|
||||
if (!mobs.isEmpty()) {
|
||||
player.yellowMessage("Monsters on this map:");
|
||||
for (MapleMonster mob : mobs) {
|
||||
if (mob.isAlive()) {
|
||||
player.dropMessage(5, ">> " + mob.getName() + " - " + mob.getId() + " - Oid: " + mob.getObjectId());
|
||||
}
|
||||
|
||||
@@ -25,7 +25,6 @@ package client.command.commands.gm6;
|
||||
|
||||
import client.command.Command;
|
||||
import client.MapleClient;
|
||||
import client.MapleCharacter;
|
||||
import server.life.MaplePlayerNPC;
|
||||
|
||||
public class EraseAllPNpcsCommand extends Command {
|
||||
@@ -35,7 +34,6 @@ public class EraseAllPNpcsCommand extends Command {
|
||||
|
||||
@Override
|
||||
public void execute(MapleClient c, String[] params) {
|
||||
//MapleCharacter player = c.getPlayer();
|
||||
MaplePlayerNPC.removeAllPlayerNPC();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -294,7 +294,7 @@ public class Equip extends Item {
|
||||
int stat = 0;
|
||||
if(rnd >= limit) {
|
||||
rnd -= limit;
|
||||
stat = 1 + (int)Math.floor((-1 + Math.sqrt((8 * rnd) + 1)) / 2);
|
||||
stat = 1 + (int)Math.floor((-1 + Math.sqrt((8 * rnd) + 1)) / 2); // optimized randomizeStatUpgrade author: David A.
|
||||
}
|
||||
|
||||
return stat;
|
||||
|
||||
@@ -21,12 +21,7 @@ package client.processor;
|
||||
|
||||
import client.MapleClient;
|
||||
import client.MapleCharacter;
|
||||
import java.awt.Point;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import server.maps.MapleMap;
|
||||
import server.movement.AbsoluteLifeMovement;
|
||||
import server.movement.LifeMovementFragment;
|
||||
import tools.MaplePacketCreator;
|
||||
|
||||
/**
|
||||
@@ -74,16 +69,10 @@ public class BuybackProcessor {
|
||||
jobString = "beginner";
|
||||
}
|
||||
|
||||
chr.setStance(0);
|
||||
chr.healHpMp();
|
||||
chr.broadcastStance(chr.isFacingLeft() ? 5 : 4);
|
||||
|
||||
AbsoluteLifeMovement alm = new AbsoluteLifeMovement(0, chr.getPosition(), 0, 0);
|
||||
alm.setPixelsPerSecond(new Point(0, 0));
|
||||
List<LifeMovementFragment> moveUpdate = Collections.singletonList((LifeMovementFragment) alm);
|
||||
|
||||
MapleMap map = chr.getMap();
|
||||
map.broadcastMessage(chr, MaplePacketCreator.movePlayer(c.getPlayer().getId(), moveUpdate), false);
|
||||
|
||||
map.broadcastMessage(MaplePacketCreator.playSound("Buyback/" + jobString));
|
||||
map.broadcastMessage(MaplePacketCreator.earnTitleMessage(chr.getName() + " just bought back into the game!"));
|
||||
|
||||
|
||||
@@ -389,6 +389,11 @@ public class DueyProcessor {
|
||||
MapleInventoryType inv = MapleInventoryType.getByType(inventId);
|
||||
Item item = c.getPlayer().getInventory(inv).getItem(itemPos);
|
||||
if (item != null && c.getPlayer().getItemQuantity(item.getItemId(), false) >= amount) {
|
||||
if (item.isUntradeable()) {
|
||||
c.announce(MaplePacketCreator.sendDueyMSG(DueyProcessor.Actions.TOCLIENT_SEND_INCORRECT_REQUEST.getCode()));
|
||||
return;
|
||||
}
|
||||
|
||||
c.getPlayer().gainMeso(-finalcost, false);
|
||||
c.announce(MaplePacketCreator.sendDueyMSG(DueyProcessor.Actions.TOCLIENT_SEND_SUCCESSFULLY_SENT.getCode()));
|
||||
|
||||
|
||||
@@ -121,6 +121,11 @@ public class StorageProcessor {
|
||||
MapleInventoryType invType = ItemConstants.getInventoryType(itemId);
|
||||
Item item = chr.getInventory(invType).getItem(slot).copy();
|
||||
if (item != null && item.getItemId() == itemId && (item.getQuantity() >= quantity || ItemConstants.isRechargeable(itemId))) {
|
||||
if (ItemConstants.isWeddingRing(itemId) || ItemConstants.isWeddingToken(itemId)) {
|
||||
c.announce(MaplePacketCreator.enableActions());
|
||||
return;
|
||||
}
|
||||
|
||||
if (ItemConstants.isRechargeable(itemId)) {
|
||||
quantity = item.getQuantity();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user