Skip to content

Commit

Permalink
Skillbook announcer update + Encoded temporary mob buffs + Slot gains…
Browse files Browse the repository at this point in the history
… patch

Encoded temporary mob buffs on mob control request/spawn packets.
Improved scroll generator NPC, now testing other bucket set possibilities.
Fixed slot gain method recently updated leading to a temporary visual glitch (inventory would show as normal after relogin).
Reviewed mobid check by name, no longer trying to generate a whole mob instance for info retrieval.
Added debuff purge when applying a buyback.
Reviewed skillbook announcer not informing properly storybooks, reactor or script loots.
Fixed autoaggro not working properly as soon as a player enters the field.
Fixed "fake" mobs disappearing as soon as its controller changes.
  • Loading branch information
ronancpl committed Dec 24, 2019
1 parent 959d990 commit 07fe495
Show file tree
Hide file tree
Showing 34 changed files with 211 additions and 143 deletions.
14 changes: 6 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Besides myself for maintaining this repository, credits are to be given to Wizet

Regarding distributability and usage of the code presented here: like it was before, this MapleStory server is open-source. By that, it is meant that anyone is **free to install, use, modify and redistribute the contents**, as long as there is **no kind of commercial trading involved** and the **credits to the original creators are maintained** within the codes.

This is a NetBeans 8.2 Project, that should be built and run on Java 8 in order to run properly (used to be ran in Java 7, thanks @kolakcc for the Java 8 support!).
This is a NetBeans 8.2 Project, that should be built and run on Java 8 in order to run properly. -- Used to be ran in Java 7, thanks kolakcc (Familiar) for the Java 8 support!

Being a NetBeans 8.2 Project, this means that it's easier to install the project via opening the server project folder inside NetBeans' IDE. Once installed, build this project on your machine and run the server using the "launch.bat" application.

Expand All @@ -33,6 +33,8 @@ Java 8 SDK & NetBeans bundle: https://www.oracle.com/technetwork/pt/java/javase/

**Change log:**

* Fixed Monster Magnet crashing the caster when trying to pull fixed mobs. https://gofile.io/?c=BW7dVM

* Cleared need for administrator privileges (OS) to play the game, credits to Ubaware.

* Set a higher cap for AP assigning with AP Reset, credits to Ubaware.
Expand Down Expand Up @@ -75,7 +77,7 @@ HeavenClient Github: https://github.com/ryantpayton/HeavenClient
---
### Development information

Status: <span style="color:grey">__In development (4th round)__</span>.
Status: <span style="color:SkyBlue">__Released (4 rounds)__</span>.

#### Mission

Expand Down Expand Up @@ -112,15 +114,11 @@ Our Discord channel is still available on: https://discord.gg/Q7wKxHX

<hr id="donate" />

### Donation

If you REALLY liked what you have seen on the project, please feel free to donate a little something as a helping hand for my contributions towards Maple development. Also remember to **support Nexon**!

