Skip to content

Commit

Permalink
Quest Item Restore + Packets w/ Timezone + Item/Exp-dec Field Limits
Browse files Browse the repository at this point in the history
Fixed leaders being able to create expeditions even though the already passed the day limit.
Fixed overflow case in calculated max value of skills.
Implemented item expiration from DB after the due date.
Refactored item flags using byte-length instead of short.
Added FieldLimit checks for disappearing item drops and no EXP deduction in limited areas.
Added "Quest Item Restore" functionality.
Implemented item flag auto-instantiation when generating items.
Added gate state update in Papulatus lobby area.
Fixed a recent issue regarding bounding box calculation of AoE player skills.
Implemented minidungeon close, to occur as soon as the party leader leaves the area.
Refactored HenesysPQ attributed out of the MapleMap object, now they should be available from the respective event script.
Fixed friendly mobs not dropping item periodically, a recent issue after tweaking the loot system.
Fixed Papulatus expedition closing after the exped leader leaves or a minimum of player required to start is no longer there.
Fixed several expeditions closing after performing party operations, such as "change party leader".
Reviewed expected max damage calculation for summons, which would not work properly in several occasions.
Normalized timezone from packets sent to client, now using the same timezone defined from the server flags.
Fixed certain scenarios in CPQ that would happen within the stage between the "challenge accepted" and ingress in the battlefield.
Revised credits script.
Added GM checks in the autoban method.
  • Loading branch information
ronancpl committed Jul 15, 2019
1 parent 0228d4e commit ab5cec7
Show file tree
Hide file tree
Showing 73 changed files with 1,200 additions and 393 deletions.
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,18 @@
/tools/MapleInvalidItemWithNoNameFetcher/dist/
/tools/MapleInvalidItemWithNoNameFetcher/nbproject/

/tools/MapleMapFieldLimitChecker/build/
/tools/MapleMapFieldLimitChecker/dist/
/tools/MapleMapFieldLimitChecker/nbproject/

/tools/MapleMapInfoRetriever/build/
/tools/MapleMapInfoRetriever/dist/
/tools/MapleMapInfoRetriever/nbproject/

/tools/MapleMapLootLimitChecker/build/
/tools/MapleMapLootLimitChecker/dist/
/tools/MapleMapLootLimitChecker/nbproject/

/tools/MapleMesoFetcher/build/
/tools/MapleMesoFetcher/dist/
/tools/MapleMesoFetcher/nbproject/
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Java7 SDK: https://www.oracle.com/technetwork/java/javase/downloads/java-archive

**Important note about localhosts**: these executables are red-flagged by antivirus tools as __potentially malicious softwares__, this happens due to the reverse engineering methods that were applied onto these software artifacts. Those depicted here have been put to use for years already and posed no harm so far, so they are soundly assumed to be safe.

Latest localhost: https://hostr.co/itrvrHapvtEg
Latest localhost: https://hostr.co/SvnSKrGzXhG0

The following list, in bottom-up chronological order, holds information regarding all changes that were applied from the starting localhost used in this development. Some lines have a link attached, that will lead you to a snapshot of the localhost at that version of the artifact. Naturally, later versions holds all previous changes along with the proposed changes.

Expand Down
18 changes: 10 additions & 8 deletions docs/area_bosses/BossEvent.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
// @Author: Resinate

var towns = new Array(800020120, 251010102, 260010201, 107000300, 200010300, 100040105, 100040106, 261030000, 110040000, 250010504, 240040401, 104000400, 222010310, 230040420, 230040420, 230020100, 105090310, 101030404, 250010304, 220050100, 220050000, 220050200, 221040301);
var spawns = new Array(6090002, 5220004, 3220001, 6220000, 8220000, 5220002, 5220002, 8220002, 5220001, 7220002, 8220003, 2220000, 7220001, 8510000, 8520000, 4220001, 8220008, 3220000, 7220000, 5220003, 5220003, 5220003, 6220001);
var x = new Array(560, 560, 645, 90, 208, 456, 474, -300, 200, 400, 0, 400, 0, 527, 138, 0, -626, 800, -300, -300, 0, 0, -4224);
var y = new Array(50, 50, 275, 119, 83, 278, 278, 180, 140, 540, 1125, 455, 33, -437, 138, 520, -604, 1280, 390, 1030, 1030, 1030, 776);
importPackage(Packages.server.life);
importPackage(Packages.tools);

