From 7fcdc07b5b3f883da29619e094ba3f8ab401165a Mon Sep 17 00:00:00 2001 From: ronancpl Date: Sat, 20 May 2017 19:58:24 -0300 Subject: [PATCH] New mechanic: Jail + fixed mob book cover issues Added new mechanic: jail. Fixed missing card info reference about dropper mobs on the sql, reflecting into erros on the monster book. --- mychanges_ptbr.txt | 7 +- nbproject/private/private.xml | 20 +- scripts/portal/jail_in.js | 9 + scripts/portal/jail_out.js | 21 ++ sql/db_database.sql | 1 + sql/db_drops.sql | 25 +- src/client/MapleCharacter.java | 27 +- src/client/command/Commands.java | 309 +++++++++++++----- src/scripting/AbstractPlayerInteraction.java | 4 + src/scripting/event/EventManager.java | 10 +- src/server/TimerManager.java | 6 +- todo.txt | 3 + wz/Map.wz/Map/Map3/300000010.img.xml | 2 +- wz/Map.wz/Map/Map3/300000012.img.xml | 311 ++++++++++--------- 14 files changed, 494 insertions(+), 261 deletions(-) create mode 100644 scripts/portal/jail_in.js create mode 100644 scripts/portal/jail_out.js create mode 100644 todo.txt diff --git a/mychanges_ptbr.txt b/mychanges_ptbr.txt index af7c4aae9a..b75437ea50 100644 --- a/mychanges_ptbr.txt +++ b/mychanges_ptbr.txt @@ -229,4 +229,9 @@ Corre 18 - 19 Maio 2017, Implementação das mecânicas do Horntail (spawn e kill). -Correção de bugs em casos onde valores de EXP ganhos excedem o limite máximo de um inteiro de 32bits. \ No newline at end of file +Correção de bugs em casos onde valores de EXP ganhos excedem o limite máximo de um inteiro de 32bits. + +20 Maio 2017, +Adição: mecânica de cadeia para GMs. +Em conjunto com vcoc, adicionaram-se comandos: !clearslot, !hide/unhide, !jail, !itemvac e !healmap. +Correção de bug em tabela SQL que continha informação imcompleta para com alguns registros de cards e respectivos mobs. \ No newline at end of file diff --git a/nbproject/private/private.xml b/nbproject/private/private.xml index 3cdb87e887..5b109e707b 100644 --- a/nbproject/private/private.xml +++ b/nbproject/private/private.xml @@ -3,24 +3,12 @@ - file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/client/inventory/MaplePet.java - file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/server/partyquest/MonsterCarnival.java + file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/sql/tools/test_mobcarddrop.sql file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/client/command/Commands.java - file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/scripts/npc/world0/2013002.js - file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/constants/ServerConstants.java - file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/server/life/MapleMonster.java - file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/tools/MaplePacketCreator.java - file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/scripts/event/OrbisPQ.js - file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/net/MapleServerHandler.java - file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/scripts/event/LudiPQ.js - file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/net/server/channel/handlers/ScrollHandler.java - file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/net/server/channel/handlers/ItemRewardHandler.java - file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/net/server/channel/handlers/GeneralChatHandler.java - file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/server/MapleInventoryManipulator.java + file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/scripting/AbstractPlayerInteraction.java + file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/scripting/event/EventInstanceManager.java file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/client/MapleCharacter.java - file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/server/maps/MapleMap.java - file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/net/server/channel/handlers/PetLootHandler.java - file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/net/server/channel/handlers/ItemPickupHandler.java + file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/scripting/event/EventManager.java diff --git a/scripts/portal/jail_in.js b/scripts/portal/jail_in.js new file mode 100644 index 0000000000..7084b03d40 --- /dev/null +++ b/scripts/portal/jail_in.js @@ -0,0 +1,9 @@ +/** + * @author: Ronan + * @event: Jail - visit to jail :3 +*/ + +function enter(pi) { + pi.warp(300000012,0); + return(true); +} \ No newline at end of file diff --git a/scripts/portal/jail_out.js b/scripts/portal/jail_out.js new file mode 100644 index 0000000000..6e3adff30a --- /dev/null +++ b/scripts/portal/jail_out.js @@ -0,0 +1,21 @@ +/** + * @author: Ronan + * @event: Jail +*/ + +function enter(pi) { + var jailedTime = pi.getJailTimeLeft(); + + if(jailedTime <= 0) { + pi.warp(300000010,0); + return(true); + } + else { + var seconds = Math.floor(jailedTime / 1000) % 60 ; + var minutes = (Math.floor(jailedTime / (1000*60)) % 60); + var hours = (Math.floor(jailedTime / (1000*60*60)) % 24); + + pi.playerMessage(5, "You have been caught in bad behaviour by the Maple POLICE. You've got to stay here for " + hours + " hours " + minutes + " minutes " + seconds + " seconds yet."); + return(false); + } +} \ No newline at end of file diff --git a/sql/db_database.sql b/sql/db_database.sql index bf26ebb2d8..a06e7120f4 100644 --- a/sql/db_database.sql +++ b/sql/db_database.sql @@ -175,6 +175,7 @@ CREATE TABLE IF NOT EXISTS `characters` ( `dataString` varchar(64) NOT NULL DEFAULT '', `lastLogoutTime` timestamp NOT NULL DEFAULT '2015-01-01 05:00:00', `pendantExp` tinyint(1) NOT NULL DEFAULT '0', + `jailexpire` bigint(20) NOT NULL DEFAULT '0', PRIMARY KEY (`id`), KEY `accountid` (`accountid`), KEY `party` (`party`), diff --git a/sql/db_drops.sql b/sql/db_drops.sql index c643c4463f..e71b5bc94f 100644 --- a/sql/db_drops.sql +++ b/sql/db_drops.sql @@ -19015,11 +19015,14 @@ (9500319, 1422011, 1, 1, 0, 4000), (9500319, 1432046, 1, 1, 0, 4000), (9500319, 1332030, 1, 1, 0, 4000), -(9300188, 2388052, 1, 1, 0, 24000), -(9300196, 2388008, 1, 1, 0, 24000), -(9300204, 2388015, 1, 1, 0, 24000), -(9300207, 2388052, 1, 1, 0, 24000), -(9300209, 2388052, 1, 1, 0, 24000); +(9300188, 2388052, 1, 1, 0, 8000), +(9300196, 2388008, 1, 1, 0, 8000), +(9300204, 2388015, 1, 1, 0, 8000), +(9300201, 2388039, 1, 1, 0, 8000), +(9300206, 2388032, 1, 1, 0, 8000), +(9300207, 2388054, 1, 1, 0, 8000), +(9300209, 2388053, 1, 1, 0, 8000), +(9300215, 2388046, 1, 1, 0, 8000); # (dropperid, itemid, minqty, maxqty, questid, chance) @@ -19204,4 +19207,14 @@ (9102006, 4001099, 3, -1), (9102007, 4001100, 3, -1); - #global data already updated \ No newline at end of file + # updates info for all cards on monster book + DROP TABLE `monstercarddata`; + CREATE TABLE IF NOT EXISTS `monstercarddata` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `cardid` int(11) NOT NULL DEFAULT '0', + `mobid` int(11) NOT NULL DEFAULT '0', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE KEY `id` (`id`) + ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; + + INSERT INTO `monstercarddata` (`cardid`, `mobid`) (SELECT itemid, min(dropperid) FROM drop_data where itemid>=2380000 and itemid<2390000 group by itemid); \ No newline at end of file diff --git a/src/client/MapleCharacter.java b/src/client/MapleCharacter.java index f2fc599687..da578432bf 100644 --- a/src/client/MapleCharacter.java +++ b/src/client/MapleCharacter.java @@ -200,7 +200,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { private int expRate = 1, mesoRate = 1, dropRate = 1; private int omokwins, omokties, omoklosses, matchcardwins, matchcardties, matchcardlosses; private int married; - private long dojoFinish, lastfametime, lastUsedCashItem, lastHealed, lastMesoDrop = -1; + private long dojoFinish, lastfametime, lastUsedCashItem, lastHealed, lastMesoDrop = -1, jailExpiration = -1; private transient int localmaxhp, localmaxmp, localstr, localdex, localluk, localint_, magic, watk; private boolean hidden, canDoor = true, Berserk, hasMerchant, whiteChat = false; private int linkedLevel = 0; @@ -3183,6 +3183,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { ret.face = rs.getInt("face"); ret.accountid = rs.getInt("accountid"); ret.mapid = rs.getInt("map"); + ret.jailExpiration = rs.getLong("jailexpire"); ret.initialSpawnPoint = rs.getInt("spawnpoint"); ret.world = rs.getByte("world"); ret.rank = rs.getInt("rank"); @@ -4154,7 +4155,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { con.setTransactionIsolation(Connection.TRANSACTION_READ_UNCOMMITTED); con.setAutoCommit(false); PreparedStatement ps; - ps = con.prepareStatement("UPDATE characters SET level = ?, fame = ?, str = ?, dex = ?, luk = ?, `int` = ?, exp = ?, gachaexp = ?, hp = ?, mp = ?, maxhp = ?, maxmp = ?, sp = ?, ap = ?, gm = ?, skincolor = ?, gender = ?, job = ?, hair = ?, face = ?, map = ?, meso = ?, hpMpUsed = ?, spawnpoint = ?, party = ?, buddyCapacity = ?, messengerid = ?, messengerposition = ?, mountlevel = ?, mountexp = ?, mounttiredness= ?, equipslots = ?, useslots = ?, setupslots = ?, etcslots = ?, monsterbookcover = ?, vanquisherStage = ?, dojoPoints = ?, lastDojoStage = ?, finishedDojoTutorial = ?, vanquisherKills = ?, matchcardwins = ?, matchcardlosses = ?, matchcardties = ?, omokwins = ?, omoklosses = ?, omokties = ?, dataString = ?, fquest = ? WHERE id = ?", Statement.RETURN_GENERATED_KEYS); + ps = con.prepareStatement("UPDATE characters SET level = ?, fame = ?, str = ?, dex = ?, luk = ?, `int` = ?, exp = ?, gachaexp = ?, hp = ?, mp = ?, maxhp = ?, maxmp = ?, sp = ?, ap = ?, gm = ?, skincolor = ?, gender = ?, job = ?, hair = ?, face = ?, map = ?, meso = ?, hpMpUsed = ?, spawnpoint = ?, party = ?, buddyCapacity = ?, messengerid = ?, messengerposition = ?, mountlevel = ?, mountexp = ?, mounttiredness= ?, equipslots = ?, useslots = ?, setupslots = ?, etcslots = ?, monsterbookcover = ?, vanquisherStage = ?, dojoPoints = ?, lastDojoStage = ?, finishedDojoTutorial = ?, vanquisherKills = ?, matchcardwins = ?, matchcardlosses = ?, matchcardties = ?, omokwins = ?, omoklosses = ?, omokties = ?, dataString = ?, fquest = ?, jailexpire = ? WHERE id = ?", Statement.RETURN_GENERATED_KEYS); if (gmLevel < 1 && level > 199) { ps.setInt(1, isCygnus() ? 120 : 200); } else { @@ -4248,7 +4249,8 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { ps.setInt(47, omokties); ps.setString(48, dataString); ps.setInt(49, quest_fame); - ps.setInt(50, id); + ps.setLong(50, jailExpiration); + ps.setInt(51, id); int updateRows = ps.executeUpdate(); if (updateRows < 1) { @@ -5692,4 +5694,23 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { } return sp; } + + public long getJailExpirationTimeLeft() { + return jailExpiration - System.currentTimeMillis(); + } + + private void setFutureJailExpiration(long time) { + jailExpiration = System.currentTimeMillis() + time; + } + + public void addJailExpirationTime(long time) { + long timeLeft = getJailExpirationTimeLeft(); + + if(timeLeft <= 0) setFutureJailExpiration(time); + else setFutureJailExpiration(timeLeft + time); + } + + public void removeJailExpirationTime() { + jailExpiration = 0; + } } diff --git a/src/client/command/Commands.java b/src/client/command/Commands.java index 450deb835e..0ba82b6ed8 100644 --- a/src/client/command/Commands.java +++ b/src/client/command/Commands.java @@ -333,10 +333,10 @@ public class Commands { player.message("@uptime: Shows how long Solaxia has been online."); player.message("@bosshp: Displays the remaining HP of the bosses on your map."); if(ServerConstants.USE_DEBUG) { - player.message("@debugpos: Displays the coordinates on the map the player is currently located."); - player.message("@debugmap: Displays info about the current map the player is located."); - player.message("@debugevent: Displays the name of the event in which the player is currently registered."); - player.message("@debugreactors: Displays current info for all reactors on the map the the player is currently located."); + player.message("@debugpos: Displays the coordinates on the map the player is currently located."); + player.message("@debugmap: Displays info about the current map the player is located."); + player.message("@debugevent: Displays the name of the event in which the player is currently registered."); + player.message("@debugreactors: Displays current info for all reactors on the map the player is currently located."); } break; case "time": @@ -364,7 +364,7 @@ public class Commands { int seconds = (int) (milliseconds / 1000) % 60 ; int minutes = (int) ((milliseconds / (1000*60)) % 60); int hours = (int) ((milliseconds / (1000*60*60)) % 24); - int days = (int) ((milliseconds / (1000*60*60*24))); + int days = (int) ((milliseconds / (1000*60*60*24))); player.yellowMessage("Solaxia has been online for " + days + " days " + hours + " hours " + minutes + " minutes and " + seconds + " seconds."); break; case "gacha": @@ -554,8 +554,6 @@ public class Commands { break; */ case "joinevent": - case "event": - case "join": if(!FieldLimit.CHANGECHANNEL.check(player.getMap().getFieldLimit())) { MapleEvent event = c.getChannelServer().getEvent(); if(event != null) { @@ -583,7 +581,6 @@ public class Commands { } break; case "leaveevent": - case "leave": int returnMap = player.getSavedLocation("EVENT"); if(returnMap != -1) { if(player.getOla() != null) { @@ -685,7 +682,27 @@ public class Commands { MapleCharacter player = c.getPlayer(); Channel cserv = c.getChannelServer(); Server srv = Server.getInstance(); - if (sub[0].equals("ap")) { + + if (sub[0].equals("sp")) { + if (sub.length < 2){ + player.yellowMessage("Syntax: !sp [] "); + return true; + } + + if (sub.length == 2) { + player.setRemainingSp(Integer.parseInt(sub[1])); + player.updateSingleStat(MapleStat.AVAILABLESP, player.getRemainingSp()); + } else { + MapleCharacter victim = c.getChannelServer().getPlayerStorage().getCharacterByName(sub[1]); + victim.setRemainingSp(Integer.parseInt(sub[2])); + victim.updateSingleStat(MapleStat.AVAILABLESP, player.getRemainingSp()); + } + } else if (sub[0].equals("ap")) { + if (sub.length < 2){ + player.yellowMessage("Syntax: !ap [] "); + return true; + } + if (sub.length < 3) { player.setRemainingAp(Integer.parseInt(sub[1])); player.updateSingleStat(MapleStat.AVAILABLEAP, player.getRemainingAp()); @@ -702,7 +719,7 @@ public class Commands { } else if (sub[0].equals("spawn")) { if (sub.length < 2) { player.yellowMessage("Syntax: !spawn "); - return false; + return true; } MapleMonster monster = MapleLifeFactory.getMonster(Integer.parseInt(sub[1])); @@ -756,7 +773,7 @@ public class Commands { } else if (sub[0].equals("go")) { if (sub.length < 2){ player.yellowMessage("Syntax: !go "); - return false; + return true; } if (gotomaps.containsKey(sub[1])) { @@ -806,14 +823,14 @@ public class Commands { } else if (sub[0].equals("warp")) { if (sub.length < 2){ player.yellowMessage("Syntax: !warp "); - return false; + return true; } try { MapleMap target = c.getChannelServer().getMapFactory().getMap(Integer.parseInt(sub[1])); if (target == null) { player.yellowMessage("Map ID " + sub[1] + " is invalid."); - return false; + return true; } if (player.getEventInstance() != null) { player.getEventInstance().removePlayer(player); @@ -822,7 +839,7 @@ public class Commands { } catch (Exception ex) { ex.printStackTrace(); player.yellowMessage("Map ID " + sub[1] + " is invalid."); - return false; + return true; } } else if (sub[0].equals("reloadmap")) { MapleMap oldMap = c.getPlayer().getMap(); @@ -838,7 +855,7 @@ public class Commands { for (String s : songs){ player.yellowMessage(s); } - return false; + return true; } String song = joinStringFrom(sub, 1); for (String s : songs){ @@ -855,12 +872,12 @@ public class Commands { } else if (sub[0].equals("monitor")) { if (sub.length < 1){ player.yellowMessage("Syntax: !monitor "); - return false; + return true; } MapleCharacter victim = c.getWorldServer().getPlayerStorage().getCharacterByName(sub[1]); if (victim == null){ player.yellowMessage("Player not found!"); - return false; + return true; } boolean monitored = MapleLogger.monitored.contains(victim.getName()); if (monitored){ @@ -878,12 +895,12 @@ public class Commands { } else if (sub[0].equals("ignore")) { if (sub.length < 1){ player.yellowMessage("Syntax: !ignore "); - return false; + return true; } MapleCharacter victim = c.getWorldServer().getPlayerStorage().getCharacterByName(sub[1]); if (victim == null){ player.yellowMessage("Player not found!"); - return false; + return true; } boolean monitored = MapleLogger.ignored.contains(victim.getName()); if (monitored){ @@ -907,7 +924,7 @@ public class Commands { } else if (sub[0].equals("dc")) { if (sub.length < 2){ player.yellowMessage("Syntax: !dc "); - return false; + return true; } MapleCharacter victim = c.getWorldServer().getPlayerStorage().getCharacterByName(sub[1]); @@ -934,7 +951,7 @@ public class Commands { } else if (sub[0].equals("exprate")) { if (sub.length < 2){ player.yellowMessage("Syntax: !exprate "); - return false; + return true; } c.getWorldServer().setExpRate(Integer.parseInt(sub[1])); } else if (sub[0].equals("chat")) { @@ -943,7 +960,7 @@ public class Commands { } else if (sub[0].equals("warpto")) { if (sub.length < 2){ player.yellowMessage("Syntax: !warpto "); - return false; + return true; } MapleCharacter victim = cserv.getPlayerStorage().getCharacterByName(sub[1]); @@ -981,7 +998,7 @@ public class Commands { } else if (sub[0].equals("warphere")) { if (sub.length < 2){ player.yellowMessage("Syntax: !warphere "); - return false; + return true; } MapleCharacter victim = cserv.getPlayerStorage().getCharacterByName(sub[1]); @@ -1018,7 +1035,7 @@ public class Commands { } else if (sub[0].equals("fame")) { if (sub.length < 3){ player.yellowMessage("Syntax: !fame "); - return false; + return true; } MapleCharacter victim = cserv.getPlayerStorage().getCharacterByName(sub[1]); @@ -1027,7 +1044,7 @@ public class Commands { } else if (sub[0].equals("giftnx")) { if (sub.length < 3){ player.yellowMessage("Syntax: !giftnx "); - return false; + return true; } cserv.getPlayerStorage().getCharacterByName(sub[1]).getCashShop().gainCash(1, Integer.parseInt(sub[2])); player.message("Done"); @@ -1038,13 +1055,13 @@ public class Commands { } else if (sub[0].equals("vp")) { if (sub.length < 2){ player.yellowMessage("Syntax: !vp "); - return false; + return true; } c.addVotePoints(Integer.parseInt(sub[1])); } else if (sub[0].equals("id")) { if (sub.length < 2){ player.yellowMessage("Syntax: !id "); - return false; + return true; } try { try (BufferedReader dis = new BufferedReader(new InputStreamReader(new URL("http://www.mapletip.com/search_java.php?search_value=" + sub[1] + "&check=true").openConnection().getInputStream()))) { @@ -1059,7 +1076,7 @@ public class Commands { } else if (sub[0].equals("item") || sub[0].equals("drop")) { if (sub.length < 2){ player.yellowMessage("Syntax: !item "); - return false; + return true; } int itemId = Integer.parseInt(sub[1]); @@ -1110,7 +1127,7 @@ public class Commands { } else if (sub[0].equals("kill")) { if (sub.length < 2){ player.yellowMessage("Syntax: !kill "); - return false; + return true; } MapleCharacter victim = cserv.getPlayerStorage().getCharacterByName(sub[1]); @@ -1119,7 +1136,7 @@ public class Commands { } else if (sub[0].equals("seed")) { if (player.getMapId() != 910010000) { player.yellowMessage("This command can only be used in HPQ."); - return false; + return true; } Point pos[] = {new Point(7, -207), new Point(179, -447), new Point(-3, -687), new Point(-357, -687), new Point(-538, -447), new Point(-359, -207)}; int seed[] = {4001097, 4001096, 4001095, 4001100, 4001099, 4001098}; @@ -1154,7 +1171,7 @@ public class Commands { } else if (sub[0].equals("level")) { if (sub.length < 2){ player.yellowMessage("Syntax: !level "); - return false; + return true; } player.setLevel(Integer.parseInt(sub[1]) - 1); @@ -1163,7 +1180,7 @@ public class Commands { } else if (sub[0].equals("levelpro")) { if (sub.length < 2){ player.yellowMessage("Syntax: !levelpro "); - return false; + return true; } while (player.getLevel() < Math.min(255, Integer.parseInt(sub[1]))) { @@ -1206,7 +1223,7 @@ public class Commands { } else if (sub[0].equals("openportal")) { if (sub.length < 2){ player.yellowMessage("Syntax: !openportal "); - return false; + return true; } player.getMap().getPortal(sub[1]).setPortalState(true); } else if (sub[0].equals("pe")) { @@ -1220,7 +1237,7 @@ public class Commands { } catch (IOException ex) { ex.printStackTrace(); player.yellowMessage("Failed to load pe.txt"); - return false; + return true; } MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter(); mplew.write(HexTool.getByteArrayFromHexString(packet)); @@ -1229,25 +1246,20 @@ public class Commands { final MaplePacketHandler packetHandler = PacketProcessor.getProcessor(0, c.getChannel()).getHandler(packetId); if (packetHandler != null && packetHandler.validateState(c)) { try { - player.yellowMessage("Recieving: " + packet); + player.yellowMessage("Receiving: " + packet); packetHandler.handlePacket(slea, c); } catch (final Throwable t) { FilePrinter.printError(FilePrinter.PACKET_HANDLER + packetHandler.getClass().getName() + ".txt", t, "Error for " + (c.getPlayer() == null ? "" : "player ; " + c.getPlayer() + " on map ; " + c.getPlayer().getMapId() + " - ") + "account ; " + c.getAccountName() + "\r\n" + slea.toString()); - return false; + return true; } } } else if (sub[0].equals("closeportal")) { if (sub.length < 2){ player.yellowMessage("Syntax: !closeportal "); - return false; + return true; } player.getMap().getPortal(sub[1]).setPortalState(false); } else if (sub[0].equals("startevent")) { - for (MapleCharacter chr : player.getMap().getCharacters()) { - player.getMap().startEvent(chr); - } - c.getChannelServer().setEvent(null); - } else if (sub[0].equals("scheduleevent")) { int players = 50; if(sub.length > 1) players = Integer.parseInt(sub[1]); @@ -1278,7 +1290,7 @@ public class Commands { } else if (sub[0].equalsIgnoreCase("search")) { if (sub.length < 3){ player.yellowMessage("Syntax: !search "); - return false; + return true; } StringBuilder sb = new StringBuilder(); @@ -1347,7 +1359,7 @@ public class Commands { } else if (sub[0].equals("unban")) { if (sub.length < 2){ player.yellowMessage("Syntax: !unban "); - return false; + return true; } try { @@ -1371,7 +1383,7 @@ public class Commands { } else if (sub[0].equals("ban")) { if (sub.length < 3) { player.yellowMessage("Syntax: !ban (Please be descriptive)"); - return false; + return true; } String ign = sub[1]; String reason = joinStringFrom(sub, 2); @@ -1416,9 +1428,162 @@ public class Commands { } else { c.announce(MaplePacketCreator.getGMEffect(6, (byte) 1)); } + + } else if (sub[0].equals("jail")) { + if (sub.length < 2) { + player.yellowMessage("Syntax: !jail []"); + return true; + } + + int minutesJailed = 5; + if(sub.length >= 3) { + minutesJailed = Integer.valueOf(sub[2]); + if(minutesJailed <= 0) { + player.yellowMessage("Syntax: !jail []"); + return true; + } + } + + MapleCharacter victim = cserv.getPlayerStorage().getCharacterByName(sub[1]); + if (victim != null) { + victim.addJailExpirationTime(minutesJailed * 60 * 1000); + + int mapid = 300000012; + + if(victim.getMapId() != mapid) { // those gone to jail won't be changing map anyway + MapleMap target = cserv.getMapFactory().getMap(mapid); + MaplePortal targetPortal = target.getPortal(0); + victim.changeMap(target, targetPortal); + player.dropMessage(victim.getName() + " was jailed for " + minutesJailed + " minutes."); + } + else { + player.dropMessage(victim.getName() + "'s time in jail has been extended for " + minutesJailed + " minutes."); + } + + } else { + player.dropMessage(sub[1] + " not found on this channel! Make sure your target is logged on and on the same channel as yours."); + } + + } else if (sub[0].equals("unjail")) { + if (sub.length < 2) { + player.yellowMessage("Syntax: !unjail "); + return true; + } + + MapleCharacter victim = cserv.getPlayerStorage().getCharacterByName(sub[1]); + if (victim != null) { + if(victim.getJailExpirationTimeLeft() <= 0) { + player.dropMessage("This player is already free."); + return true; + } + victim.removeJailExpirationTime(); + victim.dropMessage("By lack of concrete proof you are now unjailed. Enjoy freedom!"); + player.dropMessage(victim.getName() + " was unjailed."); + } else { + player.dropMessage(sub[1] + " not found on this channel! Make sure your target is logged on and on the same channel as yours."); + } + } else if (sub[0].equals("clearslot")) { + if (sub.length < 2) { + player.yellowMessage("Syntax: !clearslot "); + return true; + } + String type = sub[1]; + if (type.equals("all")) { + for (int i = 0; i < 101; i++) { + 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); + } + 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); + } + 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); + } + 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); + } + 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); + } + player.yellowMessage("All Slots Cleared."); + } + else if (type.equals("equip")) { + for (int i = 0; i < 101; i++) { + 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); + } + player.yellowMessage("Equipment Slot Cleared."); + } + else if (type.equals("use")) { + 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); + } + player.yellowMessage("Use Slot Cleared."); + } + else if (type.equals("setup")) { + 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); + } + player.yellowMessage("Set-Up Slot Cleared."); + } + else if (type.equals("etc")) { + 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); + } + player.yellowMessage("ETC Slot Cleared."); + } + else if (type.equals("cash")) { + 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); + } + player.yellowMessage("Cash Slot Cleared."); + } + else player.yellowMessage("Slot" + type + " does not exist!"); + } else if (sub[0].equals("hide")) { + SkillFactory.getSkill(9101004).getEffect(SkillFactory.getSkill(9101004).getMaxLevel()).applyTo(player); + } else if (sub[0].equals("unhide")) { + SkillFactory.getSkill(9101004).getEffect(SkillFactory.getSkill(9101004).getMaxLevel()).applyTo(player); + + } else if (sub[0].equals("healmap")) { + for (MapleCharacter mch : player.getMap().getCharacters()) { + if (mch != null) { + mch.setHp(mch.getMaxHp()); + mch.updateSingleStat(MapleStat.HP, mch.getMaxHp()); + mch.setMp(mch.getMaxMp()); + mch.updateSingleStat(MapleStat.MP, mch.getMaxMp()); + } + } } else if (sub[0].equalsIgnoreCase("night")) { - player.getMap().broadcastNightEffect(); - player.yellowMessage("Done."); + player.getMap().broadcastNightEffect(); + player.yellowMessage("Done."); } else { return false; } @@ -1446,22 +1611,6 @@ public class Commands { player.getMap().spawnMonsterOnGroundBelow(MapleLifeFactory.getMonster(8820001), player.getPosition()); break; - case "sp": //Changed to support giving sp /a - if (sub.length < 2){ - player.yellowMessage("Syntax: !sp "); - return; - } - - if (sub.length == 2) { - player.setRemainingSp(Integer.parseInt(sub[1])); - player.updateSingleStat(MapleStat.AVAILABLESP, player.getRemainingSp()); - } else { - MapleCharacter victim = c.getChannelServer().getPlayerStorage().getCharacterByName(sub[1]); - victim.setRemainingSp(Integer.parseInt(sub[2])); - victim.updateSingleStat(MapleStat.AVAILABLESP, player.getRemainingSp()); - } - break; - case "packet": player.getMap().broadcastMessage(MaplePacketCreator.customPacket(joinStringFrom(sub, 1))); break; @@ -1617,18 +1766,28 @@ public class Commands { player.equipChanged(); } break; - case "itemvac": - List items = player.getMap().getMapObjectsInRange(player.getPosition(), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.ITEM)); - for (MapleMapObject item : items) { - MapleMapItem mapitem = (MapleMapItem) item; - if (!MapleInventoryManipulator.addFromDrop(c, mapitem.getItem(), true)) { - continue; - } - mapitem.setPickedUp(true); - player.getMap().broadcastMessage(MaplePacketCreator.removeItemFromMap(mapitem.getObjectId(), 2, player.getId()), mapitem.getPosition()); - player.getMap().removeMapObject(item); - } - break; + + case "itemvac": + List items = player.getMap().getMapObjectsInRange(player.getPosition(), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.ITEM)); + for (MapleMapObject item : items) { + MapleMapItem mapItem = (MapleMapItem) item; + if (mapItem.getMeso() > 0) { + player.gainMeso(mapItem.getMeso(), true); + } else if (mapItem.getItem().getItemId() >= 5000000 && mapItem.getItem().getItemId() <= 5000100) { + int petId = MaplePet.createPet(mapItem.getItem().getItemId()); + if (petId == -1) { + continue; + } + MapleInventoryManipulator.addById(c, mapItem.getItem().getItemId(), mapItem.getItem().getQuantity(), null, petId); + } else { + MapleInventoryManipulator.addFromDrop(c, mapItem.getItem(), true); + } + mapItem.setPickedUp(true); + player.getMap().removeMapObject(item); + player.getMap().broadcastMessage(MaplePacketCreator.removeItemFromMap(mapItem.getObjectId(), 2, player.getId()), mapItem.getPosition()); + } + break; + case "clearquestcache": MapleQuest.clearCache(); player.dropMessage(5, "Quest Cache Cleared."); diff --git a/src/scripting/AbstractPlayerInteraction.java b/src/scripting/AbstractPlayerInteraction.java index d4233e8752..8b662f81a8 100644 --- a/src/scripting/AbstractPlayerInteraction.java +++ b/src/scripting/AbstractPlayerInteraction.java @@ -829,4 +829,8 @@ public class AbstractPlayerInteraction { } return null; } + + public long getJailTimeLeft() { + return getPlayer().getJailExpirationTimeLeft(); + } } diff --git a/src/scripting/event/EventManager.java b/src/scripting/event/EventManager.java index 6ac3e53a1f..61d25bc41e 100644 --- a/src/scripting/event/EventManager.java +++ b/src/scripting/event/EventManager.java @@ -95,11 +95,13 @@ public class EventManager { private List getLobbyRange() { try { return convertToIntegerArray((List)iv.invokeFunction("setLobbyRange", (Object) null)); - } catch (ScriptException | NoSuchMethodException ex) { - ex.printStackTrace(); + } catch (ScriptException | NoSuchMethodException ex) { // they didn't define a lobby range + List defaultList = new ArrayList<>(); + defaultList.add(0); + defaultList.add(maxLobbys); + + return defaultList; } - - return new ArrayList<>(); } public void schedule(String methodName, long delay) { diff --git a/src/server/TimerManager.java b/src/server/TimerManager.java index e8c1fa0216..825a7f22d7 100644 --- a/src/server/TimerManager.java +++ b/src/server/TimerManager.java @@ -64,9 +64,9 @@ public class TimerManager implements TimerManagerMBean { }); //this is a no-no, it actually does nothing..then why the fuck are you doing it? stpe.setContinueExistingPeriodicTasksAfterShutdownPolicy(false); - stpe.setRemoveOnCancelPolicy(true); + stpe.setRemoveOnCancelPolicy(true); - stpe.setKeepAliveTime(5, TimeUnit.MINUTES); + stpe.setKeepAliveTime(5, TimeUnit.MINUTES); stpe.allowCoreThreadTimeOut(true); ses = stpe; @@ -143,7 +143,7 @@ public class TimerManager implements TimerManagerMBean { try { r.run(); } catch (Throwable t) { - FilePrinter.printError(FilePrinter.EXCEPTION_CAUGHT, t); + FilePrinter.printError(FilePrinter.EXCEPTION_CAUGHT, t); } } } diff --git a/todo.txt b/todo.txt new file mode 100644 index 0000000000..d0190a78d9 --- /dev/null +++ b/todo.txt @@ -0,0 +1,3 @@ +guild npc +PQs +scrolls for weather resistance \ No newline at end of file diff --git a/wz/Map.wz/Map/Map3/300000010.img.xml b/wz/Map.wz/Map/Map3/300000010.img.xml index b1672291aa..2214f196e5 100644 --- a/wz/Map.wz/Map/Map3/300000010.img.xml +++ b/wz/Map.wz/Map/Map3/300000010.img.xml @@ -1032,7 +1032,7 @@ - + diff --git a/wz/Map.wz/Map/Map3/300000012.img.xml b/wz/Map.wz/Map/Map3/300000012.img.xml index f8db06ada7..d261a3140e 100644 --- a/wz/Map.wz/Map/Map3/300000012.img.xml +++ b/wz/Map.wz/Map/Map3/300000012.img.xml @@ -1,261 +1,280 @@ - - - - - - - - + + + - - + + + + + + - - - - - - - - - - - - - - - - - - - - - - + + - - + + - - + + + + + + + + - - - - - + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + - - + + - - + + - - + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -269,8 +288,6 @@ - - @@ -282,16 +299,6 @@ - - - - - - - - - - - +