diff --git a/README.md b/README.md index 8d61e7bdec..d1f32ddfde 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,11 @@ Server files: https://github.com/ronancpl/MapleSolaxiaV2 Client files & general tools: https://drive.google.com/drive/folders/0BzDsHSr-0V4MYVJ0TWIxd05hYUk +--- +### Donation + +If you liked what you have seen on the project, donate a little something as a helping hand for my contributions towards Maple development. Paypal: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=3K8KVTWRLFBQ4 + --- ### Preparing the ambient diff --git a/build/built-jar.properties b/build/built-jar.properties index 97d4b3bb11..1dddac2c40 100644 --- a/build/built-jar.properties +++ b/build/built-jar.properties @@ -1,4 +1,4 @@ -#Fri, 22 Sep 2017 22:54:29 -0300 +#Mon, 25 Sep 2017 01:46:09 -0300 C\:\\Nexon\\MapleSolaxia\\MapleSolaxiaV2= diff --git a/build/classes/client/MapleCharacter$10.class b/build/classes/client/MapleCharacter$10.class index 33432b11f3..11c1d8ea58 100644 Binary files a/build/classes/client/MapleCharacter$10.class and b/build/classes/client/MapleCharacter$10.class differ diff --git a/build/classes/client/MapleCharacter$11.class b/build/classes/client/MapleCharacter$11.class index fe68aa78ed..712368a6e7 100644 Binary files a/build/classes/client/MapleCharacter$11.class and b/build/classes/client/MapleCharacter$11.class differ diff --git a/build/classes/client/MapleCharacter$12.class b/build/classes/client/MapleCharacter$12.class index eac9124ab2..e736acf9ee 100644 Binary files a/build/classes/client/MapleCharacter$12.class and b/build/classes/client/MapleCharacter$12.class differ diff --git a/build/classes/client/MapleCharacter$13.class b/build/classes/client/MapleCharacter$13.class index ba51739ce6..34bde9a6aa 100644 Binary files a/build/classes/client/MapleCharacter$13.class and b/build/classes/client/MapleCharacter$13.class differ diff --git a/build/classes/client/MapleCharacter$14.class b/build/classes/client/MapleCharacter$14.class index 107706bc0d..6037fe54ff 100644 Binary files a/build/classes/client/MapleCharacter$14.class and b/build/classes/client/MapleCharacter$14.class differ diff --git a/build/classes/client/MapleCharacter$15.class b/build/classes/client/MapleCharacter$15.class index 4ec8b8244d..db05f3875a 100644 Binary files a/build/classes/client/MapleCharacter$15.class and b/build/classes/client/MapleCharacter$15.class differ diff --git a/build/classes/client/MapleCharacter$16.class b/build/classes/client/MapleCharacter$16.class index 327c2ee63f..62129b955a 100644 Binary files a/build/classes/client/MapleCharacter$16.class and b/build/classes/client/MapleCharacter$16.class differ diff --git a/build/classes/client/MapleCharacter$17.class b/build/classes/client/MapleCharacter$17.class index 2b8a47aac8..0430f5e907 100644 Binary files a/build/classes/client/MapleCharacter$17.class and b/build/classes/client/MapleCharacter$17.class differ diff --git a/build/classes/client/MapleCharacter$18.class b/build/classes/client/MapleCharacter$18.class index 54d09a5f62..28b558a69e 100644 Binary files a/build/classes/client/MapleCharacter$18.class and b/build/classes/client/MapleCharacter$18.class differ diff --git a/build/classes/client/MapleCharacter$19.class b/build/classes/client/MapleCharacter$19.class index 45ca22d28f..b66acd2e28 100644 Binary files a/build/classes/client/MapleCharacter$19.class and b/build/classes/client/MapleCharacter$19.class differ diff --git a/build/classes/client/MapleCharacter$8.class b/build/classes/client/MapleCharacter$8.class index 0f6a7b9c6c..64197dcb4e 100644 Binary files a/build/classes/client/MapleCharacter$8.class and b/build/classes/client/MapleCharacter$8.class differ diff --git a/build/classes/client/MapleCharacter$9.class b/build/classes/client/MapleCharacter$9.class index c80c364596..675644a5d1 100644 Binary files a/build/classes/client/MapleCharacter$9.class and b/build/classes/client/MapleCharacter$9.class differ diff --git a/build/classes/client/MapleCharacter$FameStatus.class b/build/classes/client/MapleCharacter$FameStatus.class index fc4f8449fd..6c5ff192ab 100644 Binary files a/build/classes/client/MapleCharacter$FameStatus.class and b/build/classes/client/MapleCharacter$FameStatus.class differ diff --git a/build/classes/client/MapleCharacter$MapleBuffStatValueHolder.class b/build/classes/client/MapleCharacter$MapleBuffStatValueHolder.class index b845865855..8b4b8c77f7 100644 Binary files a/build/classes/client/MapleCharacter$MapleBuffStatValueHolder.class and b/build/classes/client/MapleCharacter$MapleBuffStatValueHolder.class differ diff --git a/build/classes/client/MapleCharacter$MapleCoolDownValueHolder.class b/build/classes/client/MapleCharacter$MapleCoolDownValueHolder.class index 5418701729..65e9a34750 100644 Binary files a/build/classes/client/MapleCharacter$MapleCoolDownValueHolder.class and b/build/classes/client/MapleCharacter$MapleCoolDownValueHolder.class differ diff --git a/build/classes/client/MapleCharacter$SkillEntry.class b/build/classes/client/MapleCharacter$SkillEntry.class index e0de687972..40d7d03d26 100644 Binary files a/build/classes/client/MapleCharacter$SkillEntry.class and b/build/classes/client/MapleCharacter$SkillEntry.class differ diff --git a/build/classes/client/MapleCharacter.class b/build/classes/client/MapleCharacter.class index 58646fa7da..d5e8d6a729 100644 Binary files a/build/classes/client/MapleCharacter.class and b/build/classes/client/MapleCharacter.class differ diff --git a/build/classes/constants/ServerConstants.class b/build/classes/constants/ServerConstants.class index b695a8ccb4..458e585da8 100644 Binary files a/build/classes/constants/ServerConstants.class and b/build/classes/constants/ServerConstants.class differ diff --git a/build/classes/net/PacketProcessor.class b/build/classes/net/PacketProcessor.class index 79104552cb..46a4fd0c17 100644 Binary files a/build/classes/net/PacketProcessor.class and b/build/classes/net/PacketProcessor.class differ diff --git a/build/classes/net/RecvOpcode.class b/build/classes/net/RecvOpcode.class index 1c01a6c05b..359d312767 100644 Binary files a/build/classes/net/RecvOpcode.class and b/build/classes/net/RecvOpcode.class differ diff --git a/build/classes/net/server/PlayerBuffValueHolder.class b/build/classes/net/server/PlayerBuffValueHolder.class index b01b5f3f30..e912b997e7 100644 Binary files a/build/classes/net/server/PlayerBuffValueHolder.class and b/build/classes/net/server/PlayerBuffValueHolder.class differ diff --git a/build/classes/net/server/channel/handlers/CancelBuffHandler.class b/build/classes/net/server/channel/handlers/CancelBuffHandler.class index 2fe33a80ef..bf8fba2205 100644 Binary files a/build/classes/net/server/channel/handlers/CancelBuffHandler.class and b/build/classes/net/server/channel/handlers/CancelBuffHandler.class differ diff --git a/build/classes/net/server/channel/handlers/PlayerLoggedinHandler.class b/build/classes/net/server/channel/handlers/PlayerLoggedinHandler.class index 98843c7969..6081003ad5 100644 Binary files a/build/classes/net/server/channel/handlers/PlayerLoggedinHandler.class and b/build/classes/net/server/channel/handlers/PlayerLoggedinHandler.class differ diff --git a/build/classes/scripting/AbstractPlayerInteraction.class b/build/classes/scripting/AbstractPlayerInteraction.class index 1ddd19f93d..a05872ab41 100644 Binary files a/build/classes/scripting/AbstractPlayerInteraction.class and b/build/classes/scripting/AbstractPlayerInteraction.class differ diff --git a/build/classes/server/MapleStatEffect.class b/build/classes/server/MapleStatEffect.class index 7ddf2b4401..208c597db7 100644 Binary files a/build/classes/server/MapleStatEffect.class and b/build/classes/server/MapleStatEffect.class differ diff --git a/dist/MapleSolaxia.jar b/dist/MapleSolaxia.jar index 9180dfd114..a0c8db00ee 100644 Binary files a/dist/MapleSolaxia.jar and b/dist/MapleSolaxia.jar differ diff --git a/docs/feature_list.txt b/docs/feature_list.txt index 44e270d5a3..145f6b6f7c 100644 --- a/docs/feature_list.txt +++ b/docs/feature_list.txt @@ -32,7 +32,7 @@ Quests: * Quests can now reward properly items when matching a reward item with the player's job. * Loads of quests have been patched. * Quest rewards according to jobs works properly. -* Rewarding system now checks for stacking opportunities on the inventory before checking for new slots. +* Enchanced rewarding system: checks for stacking opportunities on the inventory before checking for new slots. Player Social Network: * Guild and Alliance system fully functional. @@ -60,6 +60,7 @@ Server potentials: * Mastery book announcer displays droppers of needed books of a player, by reading underlying DB. * Every skill/mastery book is now droppable by mobs. * Inventory auto-gather and auto-sorting feature. +* Enhanced buff system: smartly checks for the best available buff effects to be active on the player. * Enhanced AP auto-assigner: exactly matches AP with the needed for the player's current level, surplus assigned to the primary attribute. * Added Boss HP Bar for dozens of bosses (needs provided custom wz). * If multiple bosses are on the same area, client will prioritize Boss HP bar of the target of the player. diff --git a/docs/mychanges_ptbr.txt b/docs/mychanges_ptbr.txt index 9706d57611..52b8e10045 100644 --- a/docs/mychanges_ptbr.txt +++ b/docs/mychanges_ptbr.txt @@ -545,4 +545,8 @@ Completamente reestruturado sistema de buffs. Nova flag permite perman 22 Setembro 2017, Adicionado buffs para GPQ. -Consertado GPQ não iniciando devido a problemas com o script de evento. \ No newline at end of file +Consertado GPQ não iniciando devido a problemas com o script de evento. + +23 Setembro 2017, +Adicionado Water of Life. +Consertado bug com sistema novo de buffs ao entrar no cash shop e em outros cenários onde não se detectava o melhor buff corretamente. \ No newline at end of file diff --git a/nbproject/private/private.xml b/nbproject/private/private.xml index d7ec061093..5af0ed1acc 100644 --- a/nbproject/private/private.xml +++ b/nbproject/private/private.xml @@ -2,14 +2,6 @@ - - file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/scripts/event/GuildQuest.js - file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/scripts/npc/9040000.js - 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/scripting/event/EventManager.java - file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/scripts/npc/1052013.js - file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/scripts/event/AmoriaPQ.js - + diff --git a/scripts/event/GuildQuest.js b/scripts/event/GuildQuest.js index 7f14f72a86..628c566701 100644 --- a/scripts/event/GuildQuest.js +++ b/scripts/event/GuildQuest.js @@ -25,7 +25,7 @@ */ var isPq = true; -var minPlayers = 1, maxPlayers = 30; +var minPlayers = 6, maxPlayers = 30; var minLevel = 1, maxLevel = 255; var entryMap = 990000000; var exitMap = 990001100; @@ -201,10 +201,10 @@ function scheduledTimeout(eim) { } else { eim.startEventTimer(eventTime * 60000); - //if(isTeamAllJobs(eim)) { + if(isTeamAllJobs(eim)) { var rnd = Math.floor(Math.random() * 4); eim.applyEventPlayersItemBuff(2023000 + rnd); - //} + } } } else { end(eim); diff --git a/scripts/npc/1032102.js b/scripts/npc/1032102.js index b443326afa..c08fe6fa6f 100644 --- a/scripts/npc/1032102.js +++ b/scripts/npc/1032102.js @@ -104,7 +104,7 @@ function action(mode, type, selection) { } } else if (status == 2) { if (selection == 0) { - MapleInventoryManipulator.removeFromSlot(cm.getC(), MapleInventoryType.CASH, 1, 1, true); + MapleInventoryManipulator.removeFromSlot(cm.getClient(), MapleInventoryType.CASH, 1, 1, true); cm.sendOk("Your cash first slot is removed."); } else if (selection == 1) { if (cm.haveItem(5000029, 2)) { diff --git a/scripts/npc/waterOfLife.js b/scripts/npc/waterOfLife.js new file mode 100644 index 0000000000..b687e9ead0 --- /dev/null +++ b/scripts/npc/waterOfLife.js @@ -0,0 +1,95 @@ +/* + This file is part of the OdinMS Maple Story Server + Copyright (C) 2008 Patrick Huy + Matthias Butz + Jan Christian Meyer + + 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 . +*/ +/* Mar the Fairy + Handles Water of Life + */ + +importPackage(Packages.client.inventory); +importPackage(Packages.server); + +var status; +var dList; + +function start() { + status = -1; + dList = cm.getDriedPets(); + if(dList.size() == 0) { + cm.playerMessage(5, "You currently do not own a pet that needs to be treated with Water of Life."); + cm.dispose(); + return; + } + + action(1, 0, 0); +} + +function action(mode, type, selection) { + if (mode == -1) { + cm.dispose(); + } else { + if (mode == 0 && type > 0) { + cm.dispose(); + return; + } + if (mode == 1) + status++; + else + status--; + + if (status == 0) { + cm.sendYesNo("I am Mar the Fairy. You have the #bWater of Life#k... With this, I can bring a doll back to life with my magic. What do you think? Do you want to use this item and reawaken your pet ...?"); + + } else if (status == 1) { + var talkStr = "So which pet you want to reawaken? Please choose the pet you'd most like to reawaken...\r\n\r\n"; + + var listStr = ""; + var i = 0; + + var dIter = dList.iterator(); + while (dIter.hasNext()){ + var dPet = dIter.next(); + + listStr += "#b#L" + i + "# " + dPet.getName() + " #k - Lv " + dPet.getLevel() + " Closeness " + dPet.getCloseness(); + listStr += "#l\r\n"; + + i++; + } + + cm.sendSimple(talkStr + listStr); + } else if (status == 2) { + var sPet = dList.get(selection); + + if(sPet != null) { + cm.sendNext("Your doll has now reawaken as your pet! However, my magic isn't perfect, so I can't promise an eternal life for your pet... Please take care of that pet before the Water of Life dries. Well then, good bye..."); + + var it = cm.getPlayer().getInventory(MapleInventoryType.CASH).getItem(sPet.getPosition()); + it.setExpiration(Date.now() + (1000 * 60 * 60 * 24 * 90)); + cm.getPlayer().forceUpdateItem(it); + + cm.gainItem(5180000, -1); + } else { + cm.sendNext("Oh, well then. Good bye..."); + } + + cm.dispose(); + } + } +} \ No newline at end of file diff --git a/scripts/quest/8185.js b/scripts/quest/8185.js index f3629d5ae7..b9f949b68d 100644 --- a/scripts/quest/8185.js +++ b/scripts/quest/8185.js @@ -92,7 +92,7 @@ function end(mode, type, selection) { name = MapleItemInformationProvider.getInstance().getName(after); } */ - //qm.unequipPet(qm.getC()); + //qm.unequipPet(qm.getClient()); qm.gainItem(5380000, -1); qm.gainMeso(-10000); qm.evolvePet(i, after); diff --git a/sql/db_drops.sql b/sql/db_drops.sql index 90a1157b74..e9cb6eec55 100644 --- a/sql/db_drops.sql +++ b/sql/db_drops.sql @@ -19820,6 +19820,15 @@ USE `maplesolaxia`; (9420501, 1492005, 1, 1, 0, 2000), (8820001, 2388043, 1, 1, 0, 24000); + # zhelms, pink bean customs + DELETE FROM temp_data WHERE itemid=1002357; + INSERT IGNORE INTO temp_data (`dropperid`, `itemid`, `minimum_quantity`, `maximum_quantity`, `questid`, `chance`) VALUES +(8800002, 1002357, 1, 1, 0, 300000), +(8800002, 1002390, 1, 1, 0, 80000), +(8800002, 1002430, 1, 1, 0, 40000), +(8820001, 1002971, 1, 1, 0, 80000), +(8820001, 1052202, 1, 1, 0, 80000); + # delete item drops from bosses in inactive form DELETE FROM temp_data WHERE dropperid=4220001; DELETE FROM temp_data WHERE dropperid=5220001; diff --git a/src/client/MapleCharacter.java b/src/client/MapleCharacter.java index 12374a35b5..909e01a0d1 100644 --- a/src/client/MapleCharacter.java +++ b/src/client/MapleCharacter.java @@ -151,11 +151,12 @@ import scripting.item.ItemScriptManager; import server.maps.MapleMapItem; public class MapleCharacter extends AbstractAnimatedMapleMapObject { + private static NumberFormat nf = new DecimalFormat("#,###,###,###"); private static final String LEVEL_200 = "[Congrats] %s has reached Level 200! Congratulate %s on such an amazing achievement!"; - private static final String[] BLOCKED_NAMES = {"admin", "owner", "moderator", "intern", "donor", "administrator", "help", "helper", "alert", "notice", "maplestory", "Solaxia", "fuck", "wizet", "fucking", "negro", "fuk", "fuc", "penis", "pussy", "asshole", "gay", "nigger", "homo", "suck", "cum", "shit", "shitty", "condom", "security", "official", "rape", "nigga", "sex", "tit", "boner", "orgy", "clit", "asshole", "fatass", "bitch", "support", "gamemaster", "cock", "gaay", "gm", "operate", "master", "sysop", "party", "GameMaster", "community", "message", "event", "test", "meso", "Scania", "renewal", "yata", "AsiaSoft", "henesys"}; + private int world; private int accountid, id; private int rank, rankMove, jobRank, jobRankMove; @@ -260,7 +261,6 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { private Lock chrLock = new ReentrantLock(); private Lock effLock = new ReentrantLock(); private Lock petLock = new ReentrantLock(); - private NumberFormat nf = new DecimalFormat("#,###,###,###"); private Map> excluded = new LinkedHashMap<>(); private Set excludedItems = new LinkedHashSet<>(); private List crushRings = new ArrayList<>(); @@ -2095,22 +2095,26 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { @Override public void run() { Set> es; + List toCancel = new ArrayList<>(); effLock.lock(); chrLock.lock(); try { es = new LinkedHashSet<>(buffExpires.entrySet()); + + long curTime = System.currentTimeMillis(); + for(Entry bel : es) { + if(curTime >= bel.getValue()) { + toCancel.add(buffEffects.get(bel.getKey()).entrySet().iterator().next().getValue()); //rofl + } + } } finally { chrLock.unlock(); effLock.unlock(); } - long curTime = System.currentTimeMillis(); - for(Entry bel : es) { - if(curTime >= bel.getValue()) { - MapleBuffStatValueHolder mbsvh = buffEffects.get(bel.getKey()).entrySet().iterator().next().getValue(); // rofl - cancelEffect(mbsvh.effect, false, mbsvh.startTime); - } + for(MapleBuffStatValueHolder mbsvh : toCancel) { + cancelEffect(mbsvh.effect, false, mbsvh.startTime); } } }, 1500); @@ -2181,6 +2185,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { for (MapleInventory inv : inventory) { for (Item item : inv.list()) { expiration = item.getExpiration(); + if (expiration != -1 && (expiration < currenttime) && ((item.getFlag() & ItemConstants.LOCK) == ItemConstants.LOCK)) { byte aids = item.getFlag(); aids &= ~(ItemConstants.LOCK); @@ -2188,10 +2193,15 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { item.setExpiration(-1); forceUpdateItem(item); //TEST :3 } else if (expiration != -1 && expiration < currenttime) { - client.announce(MaplePacketCreator.itemExpired(item.getItemId())); - toberemove.add(item); - if(ItemConstants.isRateCoupon(item.getItemId())) { - deletedCoupon = true; + if(!ItemConstants.isPet(item.getItemId()) || ServerConstants.USE_ERASE_PET_ON_EXPIRATION) { + client.announce(MaplePacketCreator.itemExpired(item.getItemId())); + toberemove.add(item); + if(ItemConstants.isRateCoupon(item.getItemId())) { + deletedCoupon = true; + } + } else { + item.setExpiration(-1); + forceUpdateItem(item); } } } @@ -2472,7 +2482,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { effLock.lock(); chrLock.lock(); try { - return buffEffects.keySet(); + return new LinkedHashSet<>(buffEffects.keySet()); } finally { chrLock.unlock(); effLock.unlock(); @@ -2500,12 +2510,14 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { effLock.lock(); chrLock.lock(); try { + long curtime = System.currentTimeMillis(); + Map ret = new LinkedHashMap<>(); for(Map bel : buffEffects.values()) { for(MapleBuffStatValueHolder mbsvh : bel.values()) { int srcid = mbsvh.effect.getBuffSourceId(); if(!ret.containsKey(srcid)) { - ret.put(srcid, new PlayerBuffValueHolder(mbsvh.startTime, mbsvh.effect)); + ret.put(srcid, new PlayerBuffValueHolder((int)(curtime - mbsvh.startTime), mbsvh.effect)); } } } @@ -2826,16 +2838,32 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { chrLock.lock(); try { Map> retrievedEffects = new LinkedHashMap<>(); + Map> maxStatups = new LinkedHashMap<>(); for(Entry> bel : buffEffects.entrySet()) { for(Entry belv : bel.getValue().entrySet()) { if(removedStats.contains(belv.getKey())) { - retrievedEffects.put(bel.getKey(), new Pair<>(belv.getValue().effect, belv.getValue().startTime)); + if(!retrievedEffects.containsKey(bel.getKey())) { + retrievedEffects.put(bel.getKey(), new Pair<>(belv.getValue().effect, belv.getValue().startTime)); + } + + Pair thisStat = maxStatups.get(belv.getKey()); + if(thisStat == null || belv.getValue().value > thisStat.getRight()) { + maxStatups.put(belv.getKey(), new Pair<>(bel.getKey(), belv.getValue().value)); + } } } } - for(Entry> lmse: retrievedEffects.entrySet()) { + Map> bestEffects = new LinkedHashMap<>(); + for(Entry> lmse: maxStatups.entrySet()) { + Integer srcid = lmse.getValue().getLeft(); + if(!bestEffects.containsKey(srcid)) { + bestEffects.put(srcid, retrievedEffects.get(srcid)); + } + } + + for(Entry> lmse: bestEffects.entrySet()) { lmse.getValue().getLeft().updateBuffEffect(this, getActiveStatupsFromSourceid(lmse.getKey()), lmse.getValue().getRight()); } } finally { @@ -6933,9 +6961,10 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject { setHp(getHp(), true); } - public void silentGiveBuffs(List buffs) { - for (PlayerBuffValueHolder mbsvh : buffs) { - mbsvh.effect.silentApplyBuff(this, mbsvh.startTime); + public void silentGiveBuffs(List> buffs) { + for (Pair mbsv : buffs) { + PlayerBuffValueHolder mbsvh = mbsv.getRight(); + mbsvh.effect.silentApplyBuff(this, mbsv.getLeft()); } } diff --git a/src/constants/ServerConstants.java b/src/constants/ServerConstants.java index bd24572cbf..2798aaaa0d 100644 --- a/src/constants/ServerConstants.java +++ b/src/constants/ServerConstants.java @@ -49,6 +49,7 @@ public class ServerConstants { public static final boolean USE_REFRESH_RANK_MOVE = true; public static final boolean USE_ENFORCE_MDOOR_POSITION = true; //Forces mystic door to be spawned near spawnpoints. (since things bugs out other way, and this helps players to locate the door faster) public static final boolean USE_ERASE_UNTRADEABLE_DROP = true; //Forces flagged untradeable items to disappear when dropped. + public static final boolean USE_ERASE_PET_ON_EXPIRATION = false;//Forces pets to be removed from inventory when expire time comes, rather than converting it to a doll. public static final boolean USE_BUFF_MOST_SIGNIFICANT = true; //When applying buffs, the player will stick with the highest stat boost among the listed, rather than overwriting stats. //Server Rates And Experience diff --git a/src/net/PacketProcessor.java b/src/net/PacketProcessor.java index feed421137..1bdb882c8d 100644 --- a/src/net/PacketProcessor.java +++ b/src/net/PacketProcessor.java @@ -245,6 +245,7 @@ public final class PacketProcessor { registerHandler(RecvOpcode.MONSTER_CARNIVAL, new MonsterCarnivalHandler()); registerHandler(RecvOpcode.REMOTE_STORE, new RemoteStoreHandler()); registerHandler(RecvOpcode.WEDDING_ACTION, new WeddingHandler()); + registerHandler(RecvOpcode.WATER_OF_LIFE, new UseWaterOfLifeHandler()); registerHandler(RecvOpcode.ADMIN_CHAT, new AdminChatHandler()); registerHandler(RecvOpcode.MOVE_DRAGON, new MoveDragonHandler()); } diff --git a/src/net/RecvOpcode.java b/src/net/RecvOpcode.java index 97311eb842..46aadc06e0 100644 --- a/src/net/RecvOpcode.java +++ b/src/net/RecvOpcode.java @@ -116,6 +116,7 @@ public enum RecvOpcode { USE_ITEM_REWARD(0x70), MAKER_SKILL(0x71), USE_REMOTE(0x74), + WATER_OF_LIFE(0x75), ADMIN_CHAT(0x76), PARTYCHAT(0x77), WHISPER(0x78), diff --git a/src/net/server/PlayerBuffValueHolder.java b/src/net/server/PlayerBuffValueHolder.java index b0892f0a62..af5874971c 100644 --- a/src/net/server/PlayerBuffValueHolder.java +++ b/src/net/server/PlayerBuffValueHolder.java @@ -28,11 +28,11 @@ import server.MapleStatEffect; * @author Danny */ public class PlayerBuffValueHolder { - public long startTime; + public int usedTime; public MapleStatEffect effect; - public PlayerBuffValueHolder(long startTime, MapleStatEffect effect) { - this.startTime = startTime; + public PlayerBuffValueHolder(int usedTime, MapleStatEffect effect) { + this.usedTime = usedTime; this.effect = effect; } } diff --git a/src/net/server/channel/handlers/CancelBuffHandler.java b/src/net/server/channel/handlers/CancelBuffHandler.java index 9671895cf7..23c421e59d 100644 --- a/src/net/server/channel/handlers/CancelBuffHandler.java +++ b/src/net/server/channel/handlers/CancelBuffHandler.java @@ -41,7 +41,6 @@ public final class CancelBuffHandler extends AbstractMaplePacketHandler implemen @Override public final void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) { int sourceid = slea.readInt(); - if(sourceid < 0) sourceid = -sourceid; //oh my... switch (sourceid) { case FPArchMage.BIG_BANG: diff --git a/src/net/server/channel/handlers/PlayerLoggedinHandler.java b/src/net/server/channel/handlers/PlayerLoggedinHandler.java index b82e96612d..6bdddcd606 100644 --- a/src/net/server/channel/handlers/PlayerLoggedinHandler.java +++ b/src/net/server/channel/handlers/PlayerLoggedinHandler.java @@ -25,6 +25,7 @@ import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; +import java.util.ArrayList; import java.util.List; import net.AbstractMaplePacketHandler; @@ -39,9 +40,11 @@ import net.server.world.PartyOperation; import net.server.world.World; import tools.DatabaseConnection; import tools.MaplePacketCreator; +import tools.Pair; import tools.data.input.SeekableLittleEndianAccessor; import client.BuddylistEntry; import client.CharacterNameAndId; +import client.MapleBuffStat; import client.MapleCharacter; import client.MapleClient; import client.MapleFamily; @@ -50,6 +53,8 @@ import client.inventory.MapleInventoryType; import client.inventory.MaplePet; import constants.GameConstants; import constants.ServerConstants; +import java.util.Collections; +import java.util.Comparator; public final class PlayerLoggedinHandler extends AbstractMaplePacketHandler { @@ -107,7 +112,8 @@ public final class PlayerLoggedinHandler extends AbstractMaplePacketHandler { List buffs = server.getPlayerBuffStorage().getBuffsFromStorage(cid); if (buffs != null) { - player.silentGiveBuffs(buffs); + List> timedBuffs = getLocalStartTimes(buffs); + player.silentGiveBuffs(timedBuffs); } Connection con = null; PreparedStatement ps = null; @@ -286,4 +292,22 @@ public final class PlayerLoggedinHandler extends AbstractMaplePacketHandler { player.receivePartyMemberHP(); } + + private List> getLocalStartTimes(List lpbvl) { + List> timedBuffs = new ArrayList<>(); + long curtime = System.currentTimeMillis(); + + for(PlayerBuffValueHolder pb : lpbvl) { + timedBuffs.add(new Pair<>(curtime - pb.usedTime, pb)); + } + + Collections.sort(timedBuffs, new Comparator>() { + @Override + public int compare(Pair p1, Pair p2) { + return p1.getLeft().compareTo(p2.getLeft()); + } + }); + + return timedBuffs; + } } diff --git a/src/net/server/channel/handlers/UseWaterOfLifeHandler.java b/src/net/server/channel/handlers/UseWaterOfLifeHandler.java new file mode 100644 index 0000000000..49439db7d6 --- /dev/null +++ b/src/net/server/channel/handlers/UseWaterOfLifeHandler.java @@ -0,0 +1,34 @@ +/* + This file is part of the OdinMS Maple Story Server + Copyright (C) 2008 Patrick Huy + Matthias Butz + Jan Christian Meyer + + 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 . + */ +package net.server.channel.handlers; + +import client.MapleClient; +import net.AbstractMaplePacketHandler; +import tools.data.input.SeekableLittleEndianAccessor; + +public final class UseWaterOfLifeHandler extends AbstractMaplePacketHandler { + + @Override + public final void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) { + c.getAbstractPlayerInteraction().openNpc(1032102, "waterOfLife"); + } +} \ No newline at end of file diff --git a/src/scripting/AbstractPlayerInteraction.java b/src/scripting/AbstractPlayerInteraction.java index 753faa3d76..833994943b 100644 --- a/src/scripting/AbstractPlayerInteraction.java +++ b/src/scripting/AbstractPlayerInteraction.java @@ -901,4 +901,21 @@ public class AbstractPlayerInteraction { public long getJailTimeLeft() { return getPlayer().getJailExpirationTimeLeft(); } + + public List getDriedPets() { + List list = new LinkedList<>(); + + long curTime = System.currentTimeMillis(); + for(Item it : getPlayer().getInventory(MapleInventoryType.CASH).list()) { + if(ItemConstants.isPet(it.getItemId()) && it.getExpiration() < curTime) { + MaplePet pet = it.getPet(); + if (pet != null) { + list.add(pet); + } + } + } + + return list; + } + } diff --git a/src/server/MapleStatEffect.java b/src/server/MapleStatEffect.java index f184100895..31903ab2f7 100644 --- a/src/server/MapleStatEffect.java +++ b/src/server/MapleStatEffect.java @@ -978,16 +978,14 @@ public class MapleStatEffect { Rectangle bounds = new Rectangle(mylt.x, mylt.y, myrb.x - mylt.x, myrb.y - mylt.y); return bounds; } - - public void silentApplyBuff(MapleCharacter chr, long starttime) { + + public void silentApplyBuff(MapleCharacter chr, long localStartTime) { int localDuration = duration; localDuration = alchemistModifyVal(chr, localDuration, false); //CancelEffectAction cancelAction = new CancelEffectAction(chr, this, starttime); //ScheduledFuture schedule = TimerManager.getInstance().schedule(cancelAction, ((starttime + localDuration) - System.currentTimeMillis())); - if(starttime + localDuration <= System.currentTimeMillis()) return; - - chr.registerEffect(this, starttime, (starttime + localDuration), true); + chr.registerEffect(this, localStartTime, localStartTime + localDuration, true); SummonMovementType summonMovementType = getSummonMovementType(); if (summonMovementType != null) { final MapleSummon tosummon = new MapleSummon(chr, sourceid, chr.getPosition(), summonMovementType); diff --git a/wz/Etc.wz/Commodity.img.xml b/wz/Etc.wz/Commodity.img.xml index 72f16151c1..3f24f07709 100644 --- a/wz/Etc.wz/Commodity.img.xml +++ b/wz/Etc.wz/Commodity.img.xml @@ -83731,7 +83731,7 @@ - + @@ -91605,6 +91605,16 @@ + + + + + + + + + + @@ -91612,4 +91622,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +