Boss Daily Entry + Maker enable actions + Duey Quick Delivery

Fixed Legendary Spirit UI getting stuck when trying to apply scrolls in equipments without upgrade slots available.
Revised map leasing. Players no longer lose ownership when changing maps. Players are allowed to lease one map each time.
Revised expeditions warping players out as soon as the leader leaves the event or the number of players inside gets to be less than the minimum required to enter.
Fixed start/complete quest commands not acting properly for some quests.
Refactored quest loadouts unnecessarily reloading MapleData.
Implemented support for daily boss limit entry, usable on expeditions.
Revised potential exploit cases within chair, face expression, quest action, summon damage and mob damage mob handlers.
Adjusted displayed date in Duey. Value displayed now should be consistent with the expected expiration time.
Refactored damage for friendly mobs getting handled inside packet structure.
Implemented support for Quick Delivery from Duey.
Fixed Horntail specifically not dropping loots after recent updates.
Refactored commands system. All commands are instanced at boot time instead of at every call.
Fixed usage of Maker skill not sending MAKER_RESULT packet to players. This automatically reenables the actions button (such as create) in Maker UI.
Adjusted minidungeons, now using time limits specified in their respective recipes.
Reviewed the "timeLimit" property utilized by maps, which was poised to work on 2 different concepts altogether.
Fixed Gaga space event, should be functional now.
Added RPS minigame, resources implemented by Arnah.
Fixed damage taken from mob auto-destruction not working properly.
This commit is contained in:
ronancpl
2019-06-27 20:34:39 -03:00
parent a39a210c1f
commit fba27fb3b1
82 changed files with 2902 additions and 2611 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(){

View File

@@ -1,43 +0,0 @@
/*
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;
class RegisteredCommand {
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<? extends Command> getCommandClass() {
return commandClass;
}
public int getRank() {
return rank;
}
}

View File

@@ -27,6 +27,7 @@ import client.command.Command;
import client.MapleCharacter;
import client.MapleClient;
import constants.ServerConstants;
import server.maps.MapleMap;
public class MapOwnerClaimCommand extends Command {
{
@@ -41,12 +42,20 @@ public class MapOwnerClaimCommand extends Command {
if (ServerConstants.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)) {
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 (chr.getMap() == ownedMap) {
chr.dropMessage(5, "This lawn is now free real estate.");
return;
}
}
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.");
} else {
chr.dropMessage(5, "This lawn has already been leased by another player.");
chr.dropMessage(5, "This lawn has already been leased by a player.");
}
} else {
chr.dropMessage(5, "This lawn cannot be leased.");

View File

@@ -105,7 +105,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 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

@@ -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

@@ -26,7 +26,6 @@ package client.command.commands.gm3;
import client.command.Command;
import client.MapleClient;
import client.MapleCharacter;
import server.quest.MapleQuest;
public class QuestCompleteCommand extends Command {
{
@@ -45,14 +44,8 @@ public class QuestCompleteCommand extends Command {
int questId = Integer.parseInt(params[0]);
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.");
}
c.getAbstractPlayerInteraction().forceCompleteQuest(questId);
player.dropMessage(5, "QUEST " + questId + " completed.");
} else {
player.dropMessage(5, "QUESTID " + questId + " not started or already completed.");
}

View File

@@ -26,7 +26,6 @@ package client.command.commands.gm3;
import client.command.Command;
import client.MapleClient;
import client.MapleCharacter;
import server.quest.MapleQuest;
public class QuestStartCommand extends Command {
{
@@ -45,14 +44,8 @@ public class QuestStartCommand extends Command {
int questid = Integer.parseInt(params[0]);
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.");
} 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

@@ -34,7 +34,6 @@ 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;