var towns = new Array(800020120, 251010102, 260010201, 107000300, 200010300, 100040105, 100040106, 261030000, 110040000, 240040401, 104000400, 222010310, 230040420, 230040420, 230020100, 105090310, 101030404, 250010304, 220050100, 220050000, 220050200, 221040301);
var spawns = new Array(6090002, 5220004, 3220001, 6220000, 8220000, 5220002, 5220002, 8220002, 5220001, 8220003, 2220000, 7220001, 8510000, 8520000, 4220001, 8220008, 3220000, 7220000, 5220003, 5220003, 5220003, 6220001);
var x = new Array(560, 560, 645, 90, 208, 456, 474, -300, 200, 0, 400, 0, 527, 138, 0, -626, 800, -300, -300, 0, 0, -4224);
var y = new Array(50, 50, 275, 119, 83, 278, 278, 180, 140, 1125, 455, 33, -437, 138, 520, -604, 1280, 390, 1030, 1030, 1030, 776);
var mapObj;
var mobObj;

Expand All @@ -21,13 +24,12 @@ function cancelSchedule() {
}

function start() {
var time = (Math.floor(Math.random() * 10) + 10) * (60 * 1000);
for(var i = 0; i < towns.length; i++) {
mapObj = em.getChannelServer().getMapFactory().getMap(towns[i]);
mobObj = Packages.server.life.MapleLifeFactory.getMonster(spawns[i]);
mobObj = MapleLifeFactory.getMonster(spawns[i]);
if(mapObj.getMonsterById(spawns[i]) == null) {
mapObj.spawnMonsterOnGroundBelow(mobObj, new Packages.java.awt.Point(x[i],y[i]));
}
}
em.schedule("start", time);
}
setupTask = em.schedule("start", 30 * 60 * 1000);
}
34 changes: 33 additions & 1 deletion docs/mychanges_ptbr.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1982,4 +1982,36 @@ Ajustado evento de Gaga no espaço, evento agora funcional.
Adicionado minigame RPS de NPC, recursos implementados pelo Arnah.

27 Junho 2019,
Corrigido contabilização de dano de auto-destruição de mobs não sendo aplicado corretamente.
Corrigido contabilização de dano de auto-destruição de mobs não sendo aplicado corretamente.

01 Julho 2019,
Corrigido contabilização de entrada em bosses não checando criação de expedições.
Corrigido caso de overflow em valor máximo calculado de dano em skills.
Implementado retirada de itens mantidos pelo Duey na DB, após dado a data de expirar.

02 Julho 2019,
Refatorado flags de itens utilizando tamanho menor que o esperado.
Adicionado checagem por FieldLimit ao lançar itens em mapas dados como "untradeable".
Adicionado funcionalidade "Quest Item Restore".

11 Julho 2019,
Implementado instanciação de flag "somente compartilhável dentro de mesma conta" em itens recém-gerados que possuem essa funcionalidade.
Implementado atualização de estados no portão de entrada do Papulatus.
Corrigido deslize apontado pelo Conrad, na aplicação de caixas de limites usados pelos buffs em área.
Implementado finalização de instância de minidungeon assim que o líder de party sai da área ou há troca de líderes com alguém fora da área.

14 Julho 2019,
Refatorado atributos de HenesysPQ sendo utilizados em objetos de áreas do jogo.
Corrigido mobs aliados não realizando item drops devidamente após atualização recente no sistema de loot.
Corrigido quest de proteger hog (explorers) "completando" mesmo embora o jogador tenha tentado sair da instância ao conversar com o NPC.
Corrigido possível exploit com quest de proteger hog (explorers), onde o jogador poderia vir a tentar novamente a instância após completá-la (resultando em recompensas rápidas).
Corrigido script de Papulatus não levando os métodos de checagem de requisitos atualizados para expedições.
Corrigido diversos scripts de expedições finalizando expedições indevidamente ao realizar operações de party.
Implementado checagem por flag de FieldLimit que evita penalidade de perda de EXP em certas áreas do jogo.
Revisado limite de dano aplicável por alguns summons, cujo valor limite estava muito abaixo do esperado, levando a problemas com aplicação de ataques dos mesmos.

