Client Timestamp update + Cosmetic NPCs & H Beacon patch + Log rework

Fixed Music command not playing soundtracks at all.
Fixed stylish scripts stucking player NPC interactions in certain cases.
Reviewed client mistimed view on items, quest expirations, BBS threads, etc.
Fixed Homing Beacon skill provoking autoflag in mobs with same objectid in different maps.
Solved DB leak cases with removing pets from inventory.
Reviewed logging throughout the source, aiming to normalize the varied-spaced log content within the facilities.
Fixed a bug that would occur when trying to reaccess Horntail expedition.
This commit is contained in:
ronancpl
2019-01-07 12:10:41 -02:00
parent 35ea13420e
commit b47dd03a3e
110 changed files with 511 additions and 585 deletions

View File

@@ -113,7 +113,7 @@ public class CommandsExecutor {
private void writeLog(MapleClient client, String command){
SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy HH:mm");
FilePrinter.print(FilePrinter.USED_COMMANDS, client.getPlayer().getName() + " used: " + command + " on "
+ sdf.format(Calendar.getInstance().getTime()) + "\r\n");
+ sdf.format(Calendar.getInstance().getTime()));
}
private void addCommandInfo(String name, Class<? extends Command> commandClass) {
@@ -262,7 +262,7 @@ public class CommandsExecutor {
addCommand("ignored", 3, IgnoredCommand.class);
addCommand("pos", 3, PosCommand.class);
addCommand("togglecoupon", 3, ToggleCouponCommand.class);
addCommand("chat", 3, ChatCommand.class);
addCommand("togglewhitechat", 3, ChatCommand.class);
addCommand("fame", 3, FameCommand.class);
addCommand("givenx", 3, GiveNxCommand.class);
addCommand("givevp", 3, GiveVpCommand.class);

View File

@@ -61,6 +61,7 @@ public class GachaCommand extends Command {
}
}
talkStr += "\r\nPlease keep in mind that there are items that are in all gachapons and are not listed here.";
c.announce(MaplePacketCreator.getNPCTalk(9010000, (byte) 0, talkStr, "00 00", (byte) 0));
c.getAbstractPlayerInteraction().npcTalk(9010000, talkStr);
}
}

View File

@@ -53,7 +53,7 @@ public class GmCommand extends Command {
String message = joinStringFrom(params, 0);
Server.getInstance().broadcastGMMessage(c.getWorld(), MaplePacketCreator.sendYellowTip("[GM MESSAGE]:" + MapleCharacter.makeMapleReadable(player.getName()) + ": " + message));
Server.getInstance().broadcastGMMessage(c.getWorld(), MaplePacketCreator.serverNotice(1, message));
FilePrinter.printError("gm.txt", MapleCharacter.makeMapleReadable(player.getName()) + ": " + message + "\r\n");
FilePrinter.printError(FilePrinter.COMMAND_GM, MapleCharacter.makeMapleReadable(player.getName()) + ": " + message);
player.dropMessage(5, "Your message '" + message + "' was sent to GMs.");
player.dropMessage(5, tips[Randomizer.nextInt(tips.length)]);
}

View File

@@ -46,7 +46,7 @@ public class ReportBugCommand extends Command {
String message = joinStringFrom(params, 0);
Server.getInstance().broadcastGMMessage(c.getWorld(), MaplePacketCreator.sendYellowTip("[BUG]:" + MapleCharacter.makeMapleReadable(player.getName()) + ": " + message));
Server.getInstance().broadcastGMMessage(c.getWorld(), MaplePacketCreator.serverNotice(1, message));
FilePrinter.printError("bug.txt", MapleCharacter.makeMapleReadable(player.getName()) + ": " + message + "\r\n");
FilePrinter.printError(FilePrinter.COMMAND_BUG, MapleCharacter.makeMapleReadable(player.getName()) + ": " + message);
player.dropMessage(5, "Your bug '" + message + "' was submitted successfully to our developers. Thank you!");
}

View File

@@ -50,7 +50,7 @@ public class GotoCommand extends Command {
}
if (player.getEventInstance() != null || MapleMiniDungeonInfo.isDungeonMap(player.getMapId()) || FieldLimit.CANNOTMIGRATE.check(player.getMap().getFieldLimit()) || !player.isAlive()) {
player.yellowMessage("This command can not be used in this map.");
player.dropMessage(1, "This command can not be used in this map.");
return;
}

View File

@@ -72,6 +72,7 @@ public class WhatDropsFromCommand extends Command {
output += "\r\n";
}
}
c.announce(MaplePacketCreator.getNPCTalk(9010000, (byte) 0, output, "00 00", (byte) 0));
c.getAbstractPlayerInteraction().npcTalk(9010000, output);
}
}

View File

@@ -86,7 +86,8 @@ public class WhoDropsCommand extends Command {
player.dropMessage(5, "The item you searched for doesn't exist.");
return;
}
c.announce(MaplePacketCreator.getNPCTalk(9010000, (byte) 0, output, "00 00", (byte) 0));
c.getAbstractPlayerInteraction().npcTalk(9010000, output);
} finally {
c.releaseClient();
}