Paypal: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=3K8KVTWRLFBQ4
[//]: <> (If you REALLY liked what you have seen on the project, please feel free to donate a little something as a helping hand for my contributions towards Maple development. Also remember to **support Nexon**!)

### Disclaimer

* HeavenMS development is decisively __ONLY accepting donations__ from the Paypal link aforementioned, in the __ronancpl/HeavenMS__ repository readme (no patreons or other revenue resources).
[//]: <> (* HeavenMS development is decisively __ONLY accepting donations__ from the Paypal link aforementioned, in the __ronancpl/HeavenMS__ repository readme (no patreons or other revenue resources).)

* HeavenMS staff has __no current intention__ to publicly open a server with this source, if that ever comes to happen this note will be lifted. __Don't be scammed!__

Expand Down
1 change: 1 addition & 0 deletions config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,7 @@ server:
MOB_STATUS_MONITOR_LIFE: 84 #Idle proc count the mob disease monitor is allowed to be there before closing it due to inactivity.
MOB_STATUS_AGGRO_PERSISTENCE: 2 #Idle proc count on aggro update for a mob to keep following the current controller, given him/her is the leading damage dealer.
MOB_STATUS_AGGRO_INTERVAL: 5000 #Interval in milliseconds between aggro logistics update.
USE_AUTOAGGRO_NEARBY: false #Mobs start following the player when approached.

#Some Gameplay Enhancing Configurations
#Scroll Configuration
Expand Down
26 changes: 26 additions & 0 deletions docs/mychanges_ptbr.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2330,3 +2330,29 @@ Revisado Inventory Sort, agora ordenando projéteis por bônus de dano.
06 Dezembro 2019,
Implementado pacote para visão de buffs de efeito imbuído em armas para outros jogadores.
Corrigido casos de exceção devido a portais nulos na função que troca jogador de mapas interferindo com próximas trocas de mapa (jogador fica preso até relogar).

07 Dezembro 2019,
Corrigido caso de exceção ao tentar atribuir pontos de stats ao jogador, que passou a ocorrer após mudança recente no sistema de stats.

09 Dezembro 2019,
Implementado aplicação de buffs ao se realizar a chamada/requisição de controle de um mob.

11 Dezembro 2019,
Incrementado suporte para aplicação de buffs de mobs de dano refletido, completando-se a ronda.

14 Dezembro 2019,
Melhorado NPC de geração de scrolls, agora testando outras possibilidades caso nenhum scroll encontrado em conjunto de scrolls.
Corrigido método de ganho de slots atualizado recentemente levando a bug visual, onde somente os 4 primeiros itens do inventário estariam aparecendo na tela.
Revisado método de busca por nomes, não mais tentando gerar um objeto de mob somente para checar o nome.
Adicionado limpa de debuffs ao se utilizar buyback.
Revisado anunciador de skillbooks não informando devidamente sobre os campos de reatores e scripts.

16 Dezembro 2019,
Revisado possível caso de dupe com itens ao fechar Hired Merchant.

20 Dezembro 2019,
Corrigido autoaggro não atuando devidamente em mobs assim que jogador entra no mapa e adquire controladores sobre os mesmos.
Corrigido anunciador de skillbooks não reportando etc de quest para começar, quando lidando com questlines onde se obtém a skill diretamente.

21 Dezembro 2019,
Corrigido mobs em estado "fake" desaparecendo da tela assim que muda-se o controlador do mesmo.
2 changes: 1 addition & 1 deletion scripts/event/HorntailBattle.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ function setEventRewards(eim) {
function afterSetup(eim) {}

function setup(channel) {
var eim = em.newInstance("Horntail" + channel); // thanks Thora for reporting an issue with misleading event name here
var eim = em.newInstance("Horntail" + channel); // thanks Thora (Arufonsu) for reporting an issue with misleading event name here
eim.setProperty("canJoin", 1);
eim.setProperty("defeatedBoss", 0);
eim.setProperty("defeatedHead", 0);
Expand Down
2 changes: 1 addition & 1 deletion scripts/npc/9209000.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ function action(mode, type, selection) {
sendStr += " #L" + i + "# " + mobList[i] + "#l\r\n";
}

sendStr += "\r\n";
sendStr += "\r\n\r\n";
}
} else {
sendStr = "\r\n\r\n";
Expand Down
32 changes: 31 additions & 1 deletion scripts/npc/scroll_generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ function calculateScrollTiers() {
return tiers;
}

function getRandomScroll(tiers) {
function getRandomScrollFromTiers(tiers) {
var typeTier = tiers[0], subtypeTier = tiers[1], successTier = tiers[2];
var scrollTypePool = getScrollTypePool(typeTier);
var scrollPool = getAvailableScrollsPool(scrollTypePool, subtypeTier, successTier);
Expand All @@ -365,6 +365,36 @@ function getRandomScroll(tiers) {
}
}

function getRandomScrollFromRightPermutations(tiers) {
for (var i = 2; i >= 0; i--) {
for (var j = i - 1; j >= 0; j--) {
if (tiers[i] >= 3) {
break;
} else if (tiers[j] > 1) {
tiers[i]++;
tiers[j]--;

var itemid = getRandomScrollFromTiers(tiers);
if (itemid != -1) {
return itemid;
}
}
}
}

return -1;
}

function getRandomScroll(tiers) {
var itemid = getRandomScrollFromTiers(tiers);
if (itemid == -1) {
// worst case shift-right permutations...
itemid = getRandomScrollFromRightPermutations(tiers);
}

return itemid;
}

function performExchange(sgItemid, sgCount) {
if (cm.getMeso() < sgAppliedMeso) {
return false;
Expand Down
37 changes: 25 additions & 12 deletions src/client/MapleCharacter.java
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,6 @@
import constants.game.ExpTable;
import constants.game.GameConstants;
import constants.inventory.ItemConstants;
import constants.net.ServerConstants;
import constants.skills.Aran;
import constants.skills.Beginner;
import constants.skills.Bishop;
Expand Down Expand Up @@ -2819,7 +2818,14 @@ public void dispelDebuffs() {
dispelDebuff(MapleDisease.WEAKEN);
dispelDebuff(MapleDisease.SLOW); // thanks Conrad for noticing ZOMBIFY isn't dispellable
}


public void purgeDebuffs() {
dispelDebuff(MapleDisease.SEDUCE);
dispelDebuff(MapleDisease.ZOMBIFY);
dispelDebuff(MapleDisease.CONFUSE);
dispelDebuffs();
}

public void cancelAllDebuffs() {
chrLock.lock();
try {
Expand Down Expand Up @@ -9420,26 +9426,27 @@ public boolean gainSlots(int type, int slots) {
}

public boolean gainSlots(int type, int slots, boolean update) {
boolean ret = gainSlotsInternal(type, slots, update);
if (ret) {
int newLimit = gainSlotsInternal(type, slots);
if (newLimit != -1) {
this.saveCharToDB();
if (update) {
client.announce(MaplePacketCreator.updateInventorySlotLimit(type, slots));
client.announce(MaplePacketCreator.updateInventorySlotLimit(type, newLimit));
}
return true;
} else {
return false;
}

return ret;
}

private boolean gainSlotsInternal(int type, int slots, boolean update) {
private int gainSlotsInternal(int type, int slots) {
inventory[type].lockInventory();
try {
if (canGainSlots(type, slots)) {
slots += inventory[type].getSlotLimit();
inventory[type].setSlotLimit(slots);
return true;
int newLimit = inventory[type].getSlotLimit() + slots;
inventory[type].setSlotLimit(newLimit);
return newLimit;
} else {
return false;
return -1;
}
} finally {
inventory[type].unlockInventory();
Expand Down Expand Up @@ -10652,6 +10659,12 @@ public void run() {
client = null; // clients still triggers handlers a few times after disconnecting
map = null;
setListener(null);

// thanks Shavit for noticing a memory leak with inventories holding owner object
for (int i = 0; i < inventory.length; i++) {
inventory[i].dispose();
}
inventory = null;
}
}, 5 * 60 * 1000);
}
Expand Down
4 changes: 2 additions & 2 deletions src/client/command/commands/gm0/DisposeCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ public class DisposeCommand extends Command {
{
setDescription("");
}

@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.");
}
}
}
1 change: 0 additions & 1 deletion src/client/command/commands/gm0/TimeCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@

import client.MapleClient;
import client.command.Command;
import constants.net.ServerConstants;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
Expand Down
1 change: 0 additions & 1 deletion src/client/command/commands/gm1/WhatDropsFromCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import server.MapleItemInformationProvider;
import server.life.MapleMonsterInformationProvider;
import server.life.MonsterDropEntry;
import tools.MaplePacketCreator;
import tools.Pair;

import java.util.Iterator;
Expand Down
6 changes: 4 additions & 2 deletions src/client/inventory/MapleInventory.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,12 @@
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map.Entry;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.locks.Lock;
import net.server.audit.locks.factory.MonitoredReentrantLockFactory;

Expand Down Expand Up @@ -672,4 +670,8 @@ public void lockInventory() {
public void unlockInventory() {
lock.unlock();
}

public void dispose() {
owner = null;
}
}
1 change: 1 addition & 0 deletions src/client/processor/action/BuybackProcessor.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ public static void processBuyback(MapleClient c) {
}

chr.healHpMp();
chr.purgeDebuffs();
chr.broadcastStance(chr.isFacingLeft() ? 5 : 4);

MapleMap map = chr.getMap();
Expand Down
1 change: 1 addition & 0 deletions src/config/ServerConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ public class ServerConfig {
public int MOB_STATUS_MONITOR_LIFE;
public int MOB_STATUS_AGGRO_PERSISTENCE;
public int MOB_STATUS_AGGRO_INTERVAL;
public boolean USE_AUTOAGGRO_NEARBY;

//Some Gameplay Enhancing Configurations
//Scroll Configuration
Expand Down
1 change: 1 addition & 0 deletions src/constants/net/ServerConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public class ServerConstants {
public static int DEBUG_VALUES[] = new int[10]; // Field designed for packet testing purposes

// https://github.com/openstreetmap/josm/blob/a3a6e8a6b657cf4c5b4c64ea14d6e87be6280d65/src/org/openstreetmap/josm/tools/Utils.java#L1566-L1585
// Added by kolakcc (Familiar)
/**
* Returns the Java version as an int value.
* @return the Java version as an int value (8, 9, etc.)
Expand Down
1 change: 0 additions & 1 deletion src/net/server/channel/handlers/GuildOperationHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import net.server.guild.MapleGuildResponse;
import net.server.guild.MapleGuild;
import constants.game.GameConstants;
import constants.net.ServerConstants;
import client.MapleClient;
import net.AbstractMaplePacketHandler;
import tools.data.input.SeekableLittleEndianAccessor;
Expand Down
1 change: 0 additions & 1 deletion src/net/server/channel/handlers/PartyOperationHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
import tools.data.input.SeekableLittleEndianAccessor;
import client.MapleCharacter;
import client.MapleClient;
import constants.net.ServerConstants;
import net.server.coordinator.world.MapleInviteCoordinator;
import net.server.coordinator.world.MapleInviteCoordinator.InviteResult;
import net.server.coordinator.world.MapleInviteCoordinator.InviteType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@ public final void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c)
if (m.getController() == chr) {
c.announce(MaplePacketCreator.stopControllingMonster(m.getObjectId()));
m.sendDestroyData(c);
m.aggroRedirectController();
m.aggroRemoveController();
} else {
m.sendDestroyData(c);
}

m.aggroSwitchController(chr, false);
m.sendSpawnData(c);
m.aggroSwitchController(chr, false);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ public boolean answerMatchConfirmation(int cid, boolean accept) {

if (mmce != null) {
synchronized (mmce) {
if (!mmce.isMatchActive()) { // thanks Alex (CanIGetaPR) for noticing that exploiters could stall on match checking
if (!mmce.isMatchActive()) { // thanks Alex (Alex-0000) for noticing that exploiters could stall on match checking
matchEntries.remove(cid);
mmce = null;
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/net/server/task/CharacterAutosaverTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
/**
* @author Ronan
*/
public class CharacterAutosaverTask extends BaseTask implements Runnable { // thanks Alex (Alex09) for noticing these runnable classes are tasks, "workers" runs them
public class CharacterAutosaverTask extends BaseTask implements Runnable { // thanks Alex09 (Alex-0000) for noticing these runnable classes are tasks, "workers" runs them

@Override
public void run() {
Expand Down
1 change: 0 additions & 1 deletion src/net/server/task/RankingLoginTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import client.MapleJob;
import config.YamlConfig;
import tools.DatabaseConnection;
import constants.net.ServerConstants;
import net.server.Server;

/**
Expand Down
9 changes: 7 additions & 2 deletions src/scripting/npc/NPCConversationManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@
import constants.game.GameConstants;
import constants.inventory.ItemConstants;
import constants.string.LanguageConstants;
import net.server.PlayerStorage;
import net.server.channel.Channel;
import net.server.coordinator.matchchecker.MatchCheckerListenerFactory.MatchCheckerType;
import server.MapleMarriage;
Expand Down Expand Up @@ -603,6 +602,12 @@ public String getSkillBookInfo(int itemid) {
switch (sbe) {
case UNAVAILABLE:
return "";

case REACTOR:
return " Obtainable through #rexploring#k (loot boxes).";

case SCRIPT:
return " Obtainable through #rexploring#k (field interaction).";

case QUEST_BOOK:
return " Obtainable through #rquestline#k (collecting book).";
Expand Down Expand Up @@ -633,7 +638,7 @@ public boolean sendCPQMapLists() {
for (int i = 0; i < 6; i++) {
if (fieldTaken(i)) {
if (fieldLobbied(i)) {
msg += "#b#L" + i + "#Carnival Field " + (i + 1) + " (Level: " // "Carnival field" GMS-like improvement thanks to Jayd
msg += "#b#L" + i + "#Carnival Field " + (i + 1) + " (Level: " // "Carnival field" GMS-like improvement thanks to Jayd (jaydenseah)
+ cpqCalcAvgLvl(980000100 + i * 100) + " / "
+ getPlayerCount(980000100 + i * 100) + "x"
+ getPlayerCount(980000100 + i * 100) + ") #l\r\n";
Expand Down
1 change: 0 additions & 1 deletion src/server/CashShop.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
import client.inventory.MapleInventoryType;
import client.inventory.MaplePet;
import constants.inventory.ItemConstants;
import constants.net.ServerConstants;
import java.util.Collections;
import net.server.audit.locks.MonitoredLockType;

Expand Down
Loading

0 comments on commit 07fe495

Please sign in to comment.