15 Julho 2019,
Implementado normalização de fuso horário em pacotes enviados ao cliente. Agora o sistema utiliza mesmo fuso horário definido nas flags do servidor.
Corrigido certos casos onde grupos dentro de lobby de CPQ não conseguiam ser desafiados, geralmente ocorrendo ao se desconectar após o desafio ter sido aceito e antes de começar a instância.
Revisado script de créditos.
Adicionado checagem por GM's no método de autoban de jogador.
21 changes: 3 additions & 18 deletions scripts/event/BalrogBattle.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,12 +179,7 @@ function changedMap(eim, player, mapid) {
}
}

function changedLeader(eim, leader) {
var mapid = leader.getMapId();
if (!eim.isEventCleared() && (mapid < minMapId || mapid > maxMapId)) {
end(eim);
}
}
function changedLeader(eim, leader) {}

function playerDead(eim, player) {}

Expand All @@ -206,19 +201,9 @@ function playerDisconnected(eim, player) {
eim.unregisterPlayer(player);
}

function leftParty(eim, player) {
if (eim.isExpeditionTeamLackingNow(false, minPlayers, player)) {
end(eim);
}
else
playerLeft(eim, player);
}
function leftParty(eim, player) {}

function disbandParty(eim) {
if (!eim.isEventCleared()) {
end(eim);
}
}
function disbandParty(eim) {}

function monsterValue(eim, mobId) {
return 1;
Expand Down
21 changes: 3 additions & 18 deletions scripts/event/BalrogBattle_Easy.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,12 +179,7 @@ function changedMap(eim, player, mapid) {
}
}

function changedLeader(eim, leader) {
var mapid = leader.getMapId();
if (!eim.isEventCleared() && (mapid < minMapId || mapid > maxMapId)) {
end(eim);
}
}
function changedLeader(eim, leader) {}

function playerDead(eim, player) {}

Expand All @@ -206,19 +201,9 @@ function playerDisconnected(eim, player) {
eim.unregisterPlayer(player);
}

function leftParty(eim, player) {
if (eim.isExpeditionTeamLackingNow(false, minPlayers, player)) {
end(eim);
}
else
playerLeft(eim, player);
}
function leftParty(eim, player) {}

function disbandParty(eim) {
if (!eim.isEventCleared()) {
end(eim);
}
}
function disbandParty(eim) {}

