Merge branch 'master' of https://github.com/ronancpl/HeavenMS into credits_update

This commit is contained in:
ronancpl
2019-11-14 22:35:43 -03:00
864 changed files with 20650 additions and 11188 deletions

View File

@@ -27,6 +27,7 @@ import client.MapleClient;
public abstract class Command {
protected int rank;
protected String description;
public abstract void execute(MapleClient client, String[] params);
@@ -38,6 +39,14 @@ public abstract class Command {
protected void setDescription(String description) {
this.description = description;
}
public int getRank() {
return rank;
}
public void setRank(int rank) {
this.rank = rank;
}
protected String joinStringFrom(String arr[], int start) {
StringBuilder builder = new StringBuilder();

View File

@@ -62,7 +62,7 @@ public class CommandsExecutor {
return heading == USER_HEADING;
}
private HashMap<String, RegisteredCommand> registeredCommands = new HashMap<>();
private HashMap<String, Command> registeredCommands = new HashMap<>();
private Pair<List<String>, List<String>> levelCommandsCursor;
private List<Pair<List<String>, List<String>>> commandsNameDesc = new ArrayList<>();
@@ -94,7 +94,7 @@ public class CommandsExecutor {
private void handleInternal(MapleClient client, String message){
if (client.getPlayer().getMapId() == 300000012) {
client.getPlayer().yellowMessage("You not have permission to use this command while in jail.");
client.getPlayer().yellowMessage("You do not have permission to use commands while in jail.");
return;
}
final String splitRegex = "[ ]";
@@ -107,13 +107,13 @@ public class CommandsExecutor {
final String commandName = splitedMessage[0].toLowerCase();
final String[] lowercaseParams = splitedMessage[1].toLowerCase().split(splitRegex);
final RegisteredCommand command = registeredCommands.get(commandName);
final Command command = registeredCommands.get(commandName);
if (command == null){
client.getPlayer().yellowMessage("Command '" + commandName + "' is not available. See @commands for a list of available commands.");
return;
}
if (client.getPlayer().gmLevel() < command.getRank()){
client.getPlayer().yellowMessage("You not have permission to use this command.");
client.getPlayer().yellowMessage("You do not have permission to use this command.");
return;
}
String[] params;
@@ -122,16 +122,9 @@ public class CommandsExecutor {
} else {
params = new String[]{};
}
try {
Command commandInstance = command.getCommandClass().newInstance();
commandInstance.execute(client, params);
writeLog(client, message);
} catch (InstantiationException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
command.execute(client, params);
writeLog(client, message);
}
private void writeLog(MapleClient client, String command){
@@ -172,11 +165,19 @@ public class CommandsExecutor {
return;
}
RegisteredCommand registeredCommand = new RegisteredCommand(commandClass, rank);
String commandName = syntax.toLowerCase();
addCommandInfo(commandName, commandClass);
registeredCommands.put(commandName, registeredCommand);
try {
Command commandInstance = commandClass.newInstance(); // thanks Halcyon for noticing commands getting reinstanced every call
commandInstance.setRank(rank);
registeredCommands.put(commandName, commandInstance);
} catch (InstantiationException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
}
private void registerLv0Commands(){
@@ -253,6 +254,7 @@ public class CommandsExecutor {
addCommand("drop", 2, ItemDropCommand.class);
addCommand("level", 2, LevelCommand.class);
addCommand("levelpro", 2, LevelProCommand.class);
addCommand("setslot", 2, SetSlotCommand.class);
addCommand("setstat", 2, SetStatCommand.class);
addCommand("maxstat", 2, MaxStatCommand.class);
addCommand("maxskill", 2, MaxSkillCommand.class);
@@ -264,6 +266,7 @@ public class CommandsExecutor {
addCommand("unbug", 2, UnBugCommand.class);
addCommand("id", 2, IdCommand.class);
addCommand("gachalist", GachaListCommand.class);
addCommand("loot", LootCommand.class);
commandsNameDesc.add(levelCommandsCursor);
}

View File

@@ -25,7 +25,7 @@ package client.command.commands.gm0;
import client.MapleClient;
import client.command.Command;
import client.processor.BuybackProcessor;
import client.processor.action.BuybackProcessor;
public class BuyBackCommand extends Command {
{

View File

@@ -26,6 +26,7 @@ package client.command.commands.gm0;
import client.command.Command;
import client.MapleClient;
import scripting.npc.NPCScriptManager;
import scripting.quest.QuestScriptManager;
import tools.MaplePacketCreator;
public class DisposeCommand extends Command {
@@ -36,6 +37,7 @@ public class DisposeCommand extends Command {
@Override
public void execute(MapleClient c, String[] params) {
NPCScriptManager.getInstance().dispose(c);
QuestScriptManager.getInstance().dispose(c);
c.announce(MaplePacketCreator.enableActions());
c.removeClickedNPC();
c.getPlayer().message("You've been disposed.");

View File

@@ -25,7 +25,7 @@ package client.command.commands.gm0;
import client.MapleClient;
import client.command.Command;
import constants.ServerConstants;
import config.YamlConfig;
public class DropLimitCommand extends Command {
{
@@ -35,10 +35,10 @@ public class DropLimitCommand extends Command {
@Override
public void execute(MapleClient c, String[] params) {
int dropCount = c.getPlayer().getMap().getDroppedItemCount();
if(((float) dropCount) / ServerConstants.ITEM_LIMIT_ON_MAP < 0.75f) {
c.getPlayer().showHint("Current drop count: #b" + dropCount + "#k / #e" + ServerConstants.ITEM_LIMIT_ON_MAP + "#n", 300);
if(((float) dropCount) / YamlConfig.config.server.ITEM_LIMIT_ON_MAP < 0.75f) {
c.getPlayer().showHint("Current drop count: #b" + dropCount + "#k / #e" + YamlConfig.config.server.ITEM_LIMIT_ON_MAP + "#n", 300);
} else {
c.getPlayer().showHint("Current drop count: #r" + dropCount + "#k / #e" + ServerConstants.ITEM_LIMIT_ON_MAP + "#n", 300);
c.getPlayer().showHint("Current drop count: #r" + dropCount + "#k / #e" + YamlConfig.config.server.ITEM_LIMIT_ON_MAP + "#n", 300);
}
}

View File

@@ -25,7 +25,7 @@ package client.command.commands.gm0;
import client.command.Command;
import client.MapleClient;
import net.server.coordinator.MapleLoginBypassCoordinator;
import net.server.coordinator.login.MapleLoginBypassCoordinator;
public class EnableAuthCommand extends Command {
{

View File

@@ -26,7 +26,8 @@ package client.command.commands.gm0;
import client.command.Command;
import client.MapleCharacter;
import client.MapleClient;
import constants.ServerConstants;
import config.YamlConfig;
import server.maps.MapleMap;
public class MapOwnerClaimCommand extends Command {
{
@@ -39,14 +40,27 @@ public class MapOwnerClaimCommand extends Command {
try {
MapleCharacter chr = c.getPlayer();
if (ServerConstants.USE_MAP_OWNERSHIP_SYSTEM) {
if (YamlConfig.config.server.USE_MAP_OWNERSHIP_SYSTEM) {
if (chr.getEventInstance() == null) {
if (chr.getMap().unclaimOwnership(chr)) {
chr.dropMessage(5, "This lawn is now free real estate.");
} else if (chr.getMap().claimOwnership(chr)) {
chr.dropMessage(5, "You have leased this lawn for a while, until you leave here or after 1 minute of inactivity.");
MapleMap map = chr.getMap();
if (map.countBosses() == 0) { // thanks Conrad for suggesting bosses prevent map leasing
MapleMap ownedMap = chr.getOwnedMap(); // thanks Conrad for suggesting not unlease a map as soon as player exits it
if (ownedMap != null) {
ownedMap.unclaimOwnership(chr);
if (map == ownedMap) {
chr.dropMessage(5, "This lawn is now free real estate.");
return;
}
}
if (map.claimOwnership(chr)) {
chr.dropMessage(5, "You have leased this lawn for a while, until you leave here or after 1 minute of inactivity.");
} else {
chr.dropMessage(5, "This lawn has already been leased by a player.");
}
} else {
chr.dropMessage(5, "This lawn has already been leased by another player.");
chr.dropMessage(5, "This lawn is currently under a boss siege.");
}
} else {
chr.dropMessage(5, "This lawn cannot be leased.");

View File

@@ -26,7 +26,7 @@ package client.command.commands.gm0;
import client.MapleCharacter;
import client.command.Command;
import client.MapleClient;
import constants.ServerConstants;
import config.YamlConfig;
public class RatesCommand extends Command {
{
@@ -43,7 +43,7 @@ public class RatesCommand extends Command {
showMsg_ += "MESO Rate: #e#b" + player.getMesoRate() + "x#k#n" + "\r\n";
showMsg_ += "DROP Rate: #e#b" + player.getDropRate() + "x#k#n" + "\r\n";
showMsg_ += "BOSS DROP Rate: #e#b" + player.getBossDropRate() + "x#k#n" + "\r\n";
if(ServerConstants.USE_QUEST_RATE) showMsg_ += "QUEST Rate: #e#b" + c.getWorldServer().getQuestRate() + "x#k#n" + "\r\n";
if(YamlConfig.config.server.USE_QUEST_RATE) showMsg_ += "QUEST Rate: #e#b" + c.getWorldServer().getQuestRate() + "x#k#n" + "\r\n";
player.showHint(showMsg_, 300);
}

View File

@@ -26,7 +26,7 @@ package client.command.commands.gm0;
import client.MapleCharacter;
import client.command.Command;
import client.MapleClient;
import constants.ServerConstants;
import config.YamlConfig;
public class ShowRatesCommand extends Command {
{
@@ -60,7 +60,7 @@ public class ShowRatesCommand extends Command {
if(player.getCouponDropRate() != 1) showMsg += "Coupon DROP Rate: #k" + player.getCouponDropRate() + "x#k" + "\r\n";
showMsg += "BOSS DROP Rate: #e#b" + player.getBossDropRate() + "x#k#n" + "\r\n";
if(ServerConstants.USE_QUEST_RATE) {
if(YamlConfig.config.server.USE_QUEST_RATE) {
showMsg += "\r\n" + "#eQUEST RATE#n" + "\r\n";
showMsg += "World QUEST Rate: #e#b" + c.getWorldServer().getQuestRate() + "x#k#n" + "\r\n";
}

View File

@@ -26,7 +26,7 @@ package client.command.commands.gm0;
import client.MapleCharacter;
import client.MapleClient;
import client.command.Command;
import constants.ServerConstants;
import config.YamlConfig;
public class StatDexCommand extends Command {
{
@@ -47,10 +47,10 @@ public class StatDexCommand extends Command {
return;
}
} else {
amount = Math.min(remainingAp, ServerConstants.MAX_AP - player.getDex());
amount = Math.min(remainingAp, YamlConfig.config.server.MAX_AP - player.getDex());
}
if (!player.assignDex(Math.max(amount, 0))) {
player.dropMessage("Please make sure your AP is not over " + ServerConstants.MAX_AP + " and you have enough to distribute.");
player.dropMessage("Please make sure your AP is not over " + YamlConfig.config.server.MAX_AP + " and you have enough to distribute.");
}
}
}

View File

@@ -26,7 +26,7 @@ package client.command.commands.gm0;
import client.command.Command;
import client.MapleClient;
import client.MapleCharacter;
import constants.ServerConstants;
import config.YamlConfig;
public class StatIntCommand extends Command {
{
@@ -47,10 +47,10 @@ public class StatIntCommand extends Command {
return;
}
} else {
amount = Math.min(remainingAp, ServerConstants.MAX_AP - player.getInt());
amount = Math.min(remainingAp, YamlConfig.config.server.MAX_AP - player.getInt());
}
if (!player.assignInt(Math.max(amount, 0))) {
player.dropMessage("Please make sure your AP is not over " + ServerConstants.MAX_AP + " and you have enough to distribute.");
player.dropMessage("Please make sure your AP is not over " + YamlConfig.config.server.MAX_AP + " and you have enough to distribute.");
}
}
}

View File

@@ -26,7 +26,7 @@ package client.command.commands.gm0;
import client.MapleCharacter;
import client.MapleClient;
import client.command.Command;
import constants.ServerConstants;
import config.YamlConfig;
public class StatLukCommand extends Command {
{
@@ -47,10 +47,10 @@ public class StatLukCommand extends Command {
return;
}
} else {
amount = Math.min(remainingAp, ServerConstants.MAX_AP - player.getLuk());
amount = Math.min(remainingAp, YamlConfig.config.server.MAX_AP - player.getLuk());
}
if (!player.assignLuk(Math.max(amount, 0))) {
player.dropMessage("Please make sure your AP is not over " + ServerConstants.MAX_AP + " and you have enough to distribute.");
player.dropMessage("Please make sure your AP is not over " + YamlConfig.config.server.MAX_AP + " and you have enough to distribute.");
}
}
}

View File

@@ -26,7 +26,7 @@ package client.command.commands.gm0;
import client.command.Command;
import client.MapleClient;
import client.MapleCharacter;
import constants.ServerConstants;
import config.YamlConfig;
public class StatStrCommand extends Command {
{
@@ -46,11 +46,11 @@ public class StatStrCommand extends Command {
return;
}
} else {
amount = Math.min(remainingAp, ServerConstants.MAX_AP - player.getStr());
amount = Math.min(remainingAp, YamlConfig.config.server.MAX_AP - player.getStr());
}
if (!player.assignStr(Math.max(amount, 0))) {
player.dropMessage("Please make sure your AP is not over " + ServerConstants.MAX_AP + " and you have enough to distribute.");
player.dropMessage("Please make sure your AP is not over " + YamlConfig.config.server.MAX_AP + " and you have enough to distribute.");
}
}
}

View File

@@ -25,7 +25,7 @@ package client.command.commands.gm0;
import client.MapleClient;
import client.command.Command;
import constants.ServerConstants;
import constants.net.ServerConstants;
import java.text.DateFormat;
import java.text.SimpleDateFormat;

View File

@@ -26,14 +26,13 @@ package client.command.commands.gm1;
import client.MapleCharacter;
import client.command.Command;
import client.MapleClient;
import constants.GameConstants;
import constants.game.GameConstants;
import java.util.ArrayList;
import java.util.Collections;
import net.server.Server;
import server.MaplePortal;
import server.maps.MaplePortal;
import server.maps.FieldLimit;
import server.maps.MapleMap;
import server.maps.MapleMapManager;
import server.maps.MapleMapFactory;
import server.maps.MapleMiniDungeonInfo;
import java.util.Comparator;
@@ -47,19 +46,28 @@ public class GotoCommand extends Command {
{
setDescription("");
MapleMapManager mapManager = Server.getInstance().getWorlds().get(0).getChannels().get(0).getMapFactory();
List<Entry<String, Integer>> towns = new ArrayList<>(GameConstants.GOTO_TOWNS.entrySet());
sortGotoEntries(towns);
for (Map.Entry<String, Integer> e : towns) {
GOTO_TOWNS_INFO += ("'" + e.getKey() + "' - #b" + (mapManager.getMap(e.getValue()).getMapName()) + "#k\r\n");
try {
// thanks shavit for noticing goto areas getting loaded from wz needlessly, only for the name retrieval
for (Map.Entry<String, Integer> e : towns) {
GOTO_TOWNS_INFO += ("'" + e.getKey() + "' - #b" + (MapleMapFactory.loadPlaceName(e.getValue())) + "#k\r\n");
}
List<Entry<String, Integer>> areas = new ArrayList<>(GameConstants.GOTO_AREAS.entrySet());
sortGotoEntries(areas);
for (Map.Entry<String, Integer> e : areas) {
GOTO_AREAS_INFO += ("'" + e.getKey() + "' - #b" + (MapleMapFactory.loadPlaceName(e.getValue())) + "#k\r\n");
}
} catch (Exception e) {
e.printStackTrace();
GOTO_TOWNS_INFO = "(none)";
GOTO_AREAS_INFO = "(none)";
}
List<Entry<String, Integer>> areas = new ArrayList<>(GameConstants.GOTO_AREAS.entrySet());
sortGotoEntries(areas);
for (Map.Entry<String, Integer> e : areas) {
GOTO_AREAS_INFO += ("'" + e.getKey() + "' - #b" + (mapManager.getMap(e.getValue()).getMapName()) + "#k\r\n");
}
}
public static String GOTO_TOWNS_INFO = "";
@@ -105,7 +113,7 @@ public class GotoCommand extends Command {
gotomaps = new HashMap<>(GameConstants.GOTO_AREAS); // distinct map registry for GM/users suggested thanks to Vcoc
gotomaps.putAll(GameConstants.GOTO_TOWNS); // thanks Halcyon (UltimateMors) for pointing out duplicates on listed entries functionality
} else {
gotomaps = new HashMap<>(GameConstants.GOTO_TOWNS);
gotomaps = GameConstants.GOTO_TOWNS;
}
if (gotomaps.containsKey(params[0])) {

View File

@@ -26,7 +26,7 @@ package client.command.commands.gm2;
import client.command.Command;
import client.MapleClient;
import client.MapleCharacter;
import constants.ServerConstants;
import config.YamlConfig;
public class ApCommand extends Command {
{
@@ -44,7 +44,7 @@ public class ApCommand extends Command {
if (params.length < 2) {
int newAp = Integer.parseInt(params[0]);
if (newAp < 0) newAp = 0;
else if (newAp > ServerConstants.MAX_AP) newAp = ServerConstants.MAX_AP;
else if (newAp > YamlConfig.config.server.MAX_AP) newAp = YamlConfig.config.server.MAX_AP;
player.changeRemainingAp(newAp, false);
} else {
@@ -52,7 +52,7 @@ public class ApCommand extends Command {
if (victim != null) {
int newAp = Integer.parseInt(params[1]);
if (newAp < 0) newAp = 0;
else if (newAp > ServerConstants.MAX_AP) newAp = ServerConstants.MAX_AP;
else if (newAp > YamlConfig.config.server.MAX_AP) newAp = YamlConfig.config.server.MAX_AP;
victim.changeRemainingAp(newAp, false);
} else {

View File

@@ -55,7 +55,7 @@ public class IdCommand extends Command {
}
sb.append(String.format("Results found: #r%d#k | Returned: #b%d#k/100 | Refine search query to improve time.", resultList.size(), count) + "\r\n");
player.getClient().getAbstractPlayerInteraction().npcTalk(9010000, sb.toString());
player.getAbstractPlayerInteraction().npcTalk(9010000, sb.toString());
} else {
player.yellowMessage(String.format("Id not found for item: %s, of type: %s.", queryItem, params[0]));
}

View File

@@ -28,8 +28,8 @@ import client.MapleClient;
import client.MapleCharacter;
import client.inventory.MaplePet;
import client.inventory.manipulator.MapleInventoryManipulator;
import constants.ItemConstants;
import constants.ServerConstants;
import config.YamlConfig;
import constants.inventory.ItemConstants;
import server.MapleItemInformationProvider;
public class ItemCommand extends Command {
@@ -57,7 +57,7 @@ public class ItemCommand extends Command {
short quantity = 1;
if(params.length >= 2) quantity = Short.parseShort(params[1]);
if (ServerConstants.BLOCK_GENERATE_CASH_ITEM && ii.isCash(itemId)) {
if (YamlConfig.config.server.BLOCK_GENERATE_CASH_ITEM && ii.isCash(itemId)) {
player.yellowMessage("You cannot create a cash item with this command.");
return;
}
@@ -77,12 +77,12 @@ public class ItemCommand extends Command {
}
}
byte flag = 0;
short flag = 0;
if(player.gmLevel() < 3) {
flag |= ItemConstants.ACCOUNT_SHARING;
flag |= ItemConstants.UNTRADEABLE;
}
MapleInventoryManipulator.addById(c, itemId, quantity, player.getName(), -1, flag, -1);
}
}

View File

@@ -29,8 +29,8 @@ import client.MapleCharacter;
import client.inventory.Item;
import client.inventory.MapleInventoryType;
import client.inventory.MaplePet;
import constants.ItemConstants;
import constants.ServerConstants;
import config.YamlConfig;
import constants.inventory.ItemConstants;
import server.MapleItemInformationProvider;
public class ItemDropCommand extends Command {
@@ -58,7 +58,7 @@ public class ItemDropCommand extends Command {
short quantity = 1;
if(params.length >= 2) quantity = Short.parseShort(params[1]);
if (ServerConstants.BLOCK_GENERATE_CASH_ITEM && ii.isCash(itemId)) {
if (YamlConfig.config.server.BLOCK_GENERATE_CASH_ITEM && ii.isCash(itemId)) {
player.yellowMessage("You cannot create a cash item with this command.");
return;
}
@@ -75,12 +75,12 @@ public class ItemDropCommand extends Command {
toDrop.setOwner("");
if(player.gmLevel() < 3) {
byte b = toDrop.getFlag();
b |= ItemConstants.ACCOUNT_SHARING;
b |= ItemConstants.UNTRADEABLE;
b |= ItemConstants.SANDBOX;
short f = toDrop.getFlag();
f |= ItemConstants.ACCOUNT_SHARING;
f |= ItemConstants.UNTRADEABLE;
f |= ItemConstants.SANDBOX;
toDrop.setFlag(b);
toDrop.setFlag(f);
toDrop.setOwner("TRIAL-MODE");
}
@@ -102,12 +102,12 @@ public class ItemDropCommand extends Command {
toDrop.setOwner(player.getName());
if(player.gmLevel() < 3) {
byte b = toDrop.getFlag();
b |= ItemConstants.ACCOUNT_SHARING;
b |= ItemConstants.UNTRADEABLE;
b |= ItemConstants.SANDBOX;
short f = toDrop.getFlag();
f |= ItemConstants.ACCOUNT_SHARING;
f |= ItemConstants.UNTRADEABLE;
f |= ItemConstants.SANDBOX;
toDrop.setFlag(b);
toDrop.setFlag(f);
toDrop.setOwner("TRIAL-MODE");
}

View File

@@ -26,7 +26,7 @@ package client.command.commands.gm2;
import client.command.Command;
import client.MapleClient;
import client.MapleCharacter;
import server.MaplePortal;
import server.maps.MaplePortal;
import server.maps.MapleMap;
public class JailCommand extends Command {

View File

@@ -26,7 +26,7 @@ package client.command.commands.gm2;
import client.command.Command;
import client.MapleClient;
import client.MapleCharacter;
import constants.ServerConstants;
import config.YamlConfig;
public class LevelCommand extends Command {
{
@@ -45,7 +45,7 @@ public class LevelCommand extends Command {
player.setLevel(Math.min(Integer.parseInt(params[0]), player.getMaxClassLevel()) - 1);
player.resetPlayerRates();
if (ServerConstants.USE_ADD_RATES_BY_LEVEL) player.setPlayerRates();
if (YamlConfig.config.server.USE_ADD_RATES_BY_LEVEL) player.setPlayerRates();
player.setWorldRates();
player.levelUp(false);

View File

@@ -0,0 +1,51 @@
/*
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: Resinate
*/
package client.command.commands.gm2;
import client.MapleClient;
import client.command.Command;
import java.util.Arrays;
import java.util.List;
import server.maps.MapleMapItem;
import server.maps.MapleMapObject;
import server.maps.MapleMapObjectType;
public class LootCommand extends Command {
{
setDescription("Loots all items that belong to you.");
}
@Override
public void execute(MapleClient c, String[] params) {
List<MapleMapObject> items = c.getPlayer().getMap().getMapObjectsInRange(c.getPlayer().getPosition(), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.ITEM));
for (MapleMapObject item : items) {
MapleMapItem mapItem = (MapleMapItem) item;
if (mapItem.getOwnerId() == c.getPlayer().getId() || mapItem.getOwnerId() == c.getPlayer().getPartyId()) {
c.getPlayer().pickupItem(mapItem);
}
}
}
}

View File

@@ -27,7 +27,7 @@ import client.MapleStat;
import client.command.Command;
import client.MapleClient;
import client.MapleCharacter;
import constants.ServerConstants;
import config.YamlConfig;
public class MaxStatCommand extends Command {
{
@@ -40,7 +40,7 @@ public class MaxStatCommand extends Command {
player.loseExp(player.getExp(), false, false);
player.setLevel(255);
player.resetPlayerRates();
if (ServerConstants.USE_ADD_RATES_BY_LEVEL) player.setPlayerRates();
if (YamlConfig.config.server.USE_ADD_RATES_BY_LEVEL) player.setPlayerRates();
player.setWorldRates();
player.updateStrDexIntLuk(Short.MAX_VALUE);
player.setFame(13337);

View File

@@ -28,7 +28,7 @@ import client.command.Command;
import client.MapleClient;
import client.inventory.Item;
import client.inventory.MapleInventoryType;
import constants.ItemConstants;
import constants.inventory.ItemConstants;
import server.MapleItemInformationProvider;
public class RechargeCommand extends Command {

View File

@@ -19,25 +19,36 @@
*/
/*
@Author: Arthur L - Refactored command content into modules
@Author: Ronan
*/
package client.command;
package client.command.commands.gm2;
class RegisteredCommand {
import client.*;
import client.command.Command;
private final Class<? extends Command> commandClass;
private final int rank;
RegisteredCommand(Class<? extends Command> commandClass, int rank){
this.commandClass = commandClass;
this.rank = rank;
public class SetSlotCommand extends Command {
{
setDescription("");
}
public Class<? extends Command> getCommandClass() {
return commandClass;
}
public int getRank() {
return rank;
@Override
public void execute(MapleClient c, String[] params) {
MapleCharacter player = c.getPlayer();
if (params.length < 1) {
player.yellowMessage("Syntax: !setslot <newlevel>");
return;
}
int slots = (Integer.parseInt(params[0]) / 4) * 4;
for (int i = 1; i < 5; i++) {
int curSlots = player.getSlots(i);
if (slots <= -curSlots) {
continue;
}
player.gainSlots(i, slots - curSlots, true);
}
player.yellowMessage("Slots updated.");
}
}

View File

@@ -26,7 +26,7 @@ package client.command.commands.gm2;
import client.command.Command;
import client.MapleClient;
import client.MapleCharacter;
import constants.ServerConstants;
import config.YamlConfig;
public class SpCommand extends Command {
{
@@ -44,7 +44,7 @@ public class SpCommand extends Command {
if (params.length == 1) {
int newSp = Integer.parseInt(params[0]);
if (newSp < 0) newSp = 0;
else if (newSp > ServerConstants.MAX_AP) newSp = ServerConstants.MAX_AP;
else if (newSp > YamlConfig.config.server.MAX_AP) newSp = YamlConfig.config.server.MAX_AP;
player.updateRemainingSp(newSp);
} else {
@@ -52,7 +52,7 @@ public class SpCommand extends Command {
if (victim != null) {
int newSp = Integer.parseInt(params[1]);
if (newSp < 0) newSp = 0;
else if (newSp > ServerConstants.MAX_AP) newSp = ServerConstants.MAX_AP;
else if (newSp > YamlConfig.config.server.MAX_AP) newSp = YamlConfig.config.server.MAX_AP;
victim.updateRemainingSp(newSp);

View File

@@ -27,7 +27,7 @@ import client.MapleStat;
import client.command.Command;
import client.MapleClient;
import client.MapleCharacter;
import constants.ItemConstants;
import constants.inventory.ItemConstants;
import server.MapleItemInformationProvider;
public class FaceCommand extends Command {

View File

@@ -27,7 +27,7 @@ import client.MapleStat;
import client.command.Command;
import client.MapleClient;
import client.MapleCharacter;
import constants.ItemConstants;
import constants.inventory.ItemConstants;
import server.MapleItemInformationProvider;
public class HairCommand extends Command {

View File

@@ -26,7 +26,7 @@ package client.command.commands.gm3;
import client.command.Command;
import client.MapleClient;
import client.MapleCharacter;
import constants.GameConstants;
import constants.game.GameConstants;
import tools.MaplePacketCreator;
public class MusicCommand extends Command {

View File

@@ -46,13 +46,13 @@ public class QuestCompleteCommand extends Command {
if (player.getQuestStatus(questId) == 1) {
MapleQuest quest = MapleQuest.getInstance(questId);
if (quest != null) {
int npcid = quest.getNpcRequirement(true);
quest.forceComplete(player, npcid);
player.dropMessage(5, "QUEST " + questId + " completed.");
} else { // should not occur
player.dropMessage(5, "QUESTID " + questId + " is invalid.");
if (quest != null && quest.getNpcRequirement(true) != -1) {
c.getAbstractPlayerInteraction().forceCompleteQuest(questId, quest.getNpcRequirement(true));
} else {
c.getAbstractPlayerInteraction().forceCompleteQuest(questId);
}
player.dropMessage(5, "QUEST " + questId + " completed.");
} else {
player.dropMessage(5, "QUESTID " + questId + " not started or already completed.");
}

View File

@@ -46,13 +46,13 @@ public class QuestStartCommand extends Command {
if (player.getQuestStatus(questid) == 0) {
MapleQuest quest = MapleQuest.getInstance(questid);
if (quest != null) {
int npcid = quest.getNpcRequirement(false);
quest.forceStart(player, npcid);
player.dropMessage(5, "QUEST " + questid + " started.");
if (quest != null && quest.getNpcRequirement(false) != -1) {
c.getAbstractPlayerInteraction().forceStartQuest(questid, quest.getNpcRequirement(false));
} else {
player.dropMessage(5, "QUESTID " + questid + " is invalid.");
c.getAbstractPlayerInteraction().forceStartQuest(questid);
}
player.dropMessage(5, "QUEST " + questid + " started.");
} else {
player.dropMessage(5, "QUESTID " + questid + " already started/completed.");
}

View File

@@ -36,6 +36,8 @@ public class PapCommand extends Command {
@Override
public void execute(MapleClient c, String[] params) {
MapleCharacter player = c.getPlayer();
player.getMap().spawnMonsterOnGroundBelow(MapleLifeFactory.getMonster(8510000), player.getPosition());
// thanks Conrad for noticing mobid typo here
player.getMap().spawnMonsterOnGroundBelow(MapleLifeFactory.getMonster(8500001), player.getPosition());
}
}

View File

@@ -30,7 +30,7 @@ import client.inventory.Equip;
import client.inventory.Item;
import client.inventory.MapleInventoryType;
import client.inventory.manipulator.MapleInventoryManipulator;
import constants.ItemConstants;
import constants.inventory.ItemConstants;
import server.MapleItemInformationProvider;
public class ProItemCommand extends Command {
@@ -84,7 +84,7 @@ public class ProItemCommand extends Command {
equip.setHp(stat);
equip.setMp(stat);
byte flag = equip.getFlag();
short flag = equip.getFlag();
flag |= ItemConstants.UNTRADEABLE;
equip.setFlag(flag);
}

View File

@@ -29,7 +29,7 @@ import client.MapleCharacter;
import client.inventory.Equip;
import client.inventory.MapleInventory;
import client.inventory.MapleInventoryType;
import constants.ItemConstants;
import constants.inventory.ItemConstants;
public class SetEqStatCommand extends Command {
{
@@ -68,7 +68,7 @@ public class SetEqStatCommand extends Command {
eq.setStr(newStat);
eq.setLuk(newStat);
byte flag = eq.getFlag();
short flag = eq.getFlag();
flag |= ItemConstants.UNTRADEABLE;
eq.setFlag(flag);

View File

@@ -27,14 +27,13 @@ import client.command.Command;
import client.MapleClient;
import client.MapleCharacter;
import net.server.Server;
import server.MaplePortal;
import server.maps.MaplePortal;
import server.TimerManager;
import server.life.MapleMonster;
import server.life.SpawnPoint;
import server.maps.MapleMapObject;
import server.maps.MapleMapObjectType;
import server.maps.MapleReactor;
import tools.MaplePacketCreator;
import java.awt.*;
import java.util.Arrays;

View File

@@ -23,7 +23,7 @@ import java.util.Collection;
import client.MapleClient;
import client.MapleCharacter;
import client.command.Command;
import constants.GameConstants;
import constants.game.GameConstants;
import net.server.Server;
import net.server.world.World;

View File

@@ -25,7 +25,7 @@ package client.command.commands.gm5;
import client.command.Command;
import client.MapleClient;
import constants.ServerConstants;
import constants.net.ServerConstants;
public class SetCommand extends Command {
{

View File

@@ -25,7 +25,7 @@ package client.command.commands.gm5;
import client.command.Command;
import client.MapleClient;
import constants.ServerConstants;
import config.YamlConfig;
public class ShowMoveLifeCommand extends Command {
{
@@ -34,6 +34,6 @@ public class ShowMoveLifeCommand extends Command {
@Override
public void execute(MapleClient c, String[] params) {
ServerConstants.USE_DEBUG_SHOW_RCVD_MVLIFE = !ServerConstants.USE_DEBUG_SHOW_RCVD_MVLIFE;
YamlConfig.config.server.USE_DEBUG_SHOW_RCVD_MVLIFE = !YamlConfig.config.server.USE_DEBUG_SHOW_RCVD_MVLIFE;
}
}

View File

@@ -25,7 +25,7 @@ package client.command.commands.gm5;
import client.command.Command;
import client.MapleClient;
import constants.ServerConstants;
import config.YamlConfig;
public class ShowPacketsCommand extends Command {
{
@@ -34,6 +34,6 @@ public class ShowPacketsCommand extends Command {
@Override
public void execute(MapleClient c, String[] params) {
ServerConstants.USE_DEBUG_SHOW_RCVD_PACKET = !ServerConstants.USE_DEBUG_SHOW_RCVD_PACKET;
YamlConfig.config.server.USE_DEBUG_SHOW_RCVD_PACKET = !YamlConfig.config.server.USE_DEBUG_SHOW_RCVD_PACKET;
}
}

View File

@@ -21,7 +21,7 @@ package client.command.commands.gm5;
import client.MapleClient;
import client.command.Command;
import net.server.coordinator.MapleSessionCoordinator;
import net.server.coordinator.session.MapleSessionCoordinator;
/**
*

View File

@@ -22,7 +22,7 @@ package client.command.commands.gm6;
import client.MapleCharacter;
import client.MapleClient;
import client.command.Command;
import constants.ServerConstants;
import config.YamlConfig;
public class SupplyRateCouponCommand extends Command {
{
@@ -37,7 +37,7 @@ public class SupplyRateCouponCommand extends Command {
return;
}
ServerConstants.USE_SUPPLY_RATE_COUPONS = params[0].compareToIgnoreCase("no") != 0;
player.dropMessage(5, "Rate coupons are now " + (ServerConstants.USE_SUPPLY_RATE_COUPONS ? "enabled" : "disabled") + " for purchase at the Cash Shop.");
YamlConfig.config.server.USE_SUPPLY_RATE_COUPONS = params[0].compareToIgnoreCase("no") != 0;
player.dropMessage(5, "Rate coupons are now " + (YamlConfig.config.server.USE_SUPPLY_RATE_COUPONS ? "enabled" : "disabled") + " for purchase at the Cash Shop.");
}
}

View File

@@ -52,7 +52,6 @@ public class WarpWorldCommand extends Command {
String[] socket = server.getInetSocket(worldb, c.getChannel());
c.getWorldServer().removePlayer(player);
player.getMap().removePlayer(player);//LOL FORGOT THIS ><
c.updateLoginState(MapleClient.LOGIN_SERVER_TRANSITION);
player.setSessionTransitionState();
player.setWorld(worldb);
player.saveCharToDB();//To set the new world :O (true because else 2 player instances are created, one in both worlds)