View File

@@ -136,6 +136,6 @@ public class SearchCommand extends Command {
}
sb.append("\r\n#kLoaded within ").append((double) (System.currentTimeMillis() - start) / 1000).append(" seconds.");//because I can, and it's free
c.announce(MaplePacketCreator.getNPCTalk(9010000, (byte) 0, sb.toString(), "00 00", (byte) 0));
c.getAbstractPlayerInteraction().npcTalk(9010000, sb.toString());
}
}

View File

@@ -26,7 +26,9 @@ package client.command.commands.gm2;
import client.command.Command;
import client.MapleClient;
import client.MapleCharacter;
import server.maps.FieldLimit;
import server.maps.MapleMap;
import server.maps.MapleMiniDungeonInfo;
public class WarpCommand extends Command {
{
@@ -48,6 +50,11 @@ public class WarpCommand extends Command {
return;
}
if (player.getEventInstance() != null || MapleMiniDungeonInfo.isDungeonMap(player.getMapId()) || FieldLimit.CANNOTMIGRATE.check(player.getMap().getFieldLimit()) || !player.isAlive()) {
player.dropMessage(1, "This command cannot be used in this map.");
return;
}
// expedition issue with this command detected thanks to Masterrulax
player.saveLocationOnWarp();
player.changeMap(target, target.getRandomPlayerSpawnpoint());

View File

@@ -26,6 +26,7 @@ package client.command.commands.gm3;
import client.command.Command;
import client.MapleClient;
import client.MapleCharacter;
import constants.GameConstants;
import tools.MaplePacketCreator;
public class MusicCommand extends Command {
@@ -33,181 +34,42 @@ public class MusicCommand extends Command {
setDescription("");
}
private static String getSongList() {
String songList = "Song:\r\n";
for (String s : GameConstants.GAME_SONGS) {
songList += (" " + s + "\r\n");
}
return songList;
}
@Override
public void execute(MapleClient c, String[] params) {
final String[] songs = {
"Jukebox/Congratulation",
"Bgm00/SleepyWood",
"Bgm00/FloralLife",
"Bgm00/GoPicnic",
"Bgm00/Nightmare",
"Bgm00/RestNPeace",
"Bgm01/AncientMove",
"Bgm01/MoonlightShadow",
"Bgm01/WhereTheBarlogFrom",
"Bgm01/CavaBien",
"Bgm01/HighlandStar",
"Bgm01/BadGuys",
"Bgm02/MissingYou",
"Bgm02/WhenTheMorningComes",
"Bgm02/EvilEyes",
"Bgm02/JungleBook",
"Bgm02/AboveTheTreetops",
"Bgm03/Subway",
"Bgm03/Elfwood",
"Bgm03/BlueSky",
"Bgm03/Beachway",
"Bgm03/SnowyVillage",
"Bgm04/PlayWithMe",
"Bgm04/WhiteChristmas",
"Bgm04/UponTheSky",
"Bgm04/ArabPirate",
"Bgm04/Shinin'Harbor",
"Bgm04/WarmRegard",
"Bgm05/WolfWood",
"Bgm05/DownToTheCave",
"Bgm05/AbandonedMine",
"Bgm05/MineQuest",
"Bgm05/HellGate",
"Bgm06/FinalFight",
"Bgm06/WelcomeToTheHell",
"Bgm06/ComeWithMe",
"Bgm06/FlyingInABlueDream",
"Bgm06/FantasticThinking",
"Bgm07/WaltzForWork",
"Bgm07/WhereverYouAre",
"Bgm07/FunnyTimeMaker",
"Bgm07/HighEnough",
"Bgm07/Fantasia",
"Bgm08/LetsMarch",
"Bgm08/ForTheGlory",
"Bgm08/FindingForest",
"Bgm08/LetsHuntAliens",
"Bgm08/PlotOfPixie",
"Bgm09/DarkShadow",
"Bgm09/TheyMenacingYou",
"Bgm09/FairyTale",
"Bgm09/FairyTalediffvers",
"Bgm09/TimeAttack",
"Bgm10/Timeless",
"Bgm10/TimelessB",
"Bgm10/BizarreTales",
"Bgm10/TheWayGrotesque",
"Bgm10/Eregos",
"Bgm11/BlueWorld",
"Bgm11/Aquarium",
"Bgm11/ShiningSea",
"Bgm11/DownTown",
"Bgm11/DarkMountain",
"Bgm12/AquaCave",
"Bgm12/DeepSee",
"Bgm12/WaterWay",
"Bgm12/AcientRemain",
"Bgm12/RuinCastle",
"Bgm12/Dispute",
"Bgm13/CokeTown",
"Bgm13/Leafre",
"Bgm13/Minar'sDream",
"Bgm13/AcientForest",
"Bgm13/TowerOfGoddess",
"Bgm14/DragonLoad",
"Bgm14/HonTale",
"Bgm14/CaveOfHontale",
"Bgm14/DragonNest",
"Bgm14/Ariant",
"Bgm14/HotDesert",
"Bgm15/MureungHill",
"Bgm15/MureungForest",
"Bgm15/WhiteHerb",
"Bgm15/Pirate",
"Bgm15/SunsetDesert",
"Bgm16/Duskofgod",
"Bgm16/FightingPinkBeen",
"Bgm16/Forgetfulness",
"Bgm16/Remembrance",
"Bgm16/Repentance",
"Bgm16/TimeTemple",
"Bgm17/MureungSchool1",
"Bgm17/MureungSchool2",
"Bgm17/MureungSchool3",
"Bgm17/MureungSchool4",
"Bgm18/BlackWing",
"Bgm18/DrillHall",
"Bgm18/QueensGarden",
"Bgm18/RaindropFlower",
"Bgm18/WolfAndSheep",
"Bgm19/BambooGym",
"Bgm19/CrystalCave",
"Bgm19/MushCatle",
"Bgm19/RienVillage",
"Bgm19/SnowDrop",
"Bgm20/GhostShip",
"Bgm20/NetsPiramid",
"Bgm20/UnderSubway",
"Bgm21/2021year",
"Bgm21/2099year",
"Bgm21/2215year",
"Bgm21/2230year",
"Bgm21/2503year",
"Bgm21/KerningSquare",
"Bgm21/KerningSquareField",
"Bgm21/KerningSquareSubway",
"Bgm21/TeraForest",
"BgmEvent/FunnyRabbit",
"BgmEvent/FunnyRabbitFaster",
"BgmEvent/wedding",
"BgmEvent/weddingDance",
"BgmEvent/wichTower",
"BgmGL/amoria",
"BgmGL/Amorianchallenge",
"BgmGL/chapel",
"BgmGL/cathedral",
"BgmGL/Courtyard",
"BgmGL/CrimsonwoodKeep",
"BgmGL/CrimsonwoodKeepInterior",
"BgmGL/GrandmastersGauntlet",
"BgmGL/HauntedHouse",
"BgmGL/NLChunt",
"BgmGL/NLCtown",
"BgmGL/NLCupbeat",
"BgmGL/PartyQuestGL",
"BgmGL/PhantomForest",
"BgmJp/Feeling",
"BgmJp/BizarreForest",
"BgmJp/Hana",
"BgmJp/Yume",
"BgmJp/Bathroom",
"BgmJp/BattleField",
"BgmJp/FirstStepMaster",
"BgmMY/Highland",
"BgmMY/KualaLumpur",
"BgmSG/BoatQuay_field",
"BgmSG/BoatQuay_town",
"BgmSG/CBD_field",
"BgmSG/CBD_town",
"BgmSG/Ghostship",
"BgmUI/ShopBgm",
"BgmUI/Title"
};
MapleCharacter player = c.getPlayer();
if (params.length < 1) {
player.yellowMessage("Syntax: !music <song>");
for (String s : songs) {
player.yellowMessage(s);
}
String sendMsg = "";
sendMsg += "Syntax: #r!music <song>#k\r\n\r\n";
sendMsg += getSongList();
c.announce(MaplePacketCreator.getNPCTalk(1052015, (byte) 0, sendMsg, "00 00", (byte) 0));
return;
}
String song = joinStringFrom(params, 0);
for (String s : songs) {
if (s.equals(song)) {
for (String s : GameConstants.GAME_SONGS) {
if (s.equalsIgnoreCase(song)) { // thanks Masterrulax for finding an issue here
player.getMap().broadcastMessage(MaplePacketCreator.musicChange(s));
player.yellowMessage("Now playing song " + song + ".");
break;
player.yellowMessage("Now playing song " + s + ".");
return;
}
}
player.yellowMessage("Song not found, please enter a song below.");
for (String s : songs) {
player.yellowMessage(s);
}
String sendMsg = "";
sendMsg += "Song not found, please enter a song below.\r\n\r\n";
sendMsg += getSongList();
c.announce(MaplePacketCreator.getNPCTalk(1052015, (byte) 0, sendMsg, "00 00", (byte) 0));
}
}

View File

@@ -45,11 +45,18 @@ public class ProItemCommand extends Command {
player.yellowMessage("Syntax: !proitem <itemid> <stat value> [<spdjmp value>]");
return;
}
MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();
int itemid = Integer.parseInt(params[0]);
if(ii.getName(itemid) == null) {
player.yellowMessage("Item id '" + params[0] + "' does not exist.");
return;
}
short stat = (short) Math.max(0, Short.parseShort(params[1]));
short spdjmp = params.length >= 3 ? (short) Math.max(0, Short.parseShort(params[2])) : 0;
MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();
MapleInventoryType type = ItemConstants.getInventoryType(itemid);
if (type.equals(MapleInventoryType.EQUIP)) {
Item it = ii.getEquipById(itemid);

View File

@@ -64,7 +64,7 @@ public class DebugCommand extends Command {
msgTypes += ("#L" + i + "#" + debugTypes[i] + "#l\r\n");
}
player.announce(MaplePacketCreator.getNPCTalk(9201143, (byte) 0, msgTypes, "00 00", (byte) 0));
c.getAbstractPlayerInteraction().npcTalk(9201143, msgTypes);
break;
case "monster":