function monsterValue(eim, mobId) {
return 1;
Expand Down
21 changes: 21 additions & 0 deletions scripts/event/HenesysPQ.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ function setup(level, lobbyid) {
var eim = em.newInstance("Henesys" + lobbyid);
eim.setProperty("level", level);
eim.setProperty("stage", "0");
eim.setProperty("bunnyCake", "0");
eim.setProperty("bunnyDamage", "0");

eim.getInstanceMap(910010000).resetPQ(level);
eim.getInstanceMap(910010000).allowSummonState(false);
Expand Down Expand Up @@ -243,6 +245,25 @@ function friendlyKilled(mob, eim) {
}
}

function friendlyItemDrop(eim, mob) {
if (mob.getId() == 9300061) {
var cakes = eim.getIntProperty("bunnyCake") + 1;
eim.setIntProperty("bunnyCake", cakes);

mob.getMap().broadcastMessage(Packages.tools.MaplePacketCreator.serverNotice(6, "The Moon Bunny made rice cake number " + cakes + "."));
}
}

function friendlyDamaged(eim, mob) {
if (mob.getId() == 9300061) {
var bunnyDamage = eim.getIntProperty("bunnyDamaged") + 1;
if (bunnyDamage > 5) {
broadcastMessage(Packages.tools.MaplePacketCreator.serverNotice(6, "The Moon Bunny is feeling sick. Please protect it so it can make delicious rice cakes."));
eim.setIntProperty("bunnyDamaged", 0);
}
}
}

function allMonstersDead(eim) {}

function cancelSchedule() {}
Expand Down
43 changes: 20 additions & 23 deletions scripts/event/PapulatusBattle.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,9 @@ function setup(level, lobbyid) {
return eim;
}

function afterSetup(eim) {}
function afterSetup(eim) {
updateGateState(1);
}

function respawnStages(eim) {}

Expand Down Expand Up @@ -143,7 +145,7 @@ function playerLeft(eim, player) {

function changedMap(eim, player, mapid) {
if (mapid < minMapId || mapid > maxMapId) {
if (eim.isEventTeamLackingNow(true, minPlayers, player)) {
if (eim.isExpeditionTeamLackingNow(true, minPlayers, player)) {
eim.unregisterPlayer(player);
end(eim);
}
Expand All @@ -152,17 +154,12 @@ function changedMap(eim, player, mapid) {
}
}

function changedLeader(eim, leader) {
var mapid = leader.getMapId();
if (!eim.isEventCleared() && (mapid < minMapId || mapid > maxMapId)) {
end(eim);
}
}
function changedLeader(eim, leader) {}

function playerDead(eim, player) {}

function playerRevive(eim, player) { // player presses ok on the death pop up.
if (eim.isEventTeamLackingNow(true, minPlayers, player)) {
if (eim.isExpeditionTeamLackingNow(true, minPlayers, player)) {
eim.unregisterPlayer(player);
end(eim);
}
Expand All @@ -171,27 +168,17 @@ function playerRevive(eim, player) { // player presses ok on the death pop up.
}

function playerDisconnected(eim, player) {
if (eim.isEventTeamLackingNow(true, minPlayers, player)) {
if (eim.isExpeditionTeamLackingNow(true, minPlayers, player)) {
eim.unregisterPlayer(player);
end(eim);
}
else
eim.unregisterPlayer(player);
}

function leftParty(eim, player) {
if (eim.isEventTeamLackingNow(false, minPlayers, player)) {
end(eim);
}
else
playerLeft(eim, player);
}
function leftParty(eim, player) {}

function disbandParty(eim) {
if (!eim.isEventCleared()) {
end(eim);
}
}
function disbandParty(eim) {}

function monsterValue(eim, mobId) {
return 1;
Expand All @@ -213,6 +200,7 @@ function giveRandomEventReward(eim, player) {
function clearPQ(eim) {
eim.stopEventTimer();
eim.setEventCleared();
updateGateState(0);
}

function isPapulatus(mob) {
Expand All @@ -231,5 +219,14 @@ function allMonstersDead(eim) {}

function cancelSchedule() {}

function dispose(eim) {}
function updateGateState(newState) { // thanks Conrad for noticing missing gate update
em.getChannelServer().getMapFactory().getMap(220080000).getReactorById(2208001).forceHitReactor(newState);
em.getChannelServer().getMapFactory().getMap(220080000).getReactorById(2208002).forceHitReactor(newState);
em.getChannelServer().getMapFactory().getMap(220080000).getReactorById(2208003).forceHitReactor(newState);
}

function dispose(eim) {
if (!eim.isEventCleared()) {
updateGateState(0);
}
}
10 changes: 7 additions & 3 deletions scripts/event/ZakumBattle.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ function setEventRewards(eim) {
}

function afterSetup(eim) {
em.getChannelServer().getMapFactory().getMap(211042300).getReactorById(2118002).forceHitReactor(1);
updateGateState(1);
}

function setup(channel) {
Expand Down Expand Up @@ -190,7 +190,7 @@ function giveRandomEventReward(eim, player) {
function clearPQ(eim) {
eim.stopEventTimer();
eim.setEventCleared();
em.getChannelServer().getMapFactory().getMap(211042300).getReactorById(2118002).forceHitReactor(0);
updateGateState(0);
}

function isZakum(mob) {
Expand All @@ -212,8 +212,12 @@ function allMonstersDead(eim) {}

function cancelSchedule() {}

function updateGateState(newState) { // thanks Conrad for noticing missing gate update
em.getChannelServer().getMapFactory().getMap(211042300).getReactorById(2118002).forceHitReactor(newState);
}

function dispose(eim) {
if (!eim.isEventCleared()) {
em.getChannelServer().getMapFactory().getMap(211042300).getReactorById(2118002).forceHitReactor(0);
updateGateState(0);
}
}
14 changes: 11 additions & 3 deletions scripts/npc/1061014.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,13 @@ function action(mode, type, selection) {
cm.sendSimple("#e#b<Expedition: " + expedName + ">\r\n#k#n" + em.getProperty("party") + "\r\n\r\nWould you like to assemble a team to take on #r" + expedBoss + "#k?\r\n#b#L1#Lets get this going!#l\r\n\#L2#No, I think I'll wait a bit...#l\r\n\#L3#I would like to see info about this expedition...#l");
status = 1;
} else if (expedition.isLeader(player)) { //If you're the leader, manage the exped
cm.sendSimple(list);
status = 2;
if (expedition.isInProgress()) {
cm.sendOk("Your expedition is already in progress, for those who remain battling lets pray for those brave souls.");
cm.dispose();
} else {
cm.sendSimple(list);
status = 2;
}
} else if (expedition.isRegistering()) { //If the expedition is registering
if (expedition.contains(player)) { //If you're in it but it hasn't started, be patient
cm.sendOk("You have already registered for the expedition. Please wait for #r" + expedition.getLeader().getName() + "#k to begin it.");
Expand Down Expand Up @@ -99,8 +104,11 @@ function action(mode, type, selection) {
return;
}

if (cm.createExpedition(exped)) {
var res = cm.createExpedition(exped);
if (res == 0) {
cm.sendOk("The #r" + expedBoss + " Expedition#k has been created.\r\n\r\nTalk to me again to view the current team, or start the fight!");
} else if (res > 0) {
cm.sendOk("Sorry, you've already reached the quota of attempts for this expedition! Try again another day...");
} else {
cm.sendOk("An unexpected error has occurred when starting the expedition, please try again later.");
}
Expand Down
14 changes: 11 additions & 3 deletions scripts/npc/2030013.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,13 @@ function action(mode, type, selection) {
cm.sendSimple("#e#b<Expedition: " + expedName + ">\r\n#k#n" + em.getProperty("party") + "\r\n\r\nWould you like to assemble a team to take on #r" + expedBoss + "#k?\r\n#b#L1#Lets get this going!#l\r\n\#L2#No, I think I'll wait a bit...#l");
status = 1;
} else if (expedition.isLeader(player)) { //If you're the leader, manage the exped
cm.sendSimple(list);
status = 2;
if (expedition.isInProgress()) { // thanks Conrad for noticing exped leaders being able to still manage in-progress expeds
cm.sendOk("Your expedition is already in progress, for those who remain battling lets pray for those brave souls.");
cm.dispose();
} else {
cm.sendSimple(list);
status = 2;
}
} else if (expedition.isRegistering()) { //If the expedition is registering
if (expedition.contains(player)) { //If you're in it but it hasn't started, be patient
cm.sendOk("You have already registered for the expedition. Please wait for #r" + expedition.getLeader().getName() + "#k to begin it.");
Expand Down Expand Up @@ -106,8 +111,11 @@ function action(mode, type, selection) {
return;
}

if (cm.createExpedition(exped)) {
var res = cm.createExpedition(exped);
if (res == 0) {
cm.sendOk("The #r" + expedBoss + " Expedition#k has been created.\r\n\r\nTalk to me again to view the current team, or start the fight!");
} else if (res > 0) {
cm.sendOk("Sorry, you've already reached the quota of attempts for this expedition! Try again another day...");
} else {
cm.sendOk("An unexpected error has occurred when starting the expedition, please try again later.");
}
Expand Down
Loading

0 comments on commit ab5cec7

Please sign in to comment.