From 3bdf8cb2be5f0b232c586acb2b341d8d4eafeba5 Mon Sep 17 00:00:00 2001 From: ronancpl Date: Fri, 15 Mar 2019 12:08:21 -0300 Subject: [PATCH] The great MCPQ Merge offensive Fulfilled the lovely pull request #427 from @dragoso, which added in backing code content to HeavenMS. Implemented structural changes for the Marriage wishlist, in order to receive, maintain and distribute gifts to spouses. Added untradeable check on wishlist gift handler. Adjusted CPQ drops to actually load from DB rathe than hard-coded. Fixed CPQ "random disease to player/party" functionality not applying properly. Adjusted how CPQ maps are generated. It directly loads a new area from WZ (this process should at least removes the player's spawned mobs) rather than reset the cache at every MCPQ creation. --- docs/mychanges_ptbr.txt | 16 +- scripts/event/WeddingCathedral.js | 11 +- scripts/event/WeddingChapel.js | 11 +- scripts/npc/2042000.js | 591 ++++++++++++++++-- scripts/npc/2042002.js | 282 +++++++-- scripts/npc/2042005.js | 42 +- scripts/npc/2042007.js | 28 +- scripts/npc/2091005.js | 2 +- scripts/npc/2091005_old.js | 1 - scripts/npc/9010022.js | 4 +- scripts/npc/9010022_old.js | 2 - scripts/npc/9201005.js | 6 + scripts/npc/9201006.js | 5 +- scripts/npc/9201008.js | 6 + scripts/npc/9201010.js | 4 +- scripts/npc/9201014.js | 94 ++- scripts/npc/cpqchallenge.js | 3 +- scripts/portal/MCRevive1.js | 2 +- scripts/portal/MCRevive2.js | 2 +- scripts/portal/MCRevive3.js | 2 +- scripts/portal/MCRevive4.js | 2 +- scripts/portal/MCRevive5.js | 2 +- scripts/portal/MCRevive6.js | 2 +- scripts/portal/mc_out.js | 6 +- sql/db_drops.sql | 466 ++++++++++++++ src/client/MapleCharacter.java | 67 +- src/client/MapleDisease.java | 33 +- src/client/inventory/ItemFactory.java | 3 +- src/client/inventory/MapleInventory.java | 11 +- src/constants/GameConstants.java | 4 + src/constants/LanguageConstants.java | 73 +++ src/constants/LinguaConstants.java | 69 -- src/constants/ServerConstants.java | 5 +- .../handlers/MonsterCarnivalHandler.java | 106 ++-- .../channel/handlers/RingActionHandler.java | 113 ++-- .../channel/handlers/WeddingHandler.java | 168 +++-- src/net/server/world/MaplePartyCharacter.java | 6 +- src/scripting/AbstractPlayerInteraction.java | 12 +- src/scripting/event/EventInstanceManager.java | 27 + src/scripting/event/EventManager.java | 14 + src/scripting/npc/NPCConversationManager.java | 166 +++-- src/server/MapleMarriage.java | 183 ++++++ src/server/MapleStatEffect.java | 29 +- .../life/MapleMonsterInformationProvider.java | 61 +- src/server/maps/MapleMapFactory.java | 38 +- .../partyquest/MapleCarnivalFactory.java | 4 + src/server/partyquest/MonsterCarnival.java | 90 ++- .../partyquest/MonsterCarnivalParty.java | 16 +- src/tools/MaplePacketCreator.java | 2 +- .../output/GenericLittleEndianWriter.java | 2 +- src/tools/packets/Wedding.java | 40 +- wz/Mob.wz/9300134.img.xml | 2 +- 52 files changed, 2258 insertions(+), 678 deletions(-) create mode 100644 src/constants/LanguageConstants.java delete mode 100644 src/constants/LinguaConstants.java create mode 100644 src/server/MapleMarriage.java diff --git a/docs/mychanges_ptbr.txt b/docs/mychanges_ptbr.txt index e9613c79d5..8d95393545 100644 --- a/docs/mychanges_ptbr.txt +++ b/docs/mychanges_ptbr.txt @@ -1711,4 +1711,18 @@ Implementado mecânica de pescaria no código-fonte. 09 Março 2019, Corrigido membros de party não recebendo bonus devidamente após membros sairem do mapa/party em alguns casos. -Revisado sistema de experiência em party. Ganhos de bonus agora levam em conta valores-base que membros de party ganham ao derrotar um mob para definir o ganho geral da equipe. Contabilização de ganhos remodelado, buscando por um modo de distribuição mais coerente. \ No newline at end of file +Revisado sistema de experiência em party. Ganhos de bonus agora levam em conta valores-base que membros de party ganham ao derrotar um mob para definir o ganho geral da equipe. Contabilização de ganhos remodelado, buscando por um modo de distribuição mais coerente. + +12 - 13 Março 2019, +Iniciado operação de introdução da wishlist de casamento e MCPQ no fonte, a partir do pull request feito pelo Dragohe4rt. +Implementado estrutura back-end para comportar e manter (em DB) o wishlist de casamento. +Ajustado mecânicas de wishlist iniciadas nos scripts do evento de casamento. + +14 Março 2019, +Adicionado checagem por itens untradeable no handler de wishlist ao enviar itens. +Adicionado drops da CPQ na DB. +Corrigido diversas diseases da CPQ não funcionando corretamente ao pegar do chão item que aleatoriza disease no time/pessoa oponente. +Modificado geração de mapas da CPQ, agora sempre carregando um novo mapa da WZ ao invés de sempre buscar e resetar o mapa carregado na cache. + +15 Março 2019, +Adicionado SFX nos portais da CPQ. \ No newline at end of file diff --git a/scripts/event/WeddingCathedral.js b/scripts/event/WeddingCathedral.js index cd7b871854..7d811fac40 100644 --- a/scripts/event/WeddingCathedral.js +++ b/scripts/event/WeddingCathedral.js @@ -77,7 +77,7 @@ function spawnCakeBoss(eim) { } function setup(level, lobbyid) { - var eim = em.newInstance("Wedding" + lobbyid); + var eim = em.newMarriage("Wedding" + lobbyid); eim.setProperty("weddingId", "0"); eim.setProperty("weddingStage", "0"); // 0: gathering time, 1: wedding time, 2: ready to fulfill the wedding, 3: just married eim.setProperty("guestBlessings", "0"); @@ -86,6 +86,9 @@ function setup(level, lobbyid) { eim.setProperty("groomId", "0"); eim.setProperty("brideId", "0"); eim.setProperty("confirmedVows", "-1"); + eim.setProperty("groomWishlist", ""); + eim.setProperty("brideWishlist", ""); + eim.initializeGiftItems(); eim.getInstanceMap(680000400).resetPQ(level); if(eventBoss) spawnCakeBoss(eim); @@ -105,9 +108,11 @@ function respawnStages(eim) { } function playerEntry(eim, player) { - var map = eim.getMapInstance(entryMap); - + eim.setProperty("giftedItemG" + player.getId(), "0"); + eim.setProperty("giftedItemB" + player.getId(), "0"); player.getClient().getAbstractPlayerInteraction().gainItem(4000313, 1); + + var map = eim.getMapInstance(entryMap); player.changeMap(map, map.getPortal(0)); } diff --git a/scripts/event/WeddingChapel.js b/scripts/event/WeddingChapel.js index fbf147bad4..259e790c32 100644 --- a/scripts/event/WeddingChapel.js +++ b/scripts/event/WeddingChapel.js @@ -77,7 +77,7 @@ function spawnCakeBoss(eim) { } function setup(level, lobbyid) { - var eim = em.newInstance("Wedding" + lobbyid); + var eim = em.newMarriage("Wedding" + lobbyid); eim.setProperty("weddingId", "0"); eim.setProperty("weddingStage", "0"); // 0: gathering time, 1: wedding time, 2: ready to fulfill the wedding, 3: just married eim.setProperty("guestBlessings", "0"); @@ -86,6 +86,9 @@ function setup(level, lobbyid) { eim.setProperty("groomId", "0"); eim.setProperty("brideId", "0"); eim.setProperty("confirmedVows", "-1"); + eim.setProperty("groomWishlist", ""); + eim.setProperty("brideWishlist", ""); + eim.initializeGiftItems(); eim.getInstanceMap(680000400).resetPQ(level); if(eventBoss) spawnCakeBoss(eim); @@ -105,9 +108,11 @@ function respawnStages(eim) { } function playerEntry(eim, player) { - var map = eim.getMapInstance(entryMap); - + eim.setProperty("giftedItemG" + player.getId(), "0"); + eim.setProperty("giftedItemB" + player.getId(), "0"); player.getClient().getAbstractPlayerInteraction().gainItem(4000313, 1); + + var map = eim.getMapInstance(entryMap); player.changeMap(map, map.getPortal(0)); } diff --git a/scripts/npc/2042000.js b/scripts/npc/2042000.js index 726519e0b7..bc837166a2 100644 --- a/scripts/npc/2042000.js +++ b/scripts/npc/2042000.js @@ -1,8 +1,23 @@ -var map = 980000000; -var minLvl = 0; -var maxLvl = 255; -var minAmt = 0; -var maxAmt = 6; + +var status = 0; +var rnk = -1; +var n1 = 50; //??? +var n2 = 40; //??? ??? +var n3 = 7; //35 +var n4 = 10; //40 +var n5 = 20; //50 + +var cpqMap = 980000000; +var cpqMinLvl = 0; +var cpqMaxLvl = 255; +var cpqMinAmt = 0; +var cpqMaxAmt = 6; + +// Ronan's custom ore refiner NPC +var refineRocks = true; // enables moon rock, star rock +var refineCrystals = true; // enables common crystals +var refineSpecials = true; // enables lithium, special crystals +var feeMultiplier = 7.0; function start() { status = -1; @@ -13,7 +28,7 @@ function action(mode, type, selection) { if (mode == -1) { cm.dispose(); } else { - if (mode == 0 && status == 0) { + if (status >= 0 && mode == 0) { cm.dispose(); return; } @@ -21,64 +36,532 @@ function action(mode, type, selection) { status++; else status--; - if (status == 0) { - if (cm.getParty() == null) { - status = 10; - cm.sendOk("#eÉ necessário criar um grupo antes de começar o Festival de Monstros!#k"); - } else if (!cm.isLeader()) { - status = 10; - cm.sendOk("Se você quer começar o Festival, avise o #blíder do grupo#k para falar comigo."); - } else { - var party = cm.getParty().getMembers(); - var inMap = cm.partyMembersInMap(); - var lvlOk = 0; - var isInMap = 0; - for (var i = 0; i < party.size(); i++) { - if (party.get(i).getLevel() >= minLvl && party.get(i).getLevel() <= maxLvl) { - lvlOk++; + + if (cm.getPlayer().getMapId() == 980000010) { + if (status == 0) { + cm.sendNext("Eu espero que voc� tenha divertido na Folia dos Monstros!"); + } else if (status > 0) { + cm.warp(980000000, 0); + cm.dispose(); + } + } else if (cm.getChar().getMap().isCPQLoserMap()) { + if (status == 0) { + if (cm.getChar().getParty() != null) { + var shiu = ""; + if (cm.getPlayer().getFestivalPoints() >= 300) { + shiu += "#rA#k"; + cm.sendOk("Infelizmente, voc� ou empatou ou perdeu a batalha, apesar da sua excelente performance. A vit�ria pode ser sua da pr�xima vez.\r\n\r\n#bNota da Folia de Monstros : " + shiu); + rnk = 10; + } else if (cm.getPlayer().getFestivalPoints() >= 100) { + shiu += "#rB#k"; + rnk = 20; + cm.sendOk("Infelizmente, voc� ou empatou ou perdeu a batalha, mesmo com sua �tima performance. S� mais um pouquinho, e a vit�ria poderia ter sido sua.\r\n\r\n#bNota da Folia de Monstros : " + shiu); + } else if (cm.getPlayer().getFestivalPoints() >= 50) { + shiu += "#rC#k"; + rnk = 30; + cm.sendOk("Infelizmente, voc� ou empatou ou perdeu a batalha. A vit�ria est� para aqueles que se esfor�am. Vejo seus esfor�os, ent�o a vit�ria n�o est� t�o longe do seu alcance. Continue assim!\r\n\r\n#bNota da Folia de Monstros : " + shiu); + } else { + shiu += "#rD#k"; + rnk = 40; + cm.sendOk("Infelizmente, voc� ou empatou ou perdeu a batalha, e sua performance claramente reflete nisso. Espero mais de voc� da pr�xima vez.\r\n\r\n#bNota da Folia de Monstros : " + shiu); } - if (party.get(i).getPlayer().getMapId() != 980000000) { - //isInMap = false; - isInMap++ - } - } - - if (party >= 1) { - status = 10; - cm.sendOk("Você não tem número suficiente de pessoas em seu grupo. Você precisa de um grupo com #b" + minAmt + "#k - #r" + maxAmt + "#k membros e eles devem estar no mapa com você."); - } else if (lvlOk != inMap) { - status = 10; - cm.sendOk("Certifique se todos em seu grupo estão dentre os níveis corretos (" + minLvl + "~" + maxLvl + ")!"); - } else if (isInMap > 0) { - status = 10; - cm.sendOk("Existe alguém do grupo que não esta no mapa!"); } else { - cm.sendCPQMapLists(); + cm.warp(980000000, 0); + cm.dispose(); + } + } else if (status == 1) { + switch (rnk) { + case 10: + cm.warp(980000000, 0); + cm.gainExp(17500); + cm.dispose(); + break; + case 20: + cm.warp(980000000, 0); + cm.gainExp(1200); + cm.dispose(); + break; + case 30: + cm.warp(980000000, 0); + cm.gainExp(5000); + cm.dispose(); + break; + case 40: + cm.warp(980000000, 0); + cm.gainExp(2500); + cm.dispose(); + break; + default: + cm.warp(980000000, 0); + cm.dispose(); + break; } } - } else if (status == 1) { - - if (cm.fieldTaken(selection)) { - if (cm.fieldLobbied(selection)) { - cm.challengeParty(selection); - cm.dispose(); + } else if (cm.getChar().getMap().isCPQWinnerMap()) { + if (status == 0) { + if (cm.getChar().getParty() != null) { + var shi = ""; + if (cm.getPlayer().getFestivalPoints() >= 300) { + shi += "#rA#k"; + rnk = 1; + cm.sendOk("Parab�ns pela sua vit�ria!!! Que �tima performance! O grupo advers�rio n�o p�de fazer nada! Espero o mesmo bom trabalho da pr�xima vez!\r\n\r\n#bNota da Folia de Monstros : " + shi); + } else if (cm.getPlayer().getFestivalPoints() >= 100) { + shi += "#rB#k"; + rnk = 2; + cm.sendOk("Parab�ns pela sua vit�ria! Isso foi impressionante! Voc� fez um bom trabalho contra o grupo advers�rio! S� mais um pouco, e voc� definitivamente vai conseguir um A na pr�xima vez. \r\n\r\n#bNota da Folia de Monstros : " + shi); + } else if (cm.getPlayer().getFestivalPoints() >= 50) { + shi += "#rC#k"; + rnk = 3; + cm.sendOk("Parab�ns pela sua vit�ria. Voc� fez algumas coisas c� e l�, mas essa n�o pode ser considerada uma boa vit�ria. Espero mais de ti da pr�xima vez.\r\n\r\n#bNota da Folia de Monstros : " + shi); + } else { + shi += "#rD#k"; + rnk = 4; + cm.sendOk("Parab�ns pela sua vit�ria, entretanto sua performance n�o refletiu muito bem isso. Seja mais ativo na sua pr�xima participa��o da Folia de Monstros!\r\n\r\n#bNota da Folia de Monstros : " + shi); + } } else { - cm.sendOk("A sala esta cheia."); + cm.warp(980000000, 0); cm.dispose(); } - } else { - var party = cm.getParty().getMembers(); - if ((selection === 0 || selection === 1 || selection === 2 || selection === 3) && party.size() < 2) { - cm.sendOk("Você precisa de no mínimo 2 player para entrar na competição."); - } else if ((selection === 4 || selection === 5) && party.size() < 3) { - cm.sendOk("Você precisa de no mínimo 3 player para entrar na competição."); + } else if (status == 1) { + switch (rnk) { + case 1: + cm.warp(980000000, 0); + cm.gainExp(50000); + cm.dispose(); + break; + case 2: + cm.warp(980000000, 0); + cm.gainExp(25500); + cm.dispose(); + break; + case 3: + cm.warp(980000000, 0); + cm.gainExp(21000); + cm.dispose(); + break; + case 4: + cm.warp(980000000, 0); + cm.gainExp(19505); + cm.dispose(); + break; + default: + cm.warp(980000000, 0); + cm.dispose(); + break; + } + } + } else if (cm.getMapId() == cpqMap) { // only CPQ1 + if (status == 0) { + if (cm.getParty() == null) { + status = 10; + cm.sendOk("#eÉ necessário criar um grupo antes de começar o Festival de Monstros!#k"); + } else if (!cm.isLeader()) { + status = 10; + cm.sendOk("Se você quer começar o Festival, avise o #blíder do grupo#k para falar comigo."); } else { - cm.cpqLobby(selection); + var party = cm.getParty().getMembers(); + var inMap = cm.partyMembersInMap(); + var lvlOk = 0; + var isOutMap = 0; + for (var i = 0; i < party.size(); i++) { + if (party.get(i).getLevel() >= cpqMinLvl && party.get(i).getLevel() <= cpqMaxLvl) { + lvlOk++; + + if (party.get(i).getPlayer().getMapId() != cpqMap) { + isOutMap++; + } + } + } + + if (party >= 1) { + status = 10; + cm.sendOk("Você não tem número suficiente de pessoas em seu grupo. Você precisa de um grupo com #b" + cpqMinAmt + "#k - #r" + cpqMaxAmt + "#k membros e eles devem estar no mapa com você."); + } else if (lvlOk != inMap) { + status = 10; + cm.sendOk("Certifique se todos em seu grupo estão dentre os níveis corretos (" + cpqMinLvl + "~" + cpqMaxLvl + ")!"); + } else if (isOutMap > 0) { + status = 10; + cm.sendOk("Existe alguém do grupo que não esta no mapa!"); + } else { + cm.sendCPQMapLists(); + } + } + } else if (status == 1) { + if (cm.fieldTaken(selection)) { + if (cm.fieldLobbied(selection)) { + cm.challengeParty(selection); + cm.dispose(); + } else { + cm.sendOk("A sala esta cheia."); + cm.dispose(); + } + } else { + var party = cm.getParty().getMembers(); + if ((selection >= 0 && selection <= 3) && party.size() < 1) { + cm.sendOk("Você precisa de no mínimo 2 player para entrar na competição."); + } else if ((selection >= 4 && selection <= 5) && party.size() < 1) { + cm.sendOk("Você precisa de no mínimo 3 player para entrar na competição."); + } else { + cm.cpqLobby(selection); + } + cm.dispose(); + } + } else if (status == 11) { + cm.dispose(); + } + } else { + if (status == 0) { + var talk = "O que gostaria de fazer? Se voc� nunca participou da Folia de Monstros, voc� precisar� saber de algumas coisas antes de participar.\r\n#b#L0# Ir para o campo da Folia de Monstros 1.#l\r\n#L3# Ir para o campo da Folia de Monstros 2.#l\r\n#L1# Aprender sobre a Folia de Monstros.#l\r\n#L2# Trocar #t4001129#.#l"; + if (Packages.constants.ServerConstants.USE_ENABLE_CUSTOM_NPC_SCRIPT) { + talk += "\r\n#L4# ... Can I just refine my ores?#l"; + } + cm.sendSimple(talk); + } else if (status == 1) { + if (selection == 0) { + if ((cm.getLevel() > 29 && cm.getLevel() < 51) || cm.getPlayer().isGM()) { + cm.getChar().saveLocation("MONSTER_CARNIVAL"); + cm.warp(980000000, 0); + cm.dispose(); + return; + } else if (cm.getLevel() < 30) { + cm.sendOk("Voc� precisa ser no m�nimo n�vel 30 para participar da Folia de Monstros. Fale comigo quando for forte o bastante."); + cm.dispose(); + return; + } else { + cm.sendOk("Sinto muito, mas apenas os jogadores de n�vel 30~50 podem participar da Folia de Monstros."); + cm.dispose(); + return; + } + } else if (selection == 1) { + status = 60; + cm.sendSimple("O que gostaria de fazer?\r\n#b#L0# O que � a Folia de Monstros?#l\r\n#L1# Vis�o geral sobre a Folia de Monstros#l\r\n#L2# Informa��es detalhadas sobre a Folia de Monstros#l\r\n#L3# Nada, de verdade. Mudei de ideia.#l"); + } else if (selection == 2) { + cm.sendSimple("Lembre-se se voc� possui #t4001129#, voc� pode troc�-las por itens. Tenha certeza que voc� possui #t4001129# suficientes para o item que voc� deseja. Selecione o item que voc� gostaria de troc�-las! \r\n#b#L0# #t1122007#(" + n1 + " moedas)#l\r\n#L1# #t2041211#(" + n2 + " moedas)#l\r\n#L2# Armas para Guerreiros#l\r\n#L3# Armas para Bruxos#l\r\n#L4# Armas para Arqueiros#l\r\n#L5# Armas para Gatunos#l"); + } else if (selection == 3) { + cm.getChar().saveLocation("MONSTER_CARNIVAL"); + cm.warp(980030000, 0); + cm.dispose(); + return; + } else if (selection == 4) { + var selStr = "Very well, instead I offer a steadfast #bore refining#k service for you, taxing #r" + ((feeMultiplier * 100) | 0) + "%#k over the usual fee to synthetize them. What will you do?#b"; + + var options = new Array("Refine mineral ores","Refine jewel ores"); + if(refineCrystals) { + options.push("Refine crystal ores"); + } + if(refineRocks) { + options.push("Refine plates/jewels"); + } + + for (var i = 0; i < options.length; i++){ + selStr += "\r\n#L" + i + "# " + options[i] + "#l"; + } + + cm.sendSimple(selStr); + + status = 76; + } + } else if (status == 2) { + select = selection; + if (select == 0) { + if (cm.haveItem(4001129, n1) && cm.canHold(4001129)) { + cm.gainItem(1122007, 1); + cm.gainItem(4001129, -n1); + cm.dispose(); + } else { + cm.sendOk("Verifique e veja se est�o faltando #b#t4001129##k ou se seu invent�rio de Equipamentos est� cheio."); + cm.dispose(); + } + } else if (select == 1) { + if (cm.haveItem(4001129, n2) && cm.canHold(2041211)) { + cm.gainItem(2041211, 1); + cm.gainItem(4001129, -n2); + cm.dispose(); + } else { + cm.sendOk("Verifique e veja se est�o faltando #b#t4001129##k ou se seu invent�rio de Uso est� cheio."); + cm.dispose(); + } + } else if (select == 2) {//S2 Warrior 26 S3 Magician 6 S4 Bowman 6 S5 Thief 8 + status = 10; + cm.sendSimple("Por favor tenha certeza que voc� possui #t4001129# para a arma que voc� deseja. Selecione a arma que voc� gostaria de trocar #t4001129# por. As op��es que tenho s�o realmente boas, e eu n�o sou eu que falo � o povo que diz! \r\n#b#L0# #z1302004#(" + n3 + " moedas)#l\r\n#L1# #z1402006#(" + n3 + " moedas)#l\r\n#L2# #z1302009#(" + n4 + " moedas)#l\r\n#L3# #z1402007#(" + n4 + " moedas)#l\r\n#L4# #z1302010#(" + n5 + " moedas)#l\r\n#L5# #z1402003#(" + n5 + " moedas)#l\r\n#L6# #z1312006#(" + n3 + " moedas)#l\r\n#L7# #z1412004#(" + n3 + " moedas)#l\r\n#L8# #z1312007#(" + n4 + " moedas)#l\r\n#L9# #z1412005#(" + n4 + " moedas)#l\r\n#L10# #z1312008#(" + n5 + " moedas)#l\r\n#L11# #z1412003#(" + n5 + " moedas)#l\r\n#L12# Ir para a pr�xima p�gina(1/2)#l"); + } else if (select == 3) { + status = 20; + cm.sendSimple("Selecione a arma que voc� gostaria de trocar. As armas que eu tenho aqui s�o extremamente atraentes. Veja voc� mesmo! \r\n#b#L0# #z1372001#(" + n3 + " moedas)#l\r\n#L1# #z1382018#(" + n3 + " moedas)#l\r\n#L2# #z1372012#(" + n4 + "moedas)#l\r\n#L3# #z1382019#(" + n4 + "moedas)#l\r\n#L4# #z1382001#(" + n5 + " moedas)#l\r\n#L5# #z1372007#(" + n5 + " moedas)#l"); + } else if (select == 4) { + status = 30; + cm.sendSimple("Selecione a arma que voc� gostaria de trocar. As armas que eu tenho aqui s�o extremamente atraentes. Veja voc� mesmo! \r\n#b#L0# #z1452006#(" + n3 + " moedas)#l\r\n#L1# #z1452007#(" + n4 + " moedas)#l\r\n#L2# #z1452008#(" + n5 + " moedas)#l\r\n#L3# #z1462005#(" + n3 + " moedas)#l\r\n#L4# #z1462006#(" + n4 + " moedas)#l\r\n#L5# #z1462007#(" + n5 + " moedas)#l"); + } else if (select == 5) { + status = 40; + cm.sendSimple("Selecione a arma que voc� gostaria de trocar por. As armas que eu tenho s�o da maior qualidade. Seleciona a mais atraente para voc�! \r\n#b#L0# #z1472013#(" + n3 + " moedas)#l\r\n#L1# #z1472017#(" + n4 + "moedas)#l\r\n#L2# #z1472021#(" + n5 + " moedas)#l\r\n#L3# #z1332014#(" + n3 + " moedas)#l\r\n#L4# #z1332031#(" + n4 + "moedas)#l\r\n#L5# #z1332011#(" + n4 + "moedas)#l\r\n#L6# #z1332016#(" + n5 + " moedas)#l\r\n#L7# #z1332003#(" + n5 + " moedas)#l"); + } + } else if (status == 11) { + if (selection == 12) { + cm.sendSimple("Selecione a arma que voc� gostaria de trocar. As armas que eu tenho aqui s�o extremamente �teis. D� uma olhada! \r\n#b#L0# #z1322015#(" + n3 + " moedas)#l\r\n#L1# #z1422008#(" + n3 + " moedas)#l\r\n#L2# #z1322016#(" + n4 + "moedas)#l\r\n#L3# #z1422007#(" + n4 + "moedas)#l\r\n#L4# #z1322017#(" + n5 + " moedas)#l\r\n#L5# #z1422005#(" + n5 + " moedas)#l\r\n#L6# #z1432003#(" + n3 + " moedas)#l\r\n#L7# #z1442003#(" + n3 + " moedas)#l\r\n#L8# #z1432005#(" + n4 + "moedas)#l\r\n#L9# #z1442009#(" + n4 + "moedas)#l\r\n#L10# #z1442005#(" + n5 + " moedas)#l\r\n#L11# #z1432004#(" + n5 + " moedas)#l\r\n#L12# Voltar para a p�gina inicial(2/2)#l"); + } else { + var item = new Array(1302004, 1402006, 1302009, 1402007, 1302010, 1402003, 1312006, 1412004, 1312007, 1412005, 1312008, 1412003); + var cost = new Array(n3, n3, n4, n4, n5, n5, n3, n3, n4, n4, n5); + if (cm.haveItem(4001129, cost[selection]) && cm.canHold(item[selection])) { + cm.gainItem(item[selection], 1); + cm.gainItem(4001129, -cost[selection]); + cm.dispose(); + } else { + cm.sendOk("Voc� ou n�o possui #b#t4001129##k suficientes, ou seu invent�rio est� cheio. Verifique novamente."); + cm.dispose(); + } + } + } else if (status == 12) { + if (selection == 12) { + status = 10; + cm.sendSimple("Por favor tenha certeza que voc� possui #t4001129# para a arma que voc� deseja. Selecione a arma que voc� gostaria de trocar #t4001129# por. As op��es que tenho s�o realmente boas, e eu n�o sou eu que falo � o povo que diz! \r\n#b#L0# #z1302004#(" + n3 + " moedas)#l\r\n#L1# #z1402006#(" + n3 + " moedas)#l\r\n#L2# #z1302009#(" + n4 + " moedas)#l\r\n#L3# #z1402007#(" + n4 + " moedas)#l\r\n#L4# #z1302010#(" + n5 + " moedas)#l\r\n#L5# #z1402003#(" + n5 + " moedas)#l\r\n#L6# #z1312006#(" + n3 + " moedas)#l\r\n#L7# #z1412004#(" + n3 + " moedas)#l\r\n#L8# #z1312007#(" + n4 + " moedas)#l\r\n#L9# #z1412005#(" + n4 + " moedas)#l\r\n#L10# #z1312008#(" + n5 + " moedas)#l\r\n#L11# #z1412003#(" + n5 + " moedas)#l\r\n#L12# Ir para a pr�xima p�gina(1/2)#l"); + } else { + var item = new Array(1322015, 1422008, 1322016, 1422007, 1322017, 1422005, 1432003, 1442003, 1432005, 1442009, 1442005, 1432004); + var cost = new Array(n3, n3, n4, n4, n5, n5, n3, n3, n4, n4, n5, n5); + if (cm.haveItem(4001129, cost[selection]) && cm.canHold(item[selection])) { + cm.gainItem(item[selection], 1); + cm.gainItem(4001129, -cost[selection]); + cm.dispose(); + } else { + cm.sendOk("Voc� ou n�o possui #b#t4001129##k suficientes, ou seu invent�rio est� cheio. Verifique novamente."); + cm.dispose(); + } + } + } else if (status == 21) { + var item = new Array(1372001, 1382018, 1372012, 1382019, 1382001, 1372007); + var cost = new Array(n3, n3, n4, n4, n5, n5); + if (cm.haveItem(4001129, cost[selection]) && cm.canHold(item[selection])) { + cm.gainItem(item[selection], 1); + cm.gainItem(4001129, -cost[selection]); + cm.dispose(); + } else { + cm.sendOk("Ou voc� n�o possui #b#t4001129##k suficientes, ou seu invent�rio est� cheio. Verifique novamente."); + cm.dispose(); + } + } else if (status == 31) { + var item = new Array(1452006, 1452007, 1452008, 1462005, 1462006, 1462007); + var cost = new Array(n3, n4, n5, n3, n4, n5); + if (cm.haveItem(4001129, cost[selection]) && cm.canHold(item[selection])) { + cm.gainItem(item[selection], 1); + cm.gainItem(4001129, -cost[selection]); + cm.dispose(); + } else { + cm.sendOk("Ou voc� n�o possui #b#t4001129##k suficientes, ou seu invent�rio est� cheio. Verifique novamente."); + cm.dispose(); + } + } else if (status == 41) { + var item = new Array(1472013, 1472017, 1472021, 1332014, 1332031, 1332011, 1332016, 1332003); + var cost = new Array(n3, n4, n5, n3, n4, n4, n5, n5); + if (cm.haveItem(4001129, cost[selection]) && cm.canHold(item[selection])) { + cm.gainItem(item[selection], 1); + cm.gainItem(4001129, -cost[selection]); + cm.dispose(); + } else { + cm.sendOk("Ou voc� n�o possui #b#t4001129##k suficientes, ou seu invent�rio est� cheio. Verifique novamente."); + cm.dispose(); + } + } else if (status == 61) { + select = selection; + if (selection == 0) { + cm.sendNext("Haha! Eu sou Spiegelmann, o l�der dessa Folia. Eu comecei a primeira #bFolia de Monstros#k aqui, aguardando por viajantes como voc� para participar dessa extravaganza!"); + } else if (selection == 1) { + cm.sendNext("#bFolia de Monstros#k consiste em 2 grupos entrando no campo de batalha, e ca�ando os monstros invocados pelo outro grupo. � uma #bmiss�o de combate que determina o vitorioso pela quantia de Pontos de Folia (CP) recebidos#k."); + } else if (selection == 2) { + cm.sendNext("Quando entrar no Campo da Folia, voc� ver� a janela da Folia de Monstros aparecer. Tudo que precisa fazer � #bselecionar o que voc�e quer usar, e pressionar OK#k. Muito f�cil, n�?"); + } else { + cm.dispose(); + } + } else if (status == 62) { + if (select == 0) { + cm.sendNext("O que � a #bFolia de Monstros#k? Hahaha! Vamos dizer que � uma experi�ncia que jamais esquecer�! � uma #bbatalha contra outros viajantes assim como voc�!#k"); + } else if (select == 1) { + cm.sendNext("Quando entrar no Campo da Folia, sua tarefa � #breceber CP ca�ando os monstros do grupo oposto, e usar estes CP's para distrair o grupo oposto de ca�ar monstros.#k."); + } else if (select == 2) { + cm.sendNext("Assim que se acostumar com os comandos, tente usar #bas teclas TAB e F1 ~ F12#k. #bTAB alterna entre Invoca��o de Monstros/Habilidades/Protetor,#k e, #bF1~ F12 possibilita-o de acessar uma das janelas diretamente#k."); + } + } else if (status == 63) { + if (select == 0) { + cm.sendNext("Eu sei que � muito perigoso para voc�s lutarem uns com os outros usando armas de verdade; e eu n�o sugeriria um ato t�o barb�rico. N�o meu amigo, o que eu ofere�o � competi��o. A emo��o da batalha e a emo��o de competir contra pessoas t�o fortes e motivadas. Eu ofere�o a premissa de que seu grupo e o grupo oposto ambos #binvoquem os monstros, e derrote os monstros invocados pelo grupo advers�rio. Essa � a ess�ncia da Folia de Monstros. Al�m disso, voc� pode usar Maple Coins ganhos durante a Folia de Monstros para obter novos itens e armas! #k"); + } else if (select == 1) { + cm.sendNext("Existem 3 maneiras de distrair o grupo advers�rio: #bInvodar um monstro, Habilidade, and Protetor#k. Vou dar-lhe um olhar mais aprofundado, se voc� quiser saber mais sobre 'Instru��es detalhadas'."); + } else if (select == 2) { + cm.sendNext("#bInvocar um Monstro#k chama um monstro que ataca o grupo advers�rio, sob seu controle. Use CP para trazer um Monstro Invocado, e ele ir� aparecer na mesma �rea, atacando o grupo oposto."); + } + } else if (status == 64) { + if (select == 0) { + cm.sendNext("Claro, n�o � t�o simples assim. Existem outras maneiras de prevenir o outro grupo de ca�ar monstros, e cabe a voc� descobrir como faz�-lo. O que acha? Interessado em uma competi��o amig�vel?"); + cm.dispose(); + } else if (select == 1) { + cm.sendNext("Por favor lembre-se. Nunca � uma boa ideia guardar seus CP's. #bOs CP's que voc� usou ir�o ajudar a determinar o vencedor e o perdedor da Folia."); + } else if (select == 2) { + cm.sendNext("#bHabilidade#k � uma op��o de usar habilidades tais como Escurid�o, Fraqueza, e outras para prevenir o grupo oposto de matar outros monstros. S�o necess�rios muitos CP's, mas vale muito a pena. O �nico problema � que eles n�o duram muito. Use essa t�tica com sabedoria!"); + } + } else if (status == 65) { + if (select == 1) { + cm.sendNext("Oh, e n�o se preocupe em tranformar-se em um fantasma. Na Folia de Monstros, #bvoc� n�o perder� EXP ap�s a morte#k. � realmente uma exper�ncia como nenhuma outra!"); + cm.dispose(); + } else if (select == 2) { + cm.sendNext("#bProtetor#k � basicamente um item invocado que aumenta dr�sticamente as habilidades dos monstros invocados pelo seu grupo. Protetor funciona enquanto n�o for demolido pelo grupo oposto, ent�o eu surigo que voc� invoque v�rios monstros primeiro, e ent�o traga o Protetor."); + } + } else if (status == 66) { + cm.sendNext("Por �ltimo, enquanto estiver na Folia de Monstros, #bvoc� n�o pode usar items/po��es de recupera��o que voc� leva por ai contigo.#k Entretanto, os monstros deixam esses items cair de vez em quando, e #bassim que peg�-los, o item ativar� imediatamente#k. � por isso que � importante saber quando pegar estes items."); + cm.dispose(); + } else if (status == 77) { + var allDone; + + if (selection == 0) { + allDone = refineItems(0); // minerals + } else if (selection == 1) { + allDone = refineItems(1); // jewels + } else if (selection == 2 && refineCrystals) { + allDone = refineItems(2); // crystals + } else if (selection == 2 && !refineCrystals || selection == 3) { + allDone = refineRockItems(); // moon/star rock + } + + if(allDone) { + cm.sendOk("Done. Thanks for showing up~."); + } else { + cm.sendOk("Done. Be aware some of the items #rcould not be synthetized#k because either you have a lack of space on your ETC inventory or there's not enough mesos to cover the fee."); } cm.dispose(); } - } else if (status == 11) { - cm.dispose(); } } -} \ No newline at end of file +} + +function getRefineFee(fee) { + return ((feeMultiplier * fee) | 0); +} + +function isRefineTarget(refineType, refineItemid) { + if(refineType == 0) { //mineral refine + return refineItemid >= 4010000 && refineItemid <= 4010007 && !(refineItemid == 4010007 && !refineSpecials); + } else if(refineType == 1) { //jewel refine + return refineItemid >= 4020000 && refineItemid <= 4020008 && !(refineItemid == 4020008 && !refineSpecials); + } else if(refineType == 2) { //crystal refine + return refineItemid >= 4004000 && refineItemid <= 4004004 && !(refineItemid == 4004004 && !refineSpecials); + } + + return false; +} + +function getRockRefineTarget(refineItemid) { + if(refineItemid >= 4011000 && refineItemid <= 4011006) { + return 0; + } else if(refineItemid >= 4021000 && refineItemid <= 4021008) { + return 1; + } + + return -1; +} + +function refineItems(refineType) { + var allDone = true; + + var refineFees = [[300,300,300,500,500,500,800,270],[500,500,500,500,500,500,500,1000,3000],[5000,5000,5000,5000,1000000]]; + var itemCount = {}; + + var iter = cm.getPlayer().getInventory(Packages.client.inventory.MapleInventoryType.ETC).iterator(); + while (iter.hasNext()) { + var it = iter.next(); + var itemid = it.getItemId(); + + if(isRefineTarget(refineType, itemid)) { + var ic = itemCount[itemid]; + + if(ic != undefined) { + itemCount[itemid] += it.getQuantity(); + } else { + itemCount[itemid] = it.getQuantity(); + } + } + } + + for(var key in itemCount) { + var itemqty = itemCount[key]; + var itemid = parseInt(key); + + var refineQty = ((itemqty / 10) | 0); + if(refineQty <= 0) continue; + + while(true) { + itemqty = refineQty * 10; + + var fee = getRefineFee(refineFees[refineType][(itemid % 100) | 0] * refineQty); + if(cm.canHold(itemid + 1000, refineQty, itemid, itemqty) && cm.getMeso() >= fee) { + cm.gainMeso(-fee); + cm.gainItem(itemid, -itemqty); + cm.gainItem(itemid + (itemid != 4010007 ? 1000 : 1001), refineQty); + + break; + } else if(refineQty <= 1) { + allDone = false; + break; + } else { + refineQty--; + } + } + } + + return allDone; +} + +function refineRockItems() { + var allDone = true; + var minItems = [[0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0]]; + var minRocks = [2147483647, 2147483647]; + + var rockItems = [4011007, 4021009]; + var rockFees = [10000, 15000]; + + var iter = cm.getPlayer().getInventory(Packages.client.inventory.MapleInventoryType.ETC).iterator(); + while (iter.hasNext()) { + var it = iter.next(); + var itemid = it.getItemId(); + var rockRefine = getRockRefineTarget(itemid); + if(rockRefine >= 0) { + var rockItem = ((itemid % 100) | 0); + var itemqty = it.getQuantity(); + + minItems[rockRefine][rockItem] += itemqty; + } + } + + for(var i = 0; i < minRocks.length; i++) { + for(var j = 0; j < minItems[i].length; j++) { + if(minRocks[i] > minItems[i][j]) { + minRocks[i] = minItems[i][j]; + } + } + if(minRocks[i] <= 0 || minRocks[i] == 2147483647) continue; + + var refineQty = minRocks[i]; + while(true) { + var fee = getRefineFee(rockFees[i] * refineQty); + if(cm.canHold(rockItems[i], refineQty) && cm.getMeso() >= fee) { + cm.gainMeso(-fee); + + var j; + if(i == 0) { + for(j = 4011000; j < 4011007; j++) { + cm.gainItem(j, -refineQty); + } + cm.gainItem(j, refineQty); + } else { + for(j = 4021000; j < 4021009; j++) { + cm.gainItem(j, -refineQty); + } + cm.gainItem(j, refineQty); + } + + break; + } else if(refineQty <= 1) { + allDone = false; + break; + } else { + refineQty--; + } + } + } + + return allDone; +} diff --git a/scripts/npc/2042002.js b/scripts/npc/2042002.js index 4f7ae7d9c3..914181d11d 100644 --- a/scripts/npc/2042002.js +++ b/scripts/npc/2042002.js @@ -1,4 +1,3 @@ -importPackage(Packages.server.maps); var status = 0; var rnk = -1; @@ -8,6 +7,12 @@ var n3 = 7; //35 var n4 = 10; //40 var n5 = 20; //50 +// Ronan's custom ore refiner NPC +var refineRocks = true; // enables moon rock, star rock +var refineCrystals = true; // enables common crystals +var refineSpecials = true; // enables lithium, special crystals +var feeMultiplier = 7.0; + function start() { status = -1; action(1, 0, 0); @@ -25,9 +30,10 @@ function action(mode, type, selection) { status++; else status--; + if (cm.getPlayer().getMapId() == 980000010) { if (status == 0) { - cm.sendNext("Eu espero que você tinha divertido na Folia dos Monstros!"); + cm.sendNext("Eu espero que voc� tenha divertido na Folia dos Monstros!"); } else if (status > 0) { cm.warp(980000000, 0); cm.dispose(); @@ -36,22 +42,22 @@ function action(mode, type, selection) { if (status == 0) { if (cm.getChar().getParty() != null) { var shiu = ""; - if (cm.getPlayer().getFestivalPoints() >= 100) { + if (cm.getPlayer().getFestivalPoints() >= 300) { shiu += "#rA#k"; - cm.sendOk("Infelizmente, você ou empatou ou perdeu a batalha, apesar da sua excelente performance. A vitória pode ser sua da próxima vez.\r\n\r\n#bNota da Folia de Monstros : " + shiu); + cm.sendOk("Infelizmente, voc� ou empatou ou perdeu a batalha, apesar da sua excelente performance. A vit�ria pode ser sua da pr�xima vez.\r\n\r\n#bNota da Folia de Monstros : " + shiu); rnk = 10; - } else if (cm.getPlayer().getFestivalPoints() >= 50 && cm.getPlayer().getFestivalPoints() < 100) { + } else if (cm.getPlayer().getFestivalPoints() >= 100) { shiu += "#rB#k"; rnk = 20; - cm.sendOk("Infelizmente, você ou empatou ou perdeu a batalha, mesmo com sua ótima performance. Só mais um pouquinho, e a vitória poderia ter sido sua.\r\n\r\n#bNota da Folia de Monstros : " + shiu); - } else if (cm.getPlayer().getFestivalPoints() >= 30 && cm.getPlayer().getFestivalPoints() < 50) { + cm.sendOk("Infelizmente, voc� ou empatou ou perdeu a batalha, mesmo com sua �tima performance. S� mais um pouquinho, e a vit�ria poderia ter sido sua.\r\n\r\n#bNota da Folia de Monstros : " + shiu); + } else if (cm.getPlayer().getFestivalPoints() >= 50) { shiu += "#rC#k"; rnk = 30; - cm.sendOk("Infelizmente, você ou empatou ou perdeu a batalha. A vitória está para aqueles que se esforçam. Vejo seus esforços, então a vitória não está tão longe do seu alcance. Continue assim!\r\n\r\n#bNota da Folia de Monstros : " + shiu); + cm.sendOk("Infelizmente, voc� ou empatou ou perdeu a batalha. A vit�ria est� para aqueles que se esfor�am. Vejo seus esfor�os, ent�o a vit�ria n�o est� t�o longe do seu alcance. Continue assim!\r\n\r\n#bNota da Folia de Monstros : " + shiu); } else { shiu += "#rD#k"; rnk = 40; - cm.sendOk("Infelizmente, você ou empatou ou perdeu a batalha, e sua performance claramente reflete nisso. Espero mais de você da próxima vez.\r\n\r\n#bNota da Folia de Monstros : " + shiu); + cm.sendOk("Infelizmente, voc� ou empatou ou perdeu a batalha, e sua performance claramente reflete nisso. Espero mais de voc� da pr�xima vez.\r\n\r\n#bNota da Folia de Monstros : " + shiu); } } else { cm.warp(980000000, 0); @@ -92,19 +98,19 @@ function action(mode, type, selection) { if (cm.getPlayer().getFestivalPoints() >= 300) { shi += "#rA#k"; rnk = 1; - cm.sendOk("Parabéns pela sua vitória!!! Que ótima performance! O grupo adversário não pôde fazer nada! Espero o mesmo bom trabalho da próxima vez!\r\n\r\n#bNota da Folia de Monstros : " + shi); - } else if (cm.getPlayer().getFestivalPoints() >= 100 && cm.getPlayer().getFestivalPoints() < 300) { + cm.sendOk("Parab�ns pela sua vit�ria!!! Que �tima performance! O grupo advers�rio n�o p�de fazer nada! Espero o mesmo bom trabalho da pr�xima vez!\r\n\r\n#bNota da Folia de Monstros : " + shi); + } else if (cm.getPlayer().getFestivalPoints() >= 100) { shi += "#rB#k"; rnk = 2; - cm.sendOk("Parabéns pela sua vitória! Isso foi impressionante! Você fez um bom trabalho contra o grupo adversário! Só mais um pouco, e você definitivamente vai conseguir um A na próxima vez. \r\n\r\n#bNota da Folia de Monstros : " + shi); - } else if (cm.getPlayer().getFestivalPoints() >= 50 && cm.getPlayer().getFestivalPoints() < 100) { + cm.sendOk("Parab�ns pela sua vit�ria! Isso foi impressionante! Voc� fez um bom trabalho contra o grupo advers�rio! S� mais um pouco, e voc� definitivamente vai conseguir um A na pr�xima vez. \r\n\r\n#bNota da Folia de Monstros : " + shi); + } else if (cm.getPlayer().getFestivalPoints() >= 50) { shi += "#rC#k"; rnk = 3; - cm.sendOk("Parabéns pela sua vitória. Você fez algumas coisas cá e lá, mas essa não pode ser considerada uma boa vitória. Espero mais de ti da próxima vez.\r\n\r\n#bNota da Folia de Monstros : " + shi); + cm.sendOk("Parab�ns pela sua vit�ria. Voc� fez algumas coisas c� e l�, mas essa n�o pode ser considerada uma boa vit�ria. Espero mais de ti da pr�xima vez.\r\n\r\n#bNota da Folia de Monstros : " + shi); } else { shi += "#rD#k"; rnk = 4; - cm.sendOk("Parabéns pela sua vitória, entretanto sua performance não refletiu muito bem isso. Seja mais ativo na sua próxima participação da Folia de Monstros!\r\n\r\n#bNota da Folia de Monstros : " + shi); + cm.sendOk("Parab�ns pela sua vit�ria, entretanto sua performance n�o refletiu muito bem isso. Seja mais ativo na sua pr�xima participa��o da Folia de Monstros!\r\n\r\n#bNota da Folia de Monstros : " + shi); } } else { cm.warp(980000000, 0); @@ -140,8 +146,11 @@ function action(mode, type, selection) { } } else { if (status == 0) { - // cm.sendSimple("O que gostaria de fazer? Se você nunca participou da Folia de Monstros, você precisará saber de algumas coisas antes de participar.\r\n#b#L0# Ir para o campo da Folia de Monstros 1.#l\r\n#L1# Aprender sobre a Folia de Monstros.#l\r\n#L2# Trocar #t4001129#.#l"); - cm.sendSimple("O que gostaria de fazer? Se você nunca participou da Folia de Monstros, você precisará saber de algumas coisas antes de participar.\r\n#b#L0# Ir para o campo da Folia de Monstros 1.#l\r\n#L3# Ir para o campo da Folia de Monstros 2.#l\r\n#L1# Aprender sobre a Folia de Monstros.#l\r\n#L2# Trocar #t4001129#.#l"); + var talk = "O que gostaria de fazer? Se voc� nunca participou da Folia de Monstros, voc� precisar� saber de algumas coisas antes de participar.\r\n#b#L0# Ir para o campo da Folia de Monstros 1.#l\r\n#L3# Ir para o campo da Folia de Monstros 2.#l\r\n#L1# Aprender sobre a Folia de Monstros.#l\r\n#L2# Trocar #t4001129#.#l"; + if (Packages.constants.ServerConstants.USE_ENABLE_CUSTOM_NPC_SCRIPT) { + talk += "\r\n#L4# ... Can I just refine my ores?#l"; + } + cm.sendSimple(talk); } else if (status == 1) { if (selection == 0) { if ((cm.getLevel() > 29 && cm.getLevel() < 51) || cm.getPlayer().isGM()) { @@ -150,26 +159,43 @@ function action(mode, type, selection) { cm.dispose(); return; } else if (cm.getLevel() < 30) { - cm.sendOk("Você precisa ser no mínimo nível 30 para participar da Folia de Monstros. Fale comigo quando for forte o bastante."); + cm.sendOk("Voc� precisa ser no m�nimo n�vel 30 para participar da Folia de Monstros. Fale comigo quando for forte o bastante."); cm.dispose(); return; } else { - cm.sendOk("Sinto muito, mas apenas os jogadores de nível 30~50 podem participar da Folia de Monstros."); + cm.sendOk("Sinto muito, mas apenas os jogadores de n�vel 30~50 podem participar da Folia de Monstros."); cm.dispose(); return; } } else if (selection == 1) { status = 60; - cm.sendSimple("O que gostaria de fazer?\r\n#b#L0# O que é a Folia de Monstros?#l\r\n#L1# Visão geral sobre a Folia de Monstros#l\r\n#L2# Informações detalhadas sobre a Folia de Monstros#l\r\n#L3# Nada, de verdade. Mudei de ideia.#l"); + cm.sendSimple("O que gostaria de fazer?\r\n#b#L0# O que � a Folia de Monstros?#l\r\n#L1# Vis�o geral sobre a Folia de Monstros#l\r\n#L2# Informa��es detalhadas sobre a Folia de Monstros#l\r\n#L3# Nada, de verdade. Mudei de ideia.#l"); } else if (selection == 2) { - cm.sendSimple("Lembre-se se você possui #t4001129#, você pode trocá-las por itens. Tenha certeza que você possui #t4001129# suficientes para o item que você deseja. Selecione o item que você gostaria de trocá-las! \r\n#b#L0# #t1122007#(" + n1 + " moedas)#l\r\n#L1# #t2041211#(" + n2 + " moedas)#l\r\n#L2# Armas para Guerreiros#l\r\n#L3# Armas para Bruxos#l\r\n#L4# Armas para Arqueiros#l\r\n#L5# Armas para Gatunos#l"); + cm.sendSimple("Lembre-se se voc� possui #t4001129#, voc� pode troc�-las por itens. Tenha certeza que voc� possui #t4001129# suficientes para o item que voc� deseja. Selecione o item que voc� gostaria de troc�-las! \r\n#b#L0# #t1122007#(" + n1 + " moedas)#l\r\n#L1# #t2041211#(" + n2 + " moedas)#l\r\n#L2# Armas para Guerreiros#l\r\n#L3# Armas para Bruxos#l\r\n#L4# Armas para Arqueiros#l\r\n#L5# Armas para Gatunos#l"); } else if (selection == 3) { cm.getChar().saveLocation("MONSTER_CARNIVAL"); cm.warp(980030000, 0); cm.dispose(); return; - } + } else if (selection == 4) { + var selStr = "Very well, instead I offer a steadfast #bore refining#k service for you, taxing #r" + ((feeMultiplier * 100) | 0) + "%#k over the usual fee to synthetize them. What will you do?#b"; + var options = new Array("Refine mineral ores","Refine jewel ores"); + if(refineCrystals) { + options.push("Refine crystal ores"); + } + if(refineRocks) { + options.push("Refine plates/jewels"); + } + + for (var i = 0; i < options.length; i++){ + selStr += "\r\n#L" + i + "# " + options[i] + "#l"; + } + + cm.sendSimple(selStr); + + status = 76; + } } else if (status == 2) { select = selection; if (select == 0) { @@ -178,7 +204,7 @@ function action(mode, type, selection) { cm.gainItem(4001129, -n1); cm.dispose(); } else { - cm.sendOk("Verifique e veja se estão faltando #b#t4001129##k ou se seu inventário de Equipamentos está cheio."); + cm.sendOk("Verifique e veja se est�o faltando #b#t4001129##k ou se seu invent�rio de Equipamentos est� cheio."); cm.dispose(); } } else if (select == 1) { @@ -187,25 +213,25 @@ function action(mode, type, selection) { cm.gainItem(4001129, -n2); cm.dispose(); } else { - cm.sendOk("Verifique e veja se estão faltando #b#t4001129##k ou se seu inventário de Uso está cheio."); + cm.sendOk("Verifique e veja se est�o faltando #b#t4001129##k ou se seu invent�rio de Uso est� cheio."); cm.dispose(); } } else if (select == 2) {//S2 Warrior 26 S3 Magician 6 S4 Bowman 6 S5 Thief 8 status = 10; - cm.sendSimple("Por favor tenha certeza que você possui #t4001129# para a arma que você deseja. Selecione a arma que você gostaria de trocar #t4001129# por. As opções que tenho são realmente boas, e eu não sou eu que falo é o povo que diz! \r\n#b#L0# #z1302004#(" + n3 + " moedas)#l\r\n#L1# #z1402006#(" + n3 + " moedas)#l\r\n#L2# #z1302009#(" + n4 + " moedas)#l\r\n#L3# #z1402007#(" + n4 + " moedas)#l\r\n#L4# #z1302010#(" + n5 + " moedas)#l\r\n#L5# #z1402003#(" + n5 + " moedas)#l\r\n#L6# #z1312006#(" + n3 + " moedas)#l\r\n#L7# #z1412004#(" + n3 + " moedas)#l\r\n#L8# #z1312007#(" + n4 + " moedas)#l\r\n#L9# #z1412005#(" + n4 + " moedas)#l\r\n#L10# #z1312008#(" + n5 + " moedas)#l\r\n#L11# #z1412003#(" + n5 + " moedas)#l\r\n#L12# Ir para a próxima página(1/2)#l"); + cm.sendSimple("Por favor tenha certeza que voc� possui #t4001129# para a arma que voc� deseja. Selecione a arma que voc� gostaria de trocar #t4001129# por. As op��es que tenho s�o realmente boas, e eu n�o sou eu que falo � o povo que diz! \r\n#b#L0# #z1302004#(" + n3 + " moedas)#l\r\n#L1# #z1402006#(" + n3 + " moedas)#l\r\n#L2# #z1302009#(" + n4 + " moedas)#l\r\n#L3# #z1402007#(" + n4 + " moedas)#l\r\n#L4# #z1302010#(" + n5 + " moedas)#l\r\n#L5# #z1402003#(" + n5 + " moedas)#l\r\n#L6# #z1312006#(" + n3 + " moedas)#l\r\n#L7# #z1412004#(" + n3 + " moedas)#l\r\n#L8# #z1312007#(" + n4 + " moedas)#l\r\n#L9# #z1412005#(" + n4 + " moedas)#l\r\n#L10# #z1312008#(" + n5 + " moedas)#l\r\n#L11# #z1412003#(" + n5 + " moedas)#l\r\n#L12# Ir para a pr�xima p�gina(1/2)#l"); } else if (select == 3) { status = 20; - cm.sendSimple("Selecione a arma que você gostaria de trocar. As armas que eu tenho aqui são extremamente atraentes. Veja você mesmo! \r\n#b#L0# #z1372001#(" + n3 + " moedas)#l\r\n#L1# #z1382018#(" + n3 + " moedas)#l\r\n#L2# #z1372012#(" + n4 + "moedas)#l\r\n#L3# #z1382019#(" + n4 + "moedas)#l\r\n#L4# #z1382001#(" + n5 + " moedas)#l\r\n#L5# #z1372007#(" + n5 + " moedas)#l"); + cm.sendSimple("Selecione a arma que voc� gostaria de trocar. As armas que eu tenho aqui s�o extremamente atraentes. Veja voc� mesmo! \r\n#b#L0# #z1372001#(" + n3 + " moedas)#l\r\n#L1# #z1382018#(" + n3 + " moedas)#l\r\n#L2# #z1372012#(" + n4 + "moedas)#l\r\n#L3# #z1382019#(" + n4 + "moedas)#l\r\n#L4# #z1382001#(" + n5 + " moedas)#l\r\n#L5# #z1372007#(" + n5 + " moedas)#l"); } else if (select == 4) { status = 30; - cm.sendSimple("Selecione a arma que você gostaria de trocar. As armas que eu tenho aqui são extremamente atraentes. Veja você mesmo! \r\n#b#L0# #z1452006#(" + n3 + " moedas)#l\r\n#L1# #z1452007#(" + n4 + " moedas)#l\r\n#L2# #z1452008#(" + n5 + " moedas)#l\r\n#L3# #z1462005#(" + n3 + " moedas)#l\r\n#L4# #z1462006#(" + n4 + " moedas)#l\r\n#L5# #z1462007#(" + n5 + " moedas)#l"); + cm.sendSimple("Selecione a arma que voc� gostaria de trocar. As armas que eu tenho aqui s�o extremamente atraentes. Veja voc� mesmo! \r\n#b#L0# #z1452006#(" + n3 + " moedas)#l\r\n#L1# #z1452007#(" + n4 + " moedas)#l\r\n#L2# #z1452008#(" + n5 + " moedas)#l\r\n#L3# #z1462005#(" + n3 + " moedas)#l\r\n#L4# #z1462006#(" + n4 + " moedas)#l\r\n#L5# #z1462007#(" + n5 + " moedas)#l"); } else if (select == 5) { status = 40; - cm.sendSimple("Selecione a arma que você gostaria de trocar por. As armas que eu tenho são da maior qualidade. Seleciona a mais atraente para você! \r\n#b#L0# #z1472013#(" + n3 + " moedas)#l\r\n#L1# #z1472017#(" + n4 + "moedas)#l\r\n#L2# #z1472021#(" + n5 + " moedas)#l\r\n#L3# #z1332014#(" + n3 + " moedas)#l\r\n#L4# #z1332031#(" + n4 + "moedas)#l\r\n#L5# #z1332011#(" + n4 + "moedas)#l\r\n#L6# #z1332016#(" + n5 + " moedas)#l\r\n#L7# #z1332003#(" + n5 + " moedas)#l"); + cm.sendSimple("Selecione a arma que voc� gostaria de trocar por. As armas que eu tenho s�o da maior qualidade. Seleciona a mais atraente para voc�! \r\n#b#L0# #z1472013#(" + n3 + " moedas)#l\r\n#L1# #z1472017#(" + n4 + "moedas)#l\r\n#L2# #z1472021#(" + n5 + " moedas)#l\r\n#L3# #z1332014#(" + n3 + " moedas)#l\r\n#L4# #z1332031#(" + n4 + "moedas)#l\r\n#L5# #z1332011#(" + n4 + "moedas)#l\r\n#L6# #z1332016#(" + n5 + " moedas)#l\r\n#L7# #z1332003#(" + n5 + " moedas)#l"); } } else if (status == 11) { if (selection == 12) { - cm.sendSimple("Selecione a arma que você gostaria de trocar. As armas que eu tenho aqui são extremamente úteis. Dá uma olhada! \r\n#b#L0# #z1322015#(" + n3 + " moedas)#l\r\n#L1# #z1422008#(" + n3 + " moedas)#l\r\n#L2# #z1322016#(" + n4 + "moedas)#l\r\n#L3# #z1422007#(" + n4 + "moedas)#l\r\n#L4# #z1322017#(" + n5 + " moedas)#l\r\n#L5# #z1422005#(" + n5 + " moedas)#l\r\n#L6# #z1432003#(" + n3 + " moedas)#l\r\n#L7# #z1442003#(" + n3 + " moedas)#l\r\n#L8# #z1432005#(" + n4 + "moedas)#l\r\n#L9# #z1442009#(" + n4 + "moedas)#l\r\n#L10# #z1442005#(" + n5 + " moedas)#l\r\n#L11# #z1432004#(" + n5 + " moedas)#l\r\n#L12# Voltar para a página inicial(2/2)#l"); + cm.sendSimple("Selecione a arma que voc� gostaria de trocar. As armas que eu tenho aqui s�o extremamente �teis. D� uma olhada! \r\n#b#L0# #z1322015#(" + n3 + " moedas)#l\r\n#L1# #z1422008#(" + n3 + " moedas)#l\r\n#L2# #z1322016#(" + n4 + "moedas)#l\r\n#L3# #z1422007#(" + n4 + "moedas)#l\r\n#L4# #z1322017#(" + n5 + " moedas)#l\r\n#L5# #z1422005#(" + n5 + " moedas)#l\r\n#L6# #z1432003#(" + n3 + " moedas)#l\r\n#L7# #z1442003#(" + n3 + " moedas)#l\r\n#L8# #z1432005#(" + n4 + "moedas)#l\r\n#L9# #z1442009#(" + n4 + "moedas)#l\r\n#L10# #z1442005#(" + n5 + " moedas)#l\r\n#L11# #z1432004#(" + n5 + " moedas)#l\r\n#L12# Voltar para a p�gina inicial(2/2)#l"); } else { var item = new Array(1302004, 1402006, 1302009, 1402007, 1302010, 1402003, 1312006, 1412004, 1312007, 1412005, 1312008, 1412003); var cost = new Array(n3, n3, n4, n4, n5, n5, n3, n3, n4, n4, n5); @@ -214,14 +240,14 @@ function action(mode, type, selection) { cm.gainItem(4001129, -cost[selection]); cm.dispose(); } else { - cm.sendOk("Você ou não possui #b#t4001129##k suficientes, ou seu inventário está cheio. Verifique novamente."); + cm.sendOk("Voc� ou n�o possui #b#t4001129##k suficientes, ou seu invent�rio est� cheio. Verifique novamente."); cm.dispose(); } } } else if (status == 12) { if (selection == 12) { status = 10; - cm.sendSimple("Por favor tenha certeza que você possui #t4001129# para a arma que você deseja. Selecione a arma que você gostaria de trocar #t4001129# por. As opções que tenho são realmente boas, e eu não sou eu que falo é o povo que diz! \r\n#b#L0# #z1302004#(" + n3 + " moedas)#l\r\n#L1# #z1402006#(" + n3 + " moedas)#l\r\n#L2# #z1302009#(" + n4 + " moedas)#l\r\n#L3# #z1402007#(" + n4 + " moedas)#l\r\n#L4# #z1302010#(" + n5 + " moedas)#l\r\n#L5# #z1402003#(" + n5 + " moedas)#l\r\n#L6# #z1312006#(" + n3 + " moedas)#l\r\n#L7# #z1412004#(" + n3 + " moedas)#l\r\n#L8# #z1312007#(" + n4 + " moedas)#l\r\n#L9# #z1412005#(" + n4 + " moedas)#l\r\n#L10# #z1312008#(" + n5 + " moedas)#l\r\n#L11# #z1412003#(" + n5 + " moedas)#l\r\n#L12# Ir para a próxima página(1/2)#l"); + cm.sendSimple("Por favor tenha certeza que voc� possui #t4001129# para a arma que voc� deseja. Selecione a arma que voc� gostaria de trocar #t4001129# por. As op��es que tenho s�o realmente boas, e eu n�o sou eu que falo � o povo que diz! \r\n#b#L0# #z1302004#(" + n3 + " moedas)#l\r\n#L1# #z1402006#(" + n3 + " moedas)#l\r\n#L2# #z1302009#(" + n4 + " moedas)#l\r\n#L3# #z1402007#(" + n4 + " moedas)#l\r\n#L4# #z1302010#(" + n5 + " moedas)#l\r\n#L5# #z1402003#(" + n5 + " moedas)#l\r\n#L6# #z1312006#(" + n3 + " moedas)#l\r\n#L7# #z1412004#(" + n3 + " moedas)#l\r\n#L8# #z1312007#(" + n4 + " moedas)#l\r\n#L9# #z1412005#(" + n4 + " moedas)#l\r\n#L10# #z1312008#(" + n5 + " moedas)#l\r\n#L11# #z1412003#(" + n5 + " moedas)#l\r\n#L12# Ir para a pr�xima p�gina(1/2)#l"); } else { var item = new Array(1322015, 1422008, 1322016, 1422007, 1322017, 1422005, 1432003, 1442003, 1432005, 1442009, 1442005, 1432004); var cost = new Array(n3, n3, n4, n4, n5, n5, n3, n3, n4, n4, n5, n5); @@ -230,7 +256,7 @@ function action(mode, type, selection) { cm.gainItem(4001129, -cost[selection]); cm.dispose(); } else { - cm.sendOk("Você ou não possui #b#t4001129##k suficientes, ou seu inventário está cheio. Verifique novamente."); + cm.sendOk("Voc� ou n�o possui #b#t4001129##k suficientes, ou seu invent�rio est� cheio. Verifique novamente."); cm.dispose(); } } @@ -242,7 +268,7 @@ function action(mode, type, selection) { cm.gainItem(4001129, -cost[selection]); cm.dispose(); } else { - cm.sendOk("Ou você não possui #b#t4001129##k suficientes, ou seu inventário está cheio. Verifique novamente."); + cm.sendOk("Ou voc� n�o possui #b#t4001129##k suficientes, ou seu invent�rio est� cheio. Verifique novamente."); cm.dispose(); } } else if (status == 31) { @@ -253,7 +279,7 @@ function action(mode, type, selection) { cm.gainItem(4001129, -cost[selection]); cm.dispose(); } else { - cm.sendOk("Ou você não possui #b#t4001129##k suficientes, ou seu inventário está cheio. Verifique novamente."); + cm.sendOk("Ou voc� n�o possui #b#t4001129##k suficientes, ou seu invent�rio est� cheio. Verifique novamente."); cm.dispose(); } } else if (status == 41) { @@ -264,57 +290,213 @@ function action(mode, type, selection) { cm.gainItem(4001129, -cost[selection]); cm.dispose(); } else { - cm.sendOk("Ou você não possui #b#t4001129##k suficientes, ou seu inventário está cheio. Verifique novamente."); + cm.sendOk("Ou voc� n�o possui #b#t4001129##k suficientes, ou seu invent�rio est� cheio. Verifique novamente."); cm.dispose(); } } else if (status == 61) { select = selection; if (selection == 0) { - cm.sendNext("Haha! Eu sou Spiegelmann, o líder dessa Folia. Eu comecei a primeira #bFolia de Monstros#k aqui, aguardando por viajantes como você para participar dessa extravaganza!"); + cm.sendNext("Haha! Eu sou Spiegelmann, o l�der dessa Folia. Eu comecei a primeira #bFolia de Monstros#k aqui, aguardando por viajantes como voc� para participar dessa extravaganza!"); } else if (selection == 1) { - cm.sendNext("#bFolia de Monstros#k consiste em 2 grupos entrando no campo de batalha, e caçando os monstros invocados pelo outro grupo. É uma #bmissão de combate que determina o vitorioso pela quantia de Pontos de Folia (CP) recebidos#k."); + cm.sendNext("#bFolia de Monstros#k consiste em 2 grupos entrando no campo de batalha, e ca�ando os monstros invocados pelo outro grupo. � uma #bmiss�o de combate que determina o vitorioso pela quantia de Pontos de Folia (CP) recebidos#k."); } else if (selection == 2) { - cm.sendNext("Quando entrar no Campo da Folia, você verá a janela da Folia de Monstros aparecer. Tudo que precisa fazer é #bselecionar o que vocêe quer usar, e pressionar OK#k. Muito fácil, né?"); + cm.sendNext("Quando entrar no Campo da Folia, voc� ver� a janela da Folia de Monstros aparecer. Tudo que precisa fazer � #bselecionar o que voc�e quer usar, e pressionar OK#k. Muito f�cil, n�?"); } else { cm.dispose(); } } else if (status == 62) { if (select == 0) { - cm.sendNext("O que é a #bFolia de Monstros#k? Hahaha! Vamos dizer que é uma experiência que jamais esquecerá! É uma #bbatalha contra outros viajantes assim como você!#k"); + cm.sendNext("O que � a #bFolia de Monstros#k? Hahaha! Vamos dizer que � uma experi�ncia que jamais esquecer�! � uma #bbatalha contra outros viajantes assim como voc�!#k"); } else if (select == 1) { - cm.sendNext("Quando entrar no Campo da Folia, sua tarefa é #breceber CP caçando os monstros do grupo oposto, e usar estes CP's para distrair o grupo oposto de caçar monstros.#k."); + cm.sendNext("Quando entrar no Campo da Folia, sua tarefa � #breceber CP ca�ando os monstros do grupo oposto, e usar estes CP's para distrair o grupo oposto de ca�ar monstros.#k."); } else if (select == 2) { - cm.sendNext("Assim que se acostumar com os comandos, tente usar #bas teclas TAB e F1 ~ F12#k. #bTAB alterna entre Invocação de Monstros/Habilidades/Protetor,#k e, #bF1~ F12 possibilita-o de acessar uma das janelas diretamente#k."); + cm.sendNext("Assim que se acostumar com os comandos, tente usar #bas teclas TAB e F1 ~ F12#k. #bTAB alterna entre Invoca��o de Monstros/Habilidades/Protetor,#k e, #bF1~ F12 possibilita-o de acessar uma das janelas diretamente#k."); } } else if (status == 63) { if (select == 0) { - cm.sendNext("Eu sei que é muito perigoso para vocês lutarem uns com os outros usando armas de verdade; e eu não sugeriria um ato tão barbárico. Não meu amigo, o que eu ofereço é competição. A emoção da batalha e a emoção de competir contra pessoas tão fortes e motivadas. Eu ofereço a premissa de que seu grupo e o grupo oposto ambos #binvoquem os monstros, e derrote os monstros invocados pelo grupo adversário. Essa é a essência da Folia de Monstros. Além disso, você pode usar Maple Coins ganhos durante a Folia de Monstros para obter novos itens e armas! #k"); + cm.sendNext("Eu sei que � muito perigoso para voc�s lutarem uns com os outros usando armas de verdade; e eu n�o sugeriria um ato t�o barb�rico. N�o meu amigo, o que eu ofere�o � competi��o. A emo��o da batalha e a emo��o de competir contra pessoas t�o fortes e motivadas. Eu ofere�o a premissa de que seu grupo e o grupo oposto ambos #binvoquem os monstros, e derrote os monstros invocados pelo grupo advers�rio. Essa � a ess�ncia da Folia de Monstros. Al�m disso, voc� pode usar Maple Coins ganhos durante a Folia de Monstros para obter novos itens e armas! #k"); } else if (select == 1) { - cm.sendNext("Existem 3 maneiras de distrair o grupo adversário: #bInvodar um monstro, Habilidade, and Protetor#k. Vou dar-lhe um olhar mais aprofundado, se você quiser saber mais sobre 'Instruções detalhadas'."); + cm.sendNext("Existem 3 maneiras de distrair o grupo advers�rio: #bInvodar um monstro, Habilidade, and Protetor#k. Vou dar-lhe um olhar mais aprofundado, se voc� quiser saber mais sobre 'Instru��es detalhadas'."); } else if (select == 2) { - cm.sendNext("#bInvocar um Monstro#k chama um monstro que ataca o grupo adversário, sob seu controle. Use CP para trazer um Monstro Invocado, e ele irá aparecer na mesma área, atacando o grupo oposto."); + cm.sendNext("#bInvocar um Monstro#k chama um monstro que ataca o grupo advers�rio, sob seu controle. Use CP para trazer um Monstro Invocado, e ele ir� aparecer na mesma �rea, atacando o grupo oposto."); } } else if (status == 64) { if (select == 0) { - cm.sendNext("Claro, não é tão simples assim. Existem outras maneiras de prevenir o outro grupo de caçar monstros, e cabe a você descobrir como fazê-lo. O que acha? Interessado em uma competição amigável?"); + cm.sendNext("Claro, n�o � t�o simples assim. Existem outras maneiras de prevenir o outro grupo de ca�ar monstros, e cabe a voc� descobrir como faz�-lo. O que acha? Interessado em uma competi��o amig�vel?"); cm.dispose(); } else if (select == 1) { - cm.sendNext("Por favor lembre-se. Nunca é uma boa ideia guardar seus CP's. #bOs CP's que você usou irão ajudar a determinar o vencedor e o perdedor da Folia."); + cm.sendNext("Por favor lembre-se. Nunca � uma boa ideia guardar seus CP's. #bOs CP's que voc� usou ir�o ajudar a determinar o vencedor e o perdedor da Folia."); } else if (select == 2) { - cm.sendNext("#bHabilidade#k é uma opção de usar habilidades tais como Escuridão, Fraqueza, e outras para prevenir o grupo oposto de matar outros monstros. São necessários muitos CP's, mas vale muito a pena. O único problema é que eles não duram muito. Use essa tática com sabedoria!"); + cm.sendNext("#bHabilidade#k � uma op��o de usar habilidades tais como Escurid�o, Fraqueza, e outras para prevenir o grupo oposto de matar outros monstros. S�o necess�rios muitos CP's, mas vale muito a pena. O �nico problema � que eles n�o duram muito. Use essa t�tica com sabedoria!"); } } else if (status == 65) { if (select == 1) { - cm.sendNext("Oh, e não se preocupe em tranformar-se em um fantasma. Na Folia de Monstros, #bvocê não perderá EXP após a morte#k. É realmente uma experência como nenhuma outra!"); + cm.sendNext("Oh, e n�o se preocupe em tranformar-se em um fantasma. Na Folia de Monstros, #bvoc� n�o perder� EXP ap�s a morte#k. � realmente uma exper�ncia como nenhuma outra!"); cm.dispose(); } else if (select == 2) { - cm.sendNext("#bProtetor#k é basicamente um item invocado que aumenta drásticamente as habilidades dos monstros invocados pelo seu grupo. Protetor funciona enquanto não for demolido pelo grupo oposto, então eu surigo que você invoque vários monstros primeiro, e então traga o Protetor."); + cm.sendNext("#bProtetor#k � basicamente um item invocado que aumenta dr�sticamente as habilidades dos monstros invocados pelo seu grupo. Protetor funciona enquanto n�o for demolido pelo grupo oposto, ent�o eu surigo que voc� invoque v�rios monstros primeiro, e ent�o traga o Protetor."); } } else if (status == 66) { - cm.sendNext("Por último, enquanto estiver na Folia de Monstros, #bvocê não pode usar items/poções de recuperação que você leva por ai contigo.#k Entretanto, os monstros deixam esses items cair de vez em quando, e #bassim que pegá-los, o item ativará imediatamente#k. É por isso que é importante saber quando pegar estes items."); + cm.sendNext("Por �ltimo, enquanto estiver na Folia de Monstros, #bvoc� n�o pode usar items/po��es de recupera��o que voc� leva por ai contigo.#k Entretanto, os monstros deixam esses items cair de vez em quando, e #bassim que peg�-los, o item ativar� imediatamente#k. � por isso que � importante saber quando pegar estes items."); + cm.dispose(); + } else if (status == 77) { + var allDone; + + if (selection == 0) { + allDone = refineItems(0); // minerals + } else if (selection == 1) { + allDone = refineItems(1); // jewels + } else if (selection == 2 && refineCrystals) { + allDone = refineItems(2); // crystals + } else if (selection == 2 && !refineCrystals || selection == 3) { + allDone = refineRockItems(); // moon/star rock + } + + if(allDone) { + cm.sendOk("Done. Thanks for showing up~."); + } else { + cm.sendOk("Done. Be aware some of the items #rcould not be synthetized#k because either you have a lack of space on your ETC inventory or there's not enough mesos to cover the fee."); + } cm.dispose(); } } } } +function getRefineFee(fee) { + return ((feeMultiplier * fee) | 0); +} + +function isRefineTarget(refineType, refineItemid) { + if(refineType == 0) { //mineral refine + return refineItemid >= 4010000 && refineItemid <= 4010007 && !(refineItemid == 4010007 && !refineSpecials); + } else if(refineType == 1) { //jewel refine + return refineItemid >= 4020000 && refineItemid <= 4020008 && !(refineItemid == 4020008 && !refineSpecials); + } else if(refineType == 2) { //crystal refine + return refineItemid >= 4004000 && refineItemid <= 4004004 && !(refineItemid == 4004004 && !refineSpecials); + } + + return false; +} + +function getRockRefineTarget(refineItemid) { + if(refineItemid >= 4011000 && refineItemid <= 4011006) { + return 0; + } else if(refineItemid >= 4021000 && refineItemid <= 4021008) { + return 1; + } + + return -1; +} + +function refineItems(refineType) { + var allDone = true; + + var refineFees = [[300,300,300,500,500,500,800,270],[500,500,500,500,500,500,500,1000,3000],[5000,5000,5000,5000,1000000]]; + var itemCount = {}; + + var iter = cm.getPlayer().getInventory(Packages.client.inventory.MapleInventoryType.ETC).iterator(); + while (iter.hasNext()) { + var it = iter.next(); + var itemid = it.getItemId(); + + if(isRefineTarget(refineType, itemid)) { + var ic = itemCount[itemid]; + + if(ic != undefined) { + itemCount[itemid] += it.getQuantity(); + } else { + itemCount[itemid] = it.getQuantity(); + } + } + } + + for(var key in itemCount) { + var itemqty = itemCount[key]; + var itemid = parseInt(key); + + var refineQty = ((itemqty / 10) | 0); + if(refineQty <= 0) continue; + + while(true) { + itemqty = refineQty * 10; + + var fee = getRefineFee(refineFees[refineType][(itemid % 100) | 0] * refineQty); + if(cm.canHold(itemid + 1000, refineQty, itemid, itemqty) && cm.getMeso() >= fee) { + cm.gainMeso(-fee); + cm.gainItem(itemid, -itemqty); + cm.gainItem(itemid + (itemid != 4010007 ? 1000 : 1001), refineQty); + + break; + } else if(refineQty <= 1) { + allDone = false; + break; + } else { + refineQty--; + } + } + } + + return allDone; +} + +function refineRockItems() { + var allDone = true; + var minItems = [[0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0]]; + var minRocks = [2147483647, 2147483647]; + + var rockItems = [4011007, 4021009]; + var rockFees = [10000, 15000]; + + var iter = cm.getPlayer().getInventory(Packages.client.inventory.MapleInventoryType.ETC).iterator(); + while (iter.hasNext()) { + var it = iter.next(); + var itemid = it.getItemId(); + var rockRefine = getRockRefineTarget(itemid); + if(rockRefine >= 0) { + var rockItem = ((itemid % 100) | 0); + var itemqty = it.getQuantity(); + + minItems[rockRefine][rockItem] += itemqty; + } + } + + for(var i = 0; i < minRocks.length; i++) { + for(var j = 0; j < minItems[i].length; j++) { + if(minRocks[i] > minItems[i][j]) { + minRocks[i] = minItems[i][j]; + } + } + if(minRocks[i] <= 0 || minRocks[i] == 2147483647) continue; + + var refineQty = minRocks[i]; + while(true) { + var fee = getRefineFee(rockFees[i] * refineQty); + if(cm.canHold(rockItems[i], refineQty) && cm.getMeso() >= fee) { + cm.gainMeso(-fee); + + var j; + if(i == 0) { + for(j = 4011000; j < 4011007; j++) { + cm.gainItem(j, -refineQty); + } + cm.gainItem(j, refineQty); + } else { + for(j = 4021000; j < 4021009; j++) { + cm.gainItem(j, -refineQty); + } + cm.gainItem(j, refineQty); + } + + break; + } else if(refineQty <= 1) { + allDone = false; + break; + } else { + refineQty--; + } + } + } + + return allDone; +} diff --git a/scripts/npc/2042005.js b/scripts/npc/2042005.js index 0cf77cbf77..6b205c1098 100644 --- a/scripts/npc/2042005.js +++ b/scripts/npc/2042005.js @@ -1,8 +1,7 @@ -var map = 980030000; -var minLvl = 30; -var maxLvl = 255; -var minAmt = 0; -var maxAmt = 6; +var cpqMinLvl = 30; +var cpqMaxLvl = 255; +var cpqMinAmt = 0; +var cpqMaxAmt = 6; function start() { status = -1; @@ -24,34 +23,35 @@ function action(mode, type, selection) { if (status == 0) { if (cm.getParty() == null) { status = 10; - cm.sendOk("#eÉ necessário criar um grupo antes de começar o Festival de Monstros!#k"); + cm.sendOk("#e� necess�rio criar um grupo antes de come�ar o Festival de Monstros!#k"); } else if (!cm.isLeader()) { status = 10; - cm.sendOk("Se você quer começar o Festival, avise o #blíder do grupo#k para falar comigo."); + cm.sendOk("Se voc� quer come�ar o Festival, avise o #bl�der do grupo#k para falar comigo."); } else { + var leaderMapid = cm.getMapId(); var party = cm.getParty().getMembers(); var inMap = cm.partyMembersInMap(); var lvlOk = 0; - var isInMap = 0; + var isOutMap = 0; for (var i = 0; i < party.size(); i++) { - if (party.get(i).getLevel() >= minLvl && party.get(i).getLevel() <= maxLvl) { + if (party.get(i).getLevel() >= cpqMinLvl && party.get(i).getLevel() <= cpqMaxLvl) { lvlOk++; - } - if (party.get(i).getPlayer().getMapId()!= 980030000) { - //isInMap = false; - isInMap++ + + if (party.get(i).getPlayer().getMapId() != leaderMapid) { + isOutMap++; + } } } if (party >= 1) { status = 10; - cm.sendOk("Você não tem número suficiente de pessoas em seu grupo. Você precisa de um grupo com #b" + minAmt + "#k - #r" + maxAmt + "#k membros e eles devem estar no mapa com você."); + cm.sendOk("Voc� n�o tem n�mero suficiente de pessoas em seu grupo. Voc� precisa de um grupo com #b" + cpqMinAmt + "#k - #r" + cpqMaxAmt + "#k membros e eles devem estar no mapa com voc�."); } else if (lvlOk != inMap) { status = 10; - cm.sendOk("Certifique se todos em seu grupo estão dentre os níveis corretos (" + minLvl + "~" + maxLvl + ")!"); - } else if (isInMap > 0) { + cm.sendOk("Certifique se todos em seu grupo est�o dentre os n�veis corretos (" + cpqMinLvl + "~" + cpqMaxLvl + ")!"); + } else if (isOutMap > 0) { status = 10; - cm.sendOk("Existe alguém do grupo que não esta no mapa!"); + cm.sendOk("Existe algu�m do grupo que n�o esta no mapa!"); } else { cm.sendCPQMapLists2(); } @@ -67,10 +67,10 @@ function action(mode, type, selection) { } } else { var party = cm.getParty().getMembers(); - if ((selection === 0 || selection === 1 ) && party.size() < 2) { - cm.sendOk("Você precisa de no mínimo 2 player para entrar na competição."); - } else if ((selection === 2 ) && party.size() < 3) { - cm.sendOk("Você precisa de no mínimo 3 player para entrar na competição."); + if ((selection === 0 || selection === 1 ) && party.size() < 1) { + cm.sendOk("Voc� precisa de no m�nimo 2 player para entrar na competi��o."); + } else if ((selection === 2 ) && party.size() < 1) { + cm.sendOk("Voc� precisa de no m�nimo 3 player para entrar na competi��o."); } else { cm.cpqLobby2(selection); } diff --git a/scripts/npc/2042007.js b/scripts/npc/2042007.js index 722f0229dc..887b7b65c8 100644 --- a/scripts/npc/2042007.js +++ b/scripts/npc/2042007.js @@ -1,4 +1,3 @@ -importPackage(net.sf.odinms.server.maps); var status = 0; var rnk = -1; @@ -21,26 +20,27 @@ function action(mode, type, selection) { status++; else status--; + if (cm.getChar().getMap().isCPQLoserMap()) { if (status == 0) { if (cm.getChar().getParty() != null) { var shiu = ""; - if (cm.getPlayer().getFestivalPoints() >= 100) { + if (cm.getPlayer().getFestivalPoints() >= 300) { shiu += "#rA#k"; - cm.sendOk("Infelizmente, você ou empatou ou perdeu a batalha, apesar da sua excelente performance. A vitória pode ser sua da próxima vez.\r\n\r\n#bNota da Folia de Monstros : " + shiu); + cm.sendOk("Infelizmente, voc� ou empatou ou perdeu a batalha, apesar da sua excelente performance. A vit�ria pode ser sua da pr�xima vez.\r\n\r\n#bNota da Folia de Monstros : " + shiu); rnk = 10; - } else if (cm.getPlayer().getFestivalPoints() >= 50 && cm.getPlayer().getFestivalPoints() < 100) { + } else if (cm.getPlayer().getFestivalPoints() >= 100) { shiu += "#rB#k"; rnk = 20; - cm.sendOk("Infelizmente, você ou empatou ou perdeu a batalha, mesmo com sua ótima performance. Só mais um pouquinho, e a vitória poderia ter sido sua.\r\n\r\n#bNota da Folia de Monstros : " + shiu); - } else if (cm.getPlayer().getFestivalPoints() >= 30 && cm.getPlayer().getFestivalPoints() < 50) { + cm.sendOk("Infelizmente, voc� ou empatou ou perdeu a batalha, mesmo com sua �tima performance. S� mais um pouquinho, e a vit�ria poderia ter sido sua.\r\n\r\n#bNota da Folia de Monstros : " + shiu); + } else if (cm.getPlayer().getFestivalPoints() >= 50) { shiu += "#rC#k"; rnk = 30; - cm.sendOk("Infelizmente, você ou empatou ou perdeu a batalha. A vitória está para aqueles que se esforçam. Vejo seus esforços, então a vitória não está tão longe do seu alcance. Continue assim!\r\n\r\n#bNota da Folia de Monstros : " + shiu); + cm.sendOk("Infelizmente, voc� ou empatou ou perdeu a batalha. A vit�ria est� para aqueles que se esfor�am. Vejo seus esfor�os, ent�o a vit�ria n�o est� t�o longe do seu alcance. Continue assim!\r\n\r\n#bNota da Folia de Monstros : " + shiu); } else { shiu += "#rD#k"; rnk = 40; - cm.sendOk("Infelizmente, você ou empatou ou perdeu a batalha, e sua performance claramente reflete nisso. Espero mais de você da próxima vez.\r\n\r\n#bNota da Folia de Monstros : " + shiu); + cm.sendOk("Infelizmente, voc� ou empatou ou perdeu a batalha, e sua performance claramente reflete nisso. Espero mais de voc� da pr�xima vez.\r\n\r\n#bNota da Folia de Monstros : " + shiu); } } else { cm.warp(980030000, 0); @@ -81,19 +81,19 @@ function action(mode, type, selection) { if (cm.getPlayer().getFestivalPoints() >= 300) { shi += "#rA#k"; rnk = 1; - cm.sendOk("Parabéns pela sua vitória!!! Que ótima performance! O grupo adversário não pôde fazer nada! Espero o mesmo bom trabalho da próxima vez!\r\n\r\n#bNota da Folia de Monstros : " + shi); - } else if (cm.getPlayer().getFestivalPoints() >= 100 && cm.getPlayer().getFestivalPoints() < 300) { + cm.sendOk("Parab�ns pela sua vit�ria!!! Que �tima performance! O grupo advers�rio n�o p�de fazer nada! Espero o mesmo bom trabalho da pr�xima vez!\r\n\r\n#bNota da Folia de Monstros : " + shi); + } else if (cm.getPlayer().getFestivalPoints() >= 100) { shi += "#rB#k"; rnk = 2; - cm.sendOk("Parabéns pela sua vitória! Isso foi impressionante! Você fez um bom trabalho contra o grupo adversário! Só mais um pouco, e você definitivamente vai conseguir um A na próxima vez. \r\n\r\n#bNota da Folia de Monstros : " + shi); - } else if (cm.getPlayer().getFestivalPoints() >= 50 && cm.getPlayer().getFestivalPoints() < 100) { + cm.sendOk("Parab�ns pela sua vit�ria! Isso foi impressionante! Voc� fez um bom trabalho contra o grupo advers�rio! S� mais um pouco, e voc� definitivamente vai conseguir um A na pr�xima vez. \r\n\r\n#bNota da Folia de Monstros : " + shi); + } else if (cm.getPlayer().getFestivalPoints() >= 50) { shi += "#rC#k"; rnk = 3; - cm.sendOk("Parabéns pela sua vitória. Você fez algumas coisas cá e lá, mas essa não pode ser considerada uma boa vitória. Espero mais de ti da próxima vez.\r\n\r\n#bNota da Folia de Monstros : " + shi); + cm.sendOk("Parab�ns pela sua vit�ria. Voc� fez algumas coisas c� e l�, mas essa n�o pode ser considerada uma boa vit�ria. Espero mais de ti da pr�xima vez.\r\n\r\n#bNota da Folia de Monstros : " + shi); } else { shi += "#rD#k"; rnk = 4; - cm.sendOk("Parabéns pela sua vitória, entretanto sua performance não refletiu muito bem isso. Seja mais ativo na sua próxima participação da Folia de Monstros!\r\n\r\n#bNota da Folia de Monstros : " + shi); + cm.sendOk("Parab�ns pela sua vit�ria, entretanto sua performance n�o refletiu muito bem isso. Seja mais ativo na sua pr�xima participa��o da Folia de Monstros!\r\n\r\n#bNota da Folia de Monstros : " + shi); } } else { cm.warp(980030000, 0); diff --git a/scripts/npc/2091005.js b/scripts/npc/2091005.js index 6c9f1abed2..24cf9806cc 100644 --- a/scripts/npc/2091005.js +++ b/scripts/npc/2091005.js @@ -24,7 +24,7 @@ * @Name: So Gong * @Map(s): Dojo Hall */ -importPackage(Packages.server.maps); + importPackage(Packages.constants); var disabled = false; diff --git a/scripts/npc/2091005_old.js b/scripts/npc/2091005_old.js index 46250cd58f..ffaae970cf 100644 --- a/scripts/npc/2091005_old.js +++ b/scripts/npc/2091005_old.js @@ -25,7 +25,6 @@ * @Name: So Gong * @Map(s): Dojo Hall */ -importPackage(Packages.server.maps); var disabled = false; var belts = Array(1132000, 1132001, 1132002, 1132003, 1132004); diff --git a/scripts/npc/9010022.js b/scripts/npc/9010022.js index c09e542d3d..e98268eac3 100644 --- a/scripts/npc/9010022.js +++ b/scripts/npc/9010022.js @@ -1,6 +1,4 @@ -importPackage(Packages.client); -importPackage(Packages.server.maps); - + var status; var sel; diff --git a/scripts/npc/9010022_old.js b/scripts/npc/9010022_old.js index ea4f8fdb8b..d62b2984b5 100644 --- a/scripts/npc/9010022_old.js +++ b/scripts/npc/9010022_old.js @@ -1,5 +1,3 @@ -importPackage(Packages.client); -importPackage(Packages.server.maps); var status; var sel; diff --git a/scripts/npc/9201005.js b/scripts/npc/9201005.js index 613715d086..5785d6d2f4 100644 --- a/scripts/npc/9201005.js +++ b/scripts/npc/9201005.js @@ -158,6 +158,12 @@ function action(mode, type, selection) { cm.dispose(); return; } + + if(!cm.getUnclaimedMarriageGifts().isEmpty() || !partner.getClient().getAbstractPlayerInteraction().getUnclaimedMarriageGifts().isEmpty()) { + cm.sendOk("Eerhm... I'm sorry, something doesn't seem right according to the Amoria's Wedding Gift Registry reserve. Please check in the situation with #b#p9201014##k."); + cm.dispose(); + return; + } var hasCommon = cm.haveItem(weddingEntryTicketCommon); var hasPremium = cm.haveItem(weddingEntryTicketPremium); diff --git a/scripts/npc/9201006.js b/scripts/npc/9201006.js index ec23bcf5fb..761cc2fa19 100644 --- a/scripts/npc/9201006.js +++ b/scripts/npc/9201006.js @@ -50,7 +50,6 @@ function action(mode, type, selection) { var eim = cm.getEventInstance(); if(eim == null) { cm.warp(680000000,0); - //cm.criarLista(); cm.dispose(); return; } @@ -72,7 +71,9 @@ function action(mode, type, selection) { cm.sendOk("Congratulations on your wedding. Please talk to #b#p9201007##k to start the afterparty."); cm.dispose(); } else if(hasEngagement) { - cm.criarLista(); + if (!cm.createMarriageWishlist()) { + cm.sendOk("You have already sent your wishlist..."); + } cm.dispose(); } else { cm.sendOk("You do not have the required item to continue through this wedding. Unfortunately, it's over..."); diff --git a/scripts/npc/9201008.js b/scripts/npc/9201008.js index 4931aa8826..e3dee07937 100644 --- a/scripts/npc/9201008.js +++ b/scripts/npc/9201008.js @@ -158,6 +158,12 @@ function action(mode, type, selection) { cm.dispose(); return; } + + if(!cm.getUnclaimedMarriageGifts().isEmpty() || !partner.getClient().getAbstractPlayerInteraction().getUnclaimedMarriageGifts().isEmpty()) { + cm.sendOk("Eerhm... I'm sorry, something doesn't seem right according to the Amoria's Wedding Gift Registry reserve. Please check in the situation with #b#p9201014##k."); + cm.dispose(); + return; + } var hasCommon = cm.haveItem(weddingEntryTicketCommon); var hasPremium = cm.haveItem(weddingEntryTicketPremium); diff --git a/scripts/npc/9201010.js b/scripts/npc/9201010.js index b372bccd0c..2ba82e7726 100644 --- a/scripts/npc/9201010.js +++ b/scripts/npc/9201010.js @@ -74,7 +74,9 @@ function action(mode, type, selection) { cm.sendOk("You guys totally rocked the stage!!! Go go, talk to #b#p9201007##k to start the afterparty."); cm.dispose(); } else if(hasEngagement) { - cm.sendOk("Please continue rocking on the stage, you are our superstars today!"); + if (!cm.createMarriageWishlist()) { + cm.sendOk("You have already sent your wishlist..."); + } cm.dispose(); } else { cm.sendOk("Oh, hey, where are the credentials for the this so-lauded party? Oh man, we can't continue at this rate now... Sorry, the party is over."); diff --git a/scripts/npc/9201014.js b/scripts/npc/9201014.js index 7d1bc9da2f..4f2c1a514c 100644 --- a/scripts/npc/9201014.js +++ b/scripts/npc/9201014.js @@ -27,12 +27,22 @@ 1.0 - First Version by Angel 2.0 - Second Version by happydud3 & XotiCraze 3.0 - Third Version by RonanLana (HeavenMS) - 4.0 - Four Version bby Drago(MapleStorySA) + 4.0 - Four Version bby Drago (MapleStorySA) --------------------------------------------------------------------------------------------------- **/ var status = -1; +var marriageRoom; +var marriageAction = 0; +var marriageGifts; + function start() { + marriageRoom = cm.getPlayer().getMarriageInstance() != null; + if (!marriageRoom) { + marriageGifts = cm.getUnclaimedMarriageGifts(); + marriageAction = (!marriageGifts.isEmpty() ? 2 : ((cm.haveItem(4031423) || cm.haveItem(4031424)) ? 1 : 0)); + } + status = -1; action(1, 0, 0); } @@ -44,8 +54,84 @@ function action(mode, type, selection) { cm.dispose(); return; } - if (status == 0) { - cm.enviarLista(); - cm.dispose(); + if (marriageRoom) { + if (status == 0) { + var talk = "Hi there, welcome to the wedding's Gift Registry. From which spouse's wishlist would you like to take a look?"; + var options = ["Groom", "Bride"]; + + cm.sendSimple(talk + "\r\n\r\n#b" + generateSelectionMenu(options) + "#k"); + } else { + cm.sendMarriageWishlist(selection == 0); + cm.dispose(); + } + } else { + if (marriageAction == 2) { // unclaimed gifts + if (status == 0) { + var talk = "Hi there, it seems you have unclaimed gifts from your wedding. Claim them here on the wedding's Gift Registry reserve."; + cm.sendNext(talk); + } else { + cm.sendMarriageGifts(marriageGifts); + cm.dispose(); + } + } else if (marriageAction == 1) { // onyx prizes + if (status == 0) { + var msg = "Hello I exchange Onyx Chest for Bride and Groom and the Onyx Chest for prizes!#b"; + var choice1 = new Array("I have an Onyx Chest for Bride and Groom", "I have an Onyx Chest"); + for (var i = 0; i < choice1.length; i++) { + msg += "\r\n#L" + i + "#" + choice1[i] + "#l"; + } + cm.sendSimple(msg); + } else if (status == 1) { + if (selection == 0) { + if (cm.haveItem(4031424)) { + if (cm.getPlayer().isMarried()) { // thanks MedicOP for solving an issue here + if(cm.getInventory(2).getNextFreeSlot() >= 0) { + var rand = Math.floor(Math.random() * bgPrizes.length); + cm.gainItem(bgPrizes[rand][0], bgPrizes[rand][1]); + + cm.gainItem(4031424,-1); + cm.dispose(); + } else { + cm.sendOk("You don't have a free USE slot right now."); + cm.dispose(); + } + } else { + cm.sendOk("You must be married to claim the prize for this box."); + cm.dispose(); + } + } else { + cm.sendOk("You don't have an Onyx Chest for Bride and Groom."); + cm.dispose(); + } + } else if (selection == 1) { + if (cm.haveItem(4031423)) { + if(cm.getInventory(2).getNextFreeSlot() >= 0) { + var rand = Math.floor(Math.random() * cmPrizes.length); + cm.gainItem(cmPrizes[rand][0], cmPrizes[rand][1]); + + cm.gainItem(4031423,-1); + cm.dispose(); + } else { + cm.sendOk("You don't have a free USE slot right now."); + cm.dispose(); + } + } else { + cm.sendOk("You don't have an Onyx Chest."); + cm.dispose(); + } + } + } + } else { + cm.sendOk("Hi there, welcome to Amoria's Wedding Gift Registry reserve. We redistribute and tender gifts for both wedding spouses and lucky ceremonial attenders."); + cm.dispose(); + } } +} + +function generateSelectionMenu(array) { + var menu = ""; + for (var i = 0; i < array.length; i++) { + menu += "#L" + i + "#" + array[i] + "#l\r\n"; + } + return menu; } \ No newline at end of file diff --git a/scripts/npc/cpqchallenge.js b/scripts/npc/cpqchallenge.js index 2a1fe89c04..f768e46274 100644 --- a/scripts/npc/cpqchallenge.js +++ b/scripts/npc/cpqchallenge.js @@ -15,7 +15,6 @@ function action(mode, type, selection) { cm.dispose(); } else { if (mode == 0) { - cm.sendOk("Come back once you have thought about it some more."); cm.getChar().setChallenged(false); cm.dispose(); return; @@ -46,7 +45,7 @@ function action(mode, type, selection) { cm.getChar().getParty().setEnemy(ch.getParty()); cm.getChar().setChallenged(false); } else { - cm.sendOk("O numero de players entre os times não esta igual."); + cm.sendOk("O numero de players entre os times nao esta igual."); } cm.dispose(); } diff --git a/scripts/portal/MCRevive1.js b/scripts/portal/MCRevive1.js index 6b83b15910..80e89b9d26 100644 --- a/scripts/portal/MCRevive1.js +++ b/scripts/portal/MCRevive1.js @@ -1,4 +1,3 @@ -importPackage(Packages.server.maps); /* [CelticMS] Monster Carnival Reviving Field 1 @@ -6,5 +5,6 @@ importPackage(Packages.server.maps); function enter(pi) { pi.warp(980000101, 0); + pi.playPortalSound(); return true; } diff --git a/scripts/portal/MCRevive2.js b/scripts/portal/MCRevive2.js index 333958c6d2..77696a1667 100644 --- a/scripts/portal/MCRevive2.js +++ b/scripts/portal/MCRevive2.js @@ -1,4 +1,3 @@ -importPackage(Packages.server.maps); /* [CelticMS] Monster Carnival Reviving Field 1 @@ -6,5 +5,6 @@ importPackage(Packages.server.maps); function enter(pi) { pi.warp(980000201, 0); + pi.playPortalSound(); return true; } diff --git a/scripts/portal/MCRevive3.js b/scripts/portal/MCRevive3.js index 2ec50bacda..f11c3e54ef 100644 --- a/scripts/portal/MCRevive3.js +++ b/scripts/portal/MCRevive3.js @@ -1,4 +1,3 @@ -importPackage(Packages.server.maps); /* [CelticMS] Monster Carnival Reviving Field 1 @@ -15,5 +14,6 @@ function enter(pi) { break; } pi.warp(980000301, portal); + pi.playPortalSound(); return true; } diff --git a/scripts/portal/MCRevive4.js b/scripts/portal/MCRevive4.js index 95fc0f1ad7..747706887e 100644 --- a/scripts/portal/MCRevive4.js +++ b/scripts/portal/MCRevive4.js @@ -1,4 +1,3 @@ -importPackage(Packages.server.maps); /* [CelticMS] Monster Carnival Reviving Field 1 @@ -15,5 +14,6 @@ function enter(pi) { break; } pi.warp(980000401, portal); + pi.playPortalSound(); return true; } diff --git a/scripts/portal/MCRevive5.js b/scripts/portal/MCRevive5.js index 7ced4ab4be..f89c28b366 100644 --- a/scripts/portal/MCRevive5.js +++ b/scripts/portal/MCRevive5.js @@ -1,4 +1,3 @@ -importPackage(Packages.server.maps); /* [CelticMS] Monster Carnival Reviving Field 1 @@ -6,5 +5,6 @@ importPackage(Packages.server.maps); function enter(pi) { pi.warp(980000501, 0); + pi.playPortalSound(); return true; } diff --git a/scripts/portal/MCRevive6.js b/scripts/portal/MCRevive6.js index 26c1a63ca0..f9e0ae6ad1 100644 --- a/scripts/portal/MCRevive6.js +++ b/scripts/portal/MCRevive6.js @@ -1,4 +1,3 @@ -importPackage(Packages.server.maps); /* [CelticMS] Monster Carnival Reviving Field 1 @@ -6,5 +5,6 @@ importPackage(Packages.server.maps); function enter(pi) { pi.warp(980000601, 0); + pi.playPortalSound(); return true; } diff --git a/scripts/portal/mc_out.js b/scripts/portal/mc_out.js index cc38a8f14b..11f62ff8fb 100644 --- a/scripts/portal/mc_out.js +++ b/scripts/portal/mc_out.js @@ -19,11 +19,6 @@ along with this program. If not, see . */ -importPackage(Packages.server.maps); - -/* - */ - function enter(pi) { var returnMap = pi.getPlayer().getSavedLocation("MONSTER_CARNIVAL"); if (returnMap < 0) { @@ -31,5 +26,6 @@ function enter(pi) { } var target = pi.getPlayer().getClient().getChannelServer().getMapFactory().getMap(returnMap); pi.getPlayer().changeMap(target); + pi.playPortalSound(); return true; } \ No newline at end of file diff --git a/sql/db_drops.sql b/sql/db_drops.sql index 23e0864ebe..bd979c80ba 100644 --- a/sql/db_drops.sql +++ b/sql/db_drops.sql @@ -20765,6 +20765,472 @@ USE `heavenms`; (9400606, 4031348, 1, 1, 0, 100000), (9400606, 0, 25000, 30000, 0, 600000); +DELETE FROM temp_data WHERE dropperid >= 9300127 AND dropperid <= 9300136; +DELETE FROM temp_data WHERE dropperid >= 9300315 AND dropperid <= 9300324; + +# add CPQ items, CPQ specific items found thanks to Dragohe4rt + INSERT IGNORE INTO temp_data (`dropperid`, `itemid`, `minimum_quantity`, `maximum_quantity`, `questid`, `chance`) VALUES +(9300127, 2022157, 1, 1, 0, 200000), +(9300127, 2022158, 1, 1, 0, 200000), +(9300127, 2022159, 1, 1, 0, 200000), +(9300127, 2022160, 1, 1, 0, 200000), +(9300127, 2022161, 1, 1, 0, 200000), +(9300127, 2022162, 1, 1, 0, 200000), +(9300127, 2022163, 1, 1, 0, 200000), +(9300127, 2022164, 1, 1, 0, 200000), +(9300127, 2022165, 1, 1, 0, 200000), +(9300127, 2022166, 1, 1, 0, 200000), +(9300127, 2022167, 1, 1, 0, 200000), +(9300127, 2022168, 1, 1, 0, 200000), +(9300127, 2022169, 1, 1, 0, 200000), +(9300127, 2022170, 1, 1, 0, 200000), +(9300127, 2022171, 1, 1, 0, 200000), +(9300127, 2022172, 1, 1, 0, 200000), +(9300127, 2022173, 1, 1, 0, 200000), +(9300127, 2022174, 1, 1, 0, 200000), +(9300127, 2022175, 1, 1, 0, 200000), +(9300127, 2022176, 1, 1, 0, 200000), +(9300127, 2022177, 1, 1, 0, 200000), +(9300127, 2022178, 1, 1, 0, 200000), +(9300127, 4001129, 1, 1, 0, 12987), +(9300128, 2022157, 1, 1, 0, 200000), +(9300128, 2022158, 1, 1, 0, 200000), +(9300128, 2022159, 1, 1, 0, 200000), +(9300128, 2022160, 1, 1, 0, 200000), +(9300128, 2022161, 1, 1, 0, 200000), +(9300128, 2022162, 1, 1, 0, 200000), +(9300128, 2022163, 1, 1, 0, 200000), +(9300128, 2022164, 1, 1, 0, 200000), +(9300128, 2022165, 1, 1, 0, 200000), +(9300128, 2022166, 1, 1, 0, 200000), +(9300128, 2022167, 1, 1, 0, 200000), +(9300128, 2022168, 1, 1, 0, 200000), +(9300128, 2022169, 1, 1, 0, 200000), +(9300128, 2022170, 1, 1, 0, 200000), +(9300128, 2022171, 1, 1, 0, 200000), +(9300128, 2022172, 1, 1, 0, 200000), +(9300128, 2022173, 1, 1, 0, 200000), +(9300128, 2022174, 1, 1, 0, 200000), +(9300128, 2022175, 1, 1, 0, 200000), +(9300128, 2022176, 1, 1, 0, 200000), +(9300128, 2022177, 1, 1, 0, 200000), +(9300128, 2022178, 1, 1, 0, 200000), +(9300128, 4001129, 1, 1, 0, 12987), +(9300129, 2022157, 1, 1, 0, 200000), +(9300129, 2022158, 1, 1, 0, 200000), +(9300129, 2022159, 1, 1, 0, 200000), +(9300129, 2022160, 1, 1, 0, 200000), +(9300129, 2022161, 1, 1, 0, 200000), +(9300129, 2022162, 1, 1, 0, 200000), +(9300129, 2022163, 1, 1, 0, 200000), +(9300129, 2022164, 1, 1, 0, 200000), +(9300129, 2022165, 1, 1, 0, 200000), +(9300129, 2022166, 1, 1, 0, 200000), +(9300129, 2022167, 1, 1, 0, 200000), +(9300129, 2022168, 1, 1, 0, 200000), +(9300129, 2022169, 1, 1, 0, 200000), +(9300129, 2022170, 1, 1, 0, 200000), +(9300129, 2022171, 1, 1, 0, 200000), +(9300129, 2022172, 1, 1, 0, 200000), +(9300129, 2022173, 1, 1, 0, 200000), +(9300129, 2022174, 1, 1, 0, 200000), +(9300129, 2022175, 1, 1, 0, 200000), +(9300129, 2022176, 1, 1, 0, 200000), +(9300129, 2022177, 1, 1, 0, 200000), +(9300129, 2022178, 1, 1, 0, 200000), +(9300129, 4001129, 1, 1, 0, 12987), +(9300130, 2022157, 1, 1, 0, 200000), +(9300130, 2022158, 1, 1, 0, 200000), +(9300130, 2022159, 1, 1, 0, 200000), +(9300130, 2022160, 1, 1, 0, 200000), +(9300130, 2022161, 1, 1, 0, 200000), +(9300130, 2022162, 1, 1, 0, 200000), +(9300130, 2022163, 1, 1, 0, 200000), +(9300130, 2022164, 1, 1, 0, 200000), +(9300130, 2022165, 1, 1, 0, 200000), +(9300130, 2022166, 1, 1, 0, 200000), +(9300130, 2022167, 1, 1, 0, 200000), +(9300130, 2022168, 1, 1, 0, 200000), +(9300130, 2022169, 1, 1, 0, 200000), +(9300130, 2022170, 1, 1, 0, 200000), +(9300130, 2022171, 1, 1, 0, 200000), +(9300130, 2022172, 1, 1, 0, 200000), +(9300130, 2022173, 1, 1, 0, 200000), +(9300130, 2022174, 1, 1, 0, 200000), +(9300130, 2022175, 1, 1, 0, 200000), +(9300130, 2022176, 1, 1, 0, 200000), +(9300130, 2022177, 1, 1, 0, 200000), +(9300130, 2022178, 1, 1, 0, 200000), +(9300130, 4001129, 1, 1, 0, 12987), +(9300131, 2022157, 1, 1, 0, 200000), +(9300131, 2022158, 1, 1, 0, 200000), +(9300131, 2022159, 1, 1, 0, 200000), +(9300131, 2022160, 1, 1, 0, 200000), +(9300131, 2022161, 1, 1, 0, 200000), +(9300131, 2022162, 1, 1, 0, 200000), +(9300131, 2022163, 1, 1, 0, 200000), +(9300131, 2022164, 1, 1, 0, 200000), +(9300131, 2022165, 1, 1, 0, 200000), +(9300131, 2022166, 1, 1, 0, 200000), +(9300131, 2022167, 1, 1, 0, 200000), +(9300131, 2022168, 1, 1, 0, 200000), +(9300131, 2022169, 1, 1, 0, 200000), +(9300131, 2022170, 1, 1, 0, 200000), +(9300131, 2022171, 1, 1, 0, 200000), +(9300131, 2022172, 1, 1, 0, 200000), +(9300131, 2022173, 1, 1, 0, 200000), +(9300131, 2022174, 1, 1, 0, 200000), +(9300131, 2022175, 1, 1, 0, 200000), +(9300131, 2022176, 1, 1, 0, 200000), +(9300131, 2022177, 1, 1, 0, 200000), +(9300131, 2022178, 1, 1, 0, 200000), +(9300131, 4001129, 1, 1, 0, 12987), +(9300132, 2022157, 1, 1, 0, 200000), +(9300132, 2022158, 1, 1, 0, 200000), +(9300132, 2022159, 1, 1, 0, 200000), +(9300132, 2022160, 1, 1, 0, 200000), +(9300132, 2022161, 1, 1, 0, 200000), +(9300132, 2022162, 1, 1, 0, 200000), +(9300132, 2022163, 1, 1, 0, 200000), +(9300132, 2022164, 1, 1, 0, 200000), +(9300132, 2022165, 1, 1, 0, 200000), +(9300132, 2022166, 1, 1, 0, 200000), +(9300132, 2022167, 1, 1, 0, 200000), +(9300132, 2022168, 1, 1, 0, 200000), +(9300132, 2022169, 1, 1, 0, 200000), +(9300132, 2022170, 1, 1, 0, 200000), +(9300132, 2022171, 1, 1, 0, 200000), +(9300132, 2022172, 1, 1, 0, 200000), +(9300132, 2022173, 1, 1, 0, 200000), +(9300132, 2022174, 1, 1, 0, 200000), +(9300132, 2022175, 1, 1, 0, 200000), +(9300132, 2022176, 1, 1, 0, 200000), +(9300132, 2022177, 1, 1, 0, 200000), +(9300132, 2022178, 1, 1, 0, 200000), +(9300132, 4001129, 1, 1, 0, 12987), +(9300133, 2022157, 1, 1, 0, 200000), +(9300133, 2022158, 1, 1, 0, 200000), +(9300133, 2022159, 1, 1, 0, 200000), +(9300133, 2022160, 1, 1, 0, 200000), +(9300133, 2022161, 1, 1, 0, 200000), +(9300133, 2022162, 1, 1, 0, 200000), +(9300133, 2022163, 1, 1, 0, 200000), +(9300133, 2022164, 1, 1, 0, 200000), +(9300133, 2022165, 1, 1, 0, 200000), +(9300133, 2022166, 1, 1, 0, 200000), +(9300133, 2022167, 1, 1, 0, 200000), +(9300133, 2022168, 1, 1, 0, 200000), +(9300133, 2022169, 1, 1, 0, 200000), +(9300133, 2022170, 1, 1, 0, 200000), +(9300133, 2022171, 1, 1, 0, 200000), +(9300133, 2022172, 1, 1, 0, 200000), +(9300133, 2022173, 1, 1, 0, 200000), +(9300133, 2022174, 1, 1, 0, 200000), +(9300133, 2022175, 1, 1, 0, 200000), +(9300133, 2022176, 1, 1, 0, 200000), +(9300133, 2022177, 1, 1, 0, 200000), +(9300133, 2022178, 1, 1, 0, 200000), +(9300133, 4001129, 1, 1, 0, 12987), +(9300134, 2022157, 1, 1, 0, 200000), +(9300134, 2022158, 1, 1, 0, 200000), +(9300134, 2022159, 1, 1, 0, 200000), +(9300134, 2022160, 1, 1, 0, 200000), +(9300134, 2022161, 1, 1, 0, 200000), +(9300134, 2022162, 1, 1, 0, 200000), +(9300134, 2022163, 1, 1, 0, 200000), +(9300134, 2022164, 1, 1, 0, 200000), +(9300134, 2022165, 1, 1, 0, 200000), +(9300134, 2022166, 1, 1, 0, 200000), +(9300134, 2022167, 1, 1, 0, 200000), +(9300134, 2022168, 1, 1, 0, 200000), +(9300134, 2022169, 1, 1, 0, 200000), +(9300134, 2022170, 1, 1, 0, 200000), +(9300134, 2022171, 1, 1, 0, 200000), +(9300134, 2022172, 1, 1, 0, 200000), +(9300134, 2022173, 1, 1, 0, 200000), +(9300134, 2022174, 1, 1, 0, 200000), +(9300134, 2022175, 1, 1, 0, 200000), +(9300134, 2022176, 1, 1, 0, 200000), +(9300134, 2022177, 1, 1, 0, 200000), +(9300134, 2022178, 1, 1, 0, 200000), +(9300134, 4001129, 1, 1, 0, 12987), +(9300135, 2022157, 1, 1, 0, 200000), +(9300135, 2022158, 1, 1, 0, 200000), +(9300135, 2022159, 1, 1, 0, 200000), +(9300135, 2022160, 1, 1, 0, 200000), +(9300135, 2022161, 1, 1, 0, 200000), +(9300135, 2022162, 1, 1, 0, 200000), +(9300135, 2022163, 1, 1, 0, 200000), +(9300135, 2022164, 1, 1, 0, 200000), +(9300135, 2022165, 1, 1, 0, 200000), +(9300135, 2022166, 1, 1, 0, 200000), +(9300135, 2022167, 1, 1, 0, 200000), +(9300135, 2022168, 1, 1, 0, 200000), +(9300135, 2022169, 1, 1, 0, 200000), +(9300135, 2022170, 1, 1, 0, 200000), +(9300135, 2022171, 1, 1, 0, 200000), +(9300135, 2022172, 1, 1, 0, 200000), +(9300135, 2022173, 1, 1, 0, 200000), +(9300135, 2022174, 1, 1, 0, 200000), +(9300135, 2022175, 1, 1, 0, 200000), +(9300135, 2022176, 1, 1, 0, 200000), +(9300135, 2022177, 1, 1, 0, 200000), +(9300135, 2022178, 1, 1, 0, 200000), +(9300135, 4001129, 1, 1, 0, 12987), +(9300136, 2022157, 1, 1, 0, 200000), +(9300136, 2022158, 1, 1, 0, 200000), +(9300136, 2022159, 1, 1, 0, 200000), +(9300136, 2022160, 1, 1, 0, 200000), +(9300136, 2022161, 1, 1, 0, 200000), +(9300136, 2022162, 1, 1, 0, 200000), +(9300136, 2022163, 1, 1, 0, 200000), +(9300136, 2022164, 1, 1, 0, 200000), +(9300136, 2022165, 1, 1, 0, 200000), +(9300136, 2022166, 1, 1, 0, 200000), +(9300136, 2022167, 1, 1, 0, 200000), +(9300136, 2022168, 1, 1, 0, 200000), +(9300136, 2022169, 1, 1, 0, 200000), +(9300136, 2022170, 1, 1, 0, 200000), +(9300136, 2022171, 1, 1, 0, 200000), +(9300136, 2022172, 1, 1, 0, 200000), +(9300136, 2022173, 1, 1, 0, 200000), +(9300136, 2022174, 1, 1, 0, 200000), +(9300136, 2022175, 1, 1, 0, 200000), +(9300136, 2022176, 1, 1, 0, 200000), +(9300136, 2022177, 1, 1, 0, 200000), +(9300136, 2022178, 1, 1, 0, 200000), +(9300136, 4001129, 1, 1, 0, 12987), +(9300315, 2022157, 1, 1, 0, 200000), +(9300315, 2022158, 1, 1, 0, 200000), +(9300315, 2022159, 1, 1, 0, 200000), +(9300315, 2022160, 1, 1, 0, 200000), +(9300315, 2022161, 1, 1, 0, 200000), +(9300315, 2022162, 1, 1, 0, 200000), +(9300315, 2022163, 1, 1, 0, 200000), +(9300315, 2022164, 1, 1, 0, 200000), +(9300315, 2022165, 1, 1, 0, 200000), +(9300315, 2022166, 1, 1, 0, 200000), +(9300315, 2022167, 1, 1, 0, 200000), +(9300315, 2022168, 1, 1, 0, 200000), +(9300315, 2022169, 1, 1, 0, 200000), +(9300315, 2022170, 1, 1, 0, 200000), +(9300315, 2022171, 1, 1, 0, 200000), +(9300315, 2022172, 1, 1, 0, 200000), +(9300315, 2022173, 1, 1, 0, 200000), +(9300315, 2022174, 1, 1, 0, 200000), +(9300315, 2022175, 1, 1, 0, 200000), +(9300315, 2022176, 1, 1, 0, 200000), +(9300315, 2022177, 1, 1, 0, 200000), +(9300315, 2022178, 1, 1, 0, 200000), +(9300315, 4001129, 1, 1, 0, 12987), +(9300316, 2022157, 1, 1, 0, 200000), +(9300316, 2022158, 1, 1, 0, 200000), +(9300316, 2022159, 1, 1, 0, 200000), +(9300316, 2022160, 1, 1, 0, 200000), +(9300316, 2022161, 1, 1, 0, 200000), +(9300316, 2022162, 1, 1, 0, 200000), +(9300316, 2022163, 1, 1, 0, 200000), +(9300316, 2022164, 1, 1, 0, 200000), +(9300316, 2022165, 1, 1, 0, 200000), +(9300316, 2022166, 1, 1, 0, 200000), +(9300316, 2022167, 1, 1, 0, 200000), +(9300316, 2022168, 1, 1, 0, 200000), +(9300316, 2022169, 1, 1, 0, 200000), +(9300316, 2022170, 1, 1, 0, 200000), +(9300316, 2022171, 1, 1, 0, 200000), +(9300316, 2022172, 1, 1, 0, 200000), +(9300316, 2022173, 1, 1, 0, 200000), +(9300316, 2022174, 1, 1, 0, 200000), +(9300316, 2022175, 1, 1, 0, 200000), +(9300316, 2022176, 1, 1, 0, 200000), +(9300316, 2022177, 1, 1, 0, 200000), +(9300316, 2022178, 1, 1, 0, 200000), +(9300316, 4001129, 1, 1, 0, 12987), +(9300317, 2022157, 1, 1, 0, 200000), +(9300317, 2022158, 1, 1, 0, 200000), +(9300317, 2022159, 1, 1, 0, 200000), +(9300317, 2022160, 1, 1, 0, 200000), +(9300317, 2022161, 1, 1, 0, 200000), +(9300317, 2022162, 1, 1, 0, 200000), +(9300317, 2022163, 1, 1, 0, 200000), +(9300317, 2022164, 1, 1, 0, 200000), +(9300317, 2022165, 1, 1, 0, 200000), +(9300317, 2022166, 1, 1, 0, 200000), +(9300317, 2022167, 1, 1, 0, 200000), +(9300317, 2022168, 1, 1, 0, 200000), +(9300317, 2022169, 1, 1, 0, 200000), +(9300317, 2022170, 1, 1, 0, 200000), +(9300317, 2022171, 1, 1, 0, 200000), +(9300317, 2022172, 1, 1, 0, 200000), +(9300317, 2022173, 1, 1, 0, 200000), +(9300317, 2022174, 1, 1, 0, 200000), +(9300317, 2022175, 1, 1, 0, 200000), +(9300317, 2022176, 1, 1, 0, 200000), +(9300317, 2022177, 1, 1, 0, 200000), +(9300317, 2022178, 1, 1, 0, 200000), +(9300317, 4001129, 1, 1, 0, 12987), +(9300318, 2022157, 1, 1, 0, 200000), +(9300318, 2022158, 1, 1, 0, 200000), +(9300318, 2022159, 1, 1, 0, 200000), +(9300318, 2022160, 1, 1, 0, 200000), +(9300318, 2022161, 1, 1, 0, 200000), +(9300318, 2022162, 1, 1, 0, 200000), +(9300318, 2022163, 1, 1, 0, 200000), +(9300318, 2022164, 1, 1, 0, 200000), +(9300318, 2022165, 1, 1, 0, 200000), +(9300318, 2022166, 1, 1, 0, 200000), +(9300318, 2022167, 1, 1, 0, 200000), +(9300318, 2022168, 1, 1, 0, 200000), +(9300318, 2022169, 1, 1, 0, 200000), +(9300318, 2022170, 1, 1, 0, 200000), +(9300318, 2022171, 1, 1, 0, 200000), +(9300318, 2022172, 1, 1, 0, 200000), +(9300318, 2022173, 1, 1, 0, 200000), +(9300318, 2022174, 1, 1, 0, 200000), +(9300318, 2022175, 1, 1, 0, 200000), +(9300318, 2022176, 1, 1, 0, 200000), +(9300318, 2022177, 1, 1, 0, 200000), +(9300318, 2022178, 1, 1, 0, 200000), +(9300318, 4001129, 1, 1, 0, 12987), +(9300319, 2022157, 1, 1, 0, 200000), +(9300319, 2022158, 1, 1, 0, 200000), +(9300319, 2022159, 1, 1, 0, 200000), +(9300319, 2022160, 1, 1, 0, 200000), +(9300319, 2022161, 1, 1, 0, 200000), +(9300319, 2022162, 1, 1, 0, 200000), +(9300319, 2022163, 1, 1, 0, 200000), +(9300319, 2022164, 1, 1, 0, 200000), +(9300319, 2022165, 1, 1, 0, 200000), +(9300319, 2022166, 1, 1, 0, 200000), +(9300319, 2022167, 1, 1, 0, 200000), +(9300319, 2022168, 1, 1, 0, 200000), +(9300319, 2022169, 1, 1, 0, 200000), +(9300319, 2022170, 1, 1, 0, 200000), +(9300319, 2022171, 1, 1, 0, 200000), +(9300319, 2022172, 1, 1, 0, 200000), +(9300319, 2022173, 1, 1, 0, 200000), +(9300319, 2022174, 1, 1, 0, 200000), +(9300319, 2022175, 1, 1, 0, 200000), +(9300319, 2022176, 1, 1, 0, 200000), +(9300319, 2022177, 1, 1, 0, 200000), +(9300319, 2022178, 1, 1, 0, 200000), +(9300319, 4001129, 1, 1, 0, 12987), +(9300320, 2022157, 1, 1, 0, 200000), +(9300320, 2022158, 1, 1, 0, 200000), +(9300320, 2022159, 1, 1, 0, 200000), +(9300320, 2022160, 1, 1, 0, 200000), +(9300320, 2022161, 1, 1, 0, 200000), +(9300320, 2022162, 1, 1, 0, 200000), +(9300320, 2022163, 1, 1, 0, 200000), +(9300320, 2022164, 1, 1, 0, 200000), +(9300320, 2022165, 1, 1, 0, 200000), +(9300320, 2022166, 1, 1, 0, 200000), +(9300320, 2022167, 1, 1, 0, 200000), +(9300320, 2022168, 1, 1, 0, 200000), +(9300320, 2022169, 1, 1, 0, 200000), +(9300320, 2022170, 1, 1, 0, 200000), +(9300320, 2022171, 1, 1, 0, 200000), +(9300320, 2022172, 1, 1, 0, 200000), +(9300320, 2022173, 1, 1, 0, 200000), +(9300320, 2022174, 1, 1, 0, 200000), +(9300320, 2022175, 1, 1, 0, 200000), +(9300320, 2022176, 1, 1, 0, 200000), +(9300320, 2022177, 1, 1, 0, 200000), +(9300320, 2022178, 1, 1, 0, 200000), +(9300320, 4001129, 1, 1, 0, 12987), +(9300321, 2022157, 1, 1, 0, 200000), +(9300321, 2022158, 1, 1, 0, 200000), +(9300321, 2022159, 1, 1, 0, 200000), +(9300321, 2022160, 1, 1, 0, 200000), +(9300321, 2022161, 1, 1, 0, 200000), +(9300321, 2022162, 1, 1, 0, 200000), +(9300321, 2022163, 1, 1, 0, 200000), +(9300321, 2022164, 1, 1, 0, 200000), +(9300321, 2022165, 1, 1, 0, 200000), +(9300321, 2022166, 1, 1, 0, 200000), +(9300321, 2022167, 1, 1, 0, 200000), +(9300321, 2022168, 1, 1, 0, 200000), +(9300321, 2022169, 1, 1, 0, 200000), +(9300321, 2022170, 1, 1, 0, 200000), +(9300321, 2022171, 1, 1, 0, 200000), +(9300321, 2022172, 1, 1, 0, 200000), +(9300321, 2022173, 1, 1, 0, 200000), +(9300321, 2022174, 1, 1, 0, 200000), +(9300321, 2022175, 1, 1, 0, 200000), +(9300321, 2022176, 1, 1, 0, 200000), +(9300321, 2022177, 1, 1, 0, 200000), +(9300321, 2022178, 1, 1, 0, 200000), +(9300321, 4001129, 1, 1, 0, 12987), +(9300322, 2022157, 1, 1, 0, 200000), +(9300322, 2022158, 1, 1, 0, 200000), +(9300322, 2022159, 1, 1, 0, 200000), +(9300322, 2022160, 1, 1, 0, 200000), +(9300322, 2022161, 1, 1, 0, 200000), +(9300322, 2022162, 1, 1, 0, 200000), +(9300322, 2022163, 1, 1, 0, 200000), +(9300322, 2022164, 1, 1, 0, 200000), +(9300322, 2022165, 1, 1, 0, 200000), +(9300322, 2022166, 1, 1, 0, 200000), +(9300322, 2022167, 1, 1, 0, 200000), +(9300322, 2022168, 1, 1, 0, 200000), +(9300322, 2022169, 1, 1, 0, 200000), +(9300322, 2022170, 1, 1, 0, 200000), +(9300322, 2022171, 1, 1, 0, 200000), +(9300322, 2022172, 1, 1, 0, 200000), +(9300322, 2022173, 1, 1, 0, 200000), +(9300322, 2022174, 1, 1, 0, 200000), +(9300322, 2022175, 1, 1, 0, 200000), +(9300322, 2022176, 1, 1, 0, 200000), +(9300322, 2022177, 1, 1, 0, 200000), +(9300322, 2022178, 1, 1, 0, 200000), +(9300322, 4001129, 1, 1, 0, 12987), +(9300323, 2022157, 1, 1, 0, 200000), +(9300323, 2022158, 1, 1, 0, 200000), +(9300323, 2022159, 1, 1, 0, 200000), +(9300323, 2022160, 1, 1, 0, 200000), +(9300323, 2022161, 1, 1, 0, 200000), +(9300323, 2022162, 1, 1, 0, 200000), +(9300323, 2022163, 1, 1, 0, 200000), +(9300323, 2022164, 1, 1, 0, 200000), +(9300323, 2022165, 1, 1, 0, 200000), +(9300323, 2022166, 1, 1, 0, 200000), +(9300323, 2022167, 1, 1, 0, 200000), +(9300323, 2022168, 1, 1, 0, 200000), +(9300323, 2022169, 1, 1, 0, 200000), +(9300323, 2022170, 1, 1, 0, 200000), +(9300323, 2022171, 1, 1, 0, 200000), +(9300323, 2022172, 1, 1, 0, 200000), +(9300323, 2022173, 1, 1, 0, 200000), +(9300323, 2022174, 1, 1, 0, 200000), +(9300323, 2022175, 1, 1, 0, 200000), +(9300323, 2022176, 1, 1, 0, 200000), +(9300323, 2022177, 1, 1, 0, 200000), +(9300323, 2022178, 1, 1, 0, 200000), +(9300323, 4001129, 1, 1, 0, 12987), +(9300324, 2022157, 1, 1, 0, 200000), +(9300324, 2022158, 1, 1, 0, 200000), +(9300324, 2022159, 1, 1, 0, 200000), +(9300324, 2022160, 1, 1, 0, 200000), +(9300324, 2022161, 1, 1, 0, 200000), +(9300324, 2022162, 1, 1, 0, 200000), +(9300324, 2022163, 1, 1, 0, 200000), +(9300324, 2022164, 1, 1, 0, 200000), +(9300324, 2022165, 1, 1, 0, 200000), +(9300324, 2022166, 1, 1, 0, 200000), +(9300324, 2022167, 1, 1, 0, 200000), +(9300324, 2022168, 1, 1, 0, 200000), +(9300324, 2022169, 1, 1, 0, 200000), +(9300324, 2022170, 1, 1, 0, 200000), +(9300324, 2022171, 1, 1, 0, 200000), +(9300324, 2022172, 1, 1, 0, 200000), +(9300324, 2022173, 1, 1, 0, 200000), +(9300324, 2022174, 1, 1, 0, 200000), +(9300324, 2022175, 1, 1, 0, 200000), +(9300324, 2022176, 1, 1, 0, 200000), +(9300324, 2022177, 1, 1, 0, 200000), +(9300324, 2022178, 1, 1, 0, 200000), +(9300324, 4001129, 1, 1, 0, 12987); + CREATE TABLE IF NOT EXISTS `drop_data` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `dropperid` int(11) NOT NULL, diff --git a/src/client/MapleCharacter.java b/src/client/MapleCharacter.java index 818514ab69..6fe61df5df 100644 --- a/src/client/MapleCharacter.java +++ b/src/client/MapleCharacter.java @@ -68,6 +68,7 @@ import scripting.event.EventInstanceManager; import server.CashShop; import server.MapleItemInformationProvider; import server.MapleItemInformationProvider.ScriptedItem; +import server.MapleMarriage; import server.MaplePortal; import server.MapleShop; import server.MapleStatEffect; @@ -130,7 +131,7 @@ import client.processor.FredrickProcessor; import constants.ExpTable; import constants.GameConstants; import constants.ItemConstants; -import constants.LinguaConstants; +import constants.LanguageConstants; import constants.ServerConstants; import constants.skills.Aran; import constants.skills.Beginner; @@ -166,6 +167,7 @@ import server.life.MobSkillFactory; import server.maps.MapleMapItem; import net.server.audit.locks.MonitoredLockType; import net.server.audit.locks.factory.MonitoredReentrantLockFactory; +import scripting.AbstractPlayerInteraction; public class MapleCharacter extends AbstractMapleCharacterObject { private static final MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance(); @@ -277,7 +279,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { private ScheduledFuture extraRecoveryTask = null; private ScheduledFuture chairRecoveryTask = null; private ScheduledFuture pendantOfSpirit = null; //1122017 - public ScheduledFuture timer; + private ScheduledFuture cpqSchedule = null; private Lock chrLock = MonitoredReentrantLockFactory.createLock(MonitoredLockType.CHARACTER_CHR, true); private Lock evtLock = MonitoredReentrantLockFactory.createLock(MonitoredLockType.CHARACTER_EVT, true); private Lock petLock = MonitoredReentrantLockFactory.createLock(MonitoredLockType.CHARACTER_PET, true); @@ -4383,6 +4385,16 @@ public class MapleCharacter extends AbstractMapleCharacterObject { evtLock.unlock(); } } + + public MapleMarriage getMarriageInstance() { + EventInstanceManager eim = getEventInstance(); + + if (eim != null || !(eim instanceof MapleMarriage)) { + return (MapleMarriage) eim; + } else { + return null; + } + } public void resetExcluded(int petId) { chrLock.lock(); @@ -9848,6 +9860,15 @@ public class MapleCharacter extends AbstractMapleCharacterObject { this.partyQuest = pq; } + public void setCpqTimer(ScheduledFuture timer) { + this.cpqSchedule = timer; + } + + public void clearCpqTimer() { + if (cpqSchedule != null) { cpqSchedule.cancel(true); } + cpqSchedule = null; + } + public final void empty(final boolean remove) { if (dragonBloodSchedule != null) { dragonBloodSchedule.cancel(true); } dragonBloodSchedule = null; @@ -9886,8 +9907,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { if (pendantOfSpirit != null) { pendantOfSpirit.cancel(true); } pendantOfSpirit = null; - if (timer != null) { timer.cancel(true); } - timer = null; + clearCpqTimer(); evtLock.lock(); try { @@ -10130,9 +10150,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { private MapleFitness fitness; private MapleOla ola; private long snowballattack; - public static final List itens = new ArrayList(); - public static final List item = new ArrayList(); - + public byte getTeam() { return team; } @@ -10289,38 +10307,5 @@ public class MapleCharacter extends AbstractMapleCharacterObject { public int getLingua() { return getClient().getLingua(); } - - public void setItens(String item) { - if (!itens.contains(item)) { - this.itens.add(item); - } - } - - public static List getItens() { - return itens; - } - - public void setEquips(Item item) { - this.item.add(item); - } - - public static List getItem() { - return item; - } - - public Item getItemid(int numb) { - return this.item.get(numb); - } - - public void removeItem(Item item) { - if (this.item.contains(item)) { - this.item.remove(item); - } - } - - public void obterItens() { - for (Item item : getItem()) { - getClient().getAbstractPlayerInteraction().gainItem(item.getItemId(), item.getQuantity()); - } - } + } \ No newline at end of file diff --git a/src/client/MapleDisease.java b/src/client/MapleDisease.java index f84ad4f1d9..e9daf175df 100644 --- a/src/client/MapleDisease.java +++ b/src/client/MapleDisease.java @@ -21,7 +21,7 @@ */ package client; -import tools.Randomizer; +import constants.GameConstants; public enum MapleDisease { NULL(0x0), @@ -39,16 +39,20 @@ public enum MapleDisease { private long i; private boolean first; - private int disease; + private int mobskill; private MapleDisease(long i) { - this.i = i; - this.first = false; + this(i, false, 0); } - private MapleDisease(long i, int disease) { + private MapleDisease(long i, int skill) { + this(i, false, skill); + } + + private MapleDisease(long i, boolean first, int skill) { this.i = i; - this.disease = disease; + this.first = first; + this.mobskill = skill; } public long getValue() { @@ -56,11 +60,11 @@ public enum MapleDisease { } public boolean isFirst() { - return first; + return first; } - + public int getDisease() { - return disease; + return mobskill; } public static MapleDisease ordinal(int ord) { @@ -72,13 +76,8 @@ public enum MapleDisease { } public static final MapleDisease getRandom() { - while (true) { - for (MapleDisease dis : MapleDisease.values()) { - if (Randomizer.nextInt(MapleDisease.values().length) == 0) { - return dis; - } - } - } + MapleDisease[] diseases = GameConstants.CPQ_DISEASES; + return diseases[(int) (Math.random() * diseases.length)]; } public static final MapleDisease getBySkill(final int skill) { @@ -90,4 +89,4 @@ public enum MapleDisease { return null; } -} +} \ No newline at end of file diff --git a/src/client/inventory/ItemFactory.java b/src/client/inventory/ItemFactory.java index 49fa62af2e..b41946469f 100644 --- a/src/client/inventory/ItemFactory.java +++ b/src/client/inventory/ItemFactory.java @@ -45,7 +45,8 @@ public enum ItemFactory { CASH_CYGNUS(4, true), CASH_ARAN(5, true), MERCHANT(6, false), - CASH_OVERALL(7, true); + CASH_OVERALL(7, true), + MARRIAGE_GIFTS(8, false); private final int value; private final boolean account; private static final Lock locks[] = new Lock[200]; // thanks Masterrulax for pointing out a bottleneck issue here diff --git a/src/client/inventory/MapleInventory.java b/src/client/inventory/MapleInventory.java index 104dfc9b13..fbc1fea6f7 100644 --- a/src/client/inventory/MapleInventory.java +++ b/src/client/inventory/MapleInventory.java @@ -436,7 +436,16 @@ public class MapleInventory implements Iterable { } public static boolean checkSpot(MapleCharacter chr, Item item) { // thanks Vcoc for noticing pshops not checking item stacks when taking item back - return checkSpotsAndOwnership(chr, Collections.singletonList(new Pair<>(item, item.getInventoryType()))); + return checkSpot(chr, Collections.singletonList(item)); + } + + public static boolean checkSpot(MapleCharacter chr, List items) { + List> listItems = new LinkedList<>(); + for (Item item : items) { + listItems.add(new Pair<>(item, item.getInventoryType())); + } + + return checkSpotsAndOwnership(chr, listItems); } public static boolean checkSpots(MapleCharacter chr, List> items) { diff --git a/src/constants/GameConstants.java b/src/constants/GameConstants.java index b77cfe6423..2c57b219ac 100644 --- a/src/constants/GameConstants.java +++ b/src/constants/GameConstants.java @@ -1,5 +1,6 @@ package constants; +import client.MapleDisease; import java.util.ArrayList; import java.util.List; import java.util.HashMap; @@ -33,6 +34,9 @@ public class GameConstants { private final static NumberFormat nfFormatter = new DecimalFormat("#,###,###,###"); private final static NumberFormat nfParser = NumberFormat.getInstance(ServerConstants.USE_UNITPRICE_WITH_COMMA ? Locale.FRANCE : Locale.UK); + public static final MapleDisease[] CPQ_DISEASES = {MapleDisease.SLOW, MapleDisease.SEDUCE, MapleDisease.STUN, MapleDisease.POISON, + MapleDisease.SEAL, MapleDisease.DARKNESS, MapleDisease.WEAKEN, MapleDisease.CURSE}; + public static int getPlayerBonusDropRate(int slot) { return(DROP_RATE_GAIN[slot]); } diff --git a/src/constants/LanguageConstants.java b/src/constants/LanguageConstants.java new file mode 100644 index 0000000000..4f8dabc6ab --- /dev/null +++ b/src/constants/LanguageConstants.java @@ -0,0 +1,73 @@ +package constants; + +import client.MapleCharacter; + +/** + * + * @author Drago - Dragohe4rt + */ +public class LanguageConstants { + // Portugues + public static String CPQAzul; + public static String CPQErro; + public static String CPQEntrada; + public static String CPQEscolha; + public static String CPQVermelho; + public static String CPQPlayerExit; + public static String CPQEntradaLobby; + public static String CPQInicioEscolha; + public static String CPQTempoExtendido; + public static String CPQLiderNaoEncontrado; + public static String CPQInicioEscolhaEmEscolha; + public static String CPQInicioEscolhaEnviada; + + public static LanguageConstants Linguas(MapleCharacter chr) { + if (chr.getLingua() == 0) { + LanguageConstants.CPQAzul = "Maple Azul"; + LanguageConstants.CPQVermelho = "Maple Vermelho"; + LanguageConstants.CPQTempoExtendido = "O tempo foi estendido."; + LanguageConstants.CPQPlayerExit = " deixou o Carnaval de Monstros."; + LanguageConstants.CPQErro = "Ocorreu um problema. Favor recriar a sala."; + LanguageConstants.CPQLiderNaoEncontrado = "Nao foi possivel encontrar o Lider."; + LanguageConstants.CPQInicioEscolha = "Inscreva-se no Festival de Monstros!\\r\\n"; + LanguageConstants.CPQInicioEscolhaEmEscolha = "O grupo esta respondendo um desafio no momento."; + LanguageConstants.CPQInicioEscolhaEnviada = "Um desafio foi enviado para o grupo na sala. Aguarde um momento."; + LanguageConstants.CPQEscolha = "Nao foi possivel encontrar um grupo nesta sala.\\r\\nProvavelmente o grupo foi desfeito dentro da sala!"; + LanguageConstants.CPQEntradaLobby = "Agora voce ira receber desafios de outros grupos. Se voce nao aceitar um desafio em 3 minutos, voce sera levado para fora."; + LanguageConstants.CPQEntrada = "Voce pode selecionar \"Invocar Monstros\", \"Habilidade\", ou \"Protetor\" como sua tatica durante o Carnaval dos Monstros. Use Tab a F1~F12 para acesso rapido!"; + + + + } else if (chr.getLingua() == 1) { + LanguageConstants.CPQAzul = "Maple Azul"; + LanguageConstants.CPQVermelho = "Maple Rojo"; + LanguageConstants.CPQTempoExtendido = "El tiempo se ha ampliado."; + LanguageConstants.CPQPlayerExit = " ha dejado el Carnaval de Monstruos."; + LanguageConstants.CPQLiderNaoEncontrado = "No se pudo encontrar el Lider."; + LanguageConstants.CPQInicioEscolha = "!Inscribete en el Festival de Monstruos!\\r\\n"; + LanguageConstants.CPQErro = "Se ha producido un problema. Por favor, volver a crear una sala."; + LanguageConstants.CPQInicioEscolhaEmEscolha = "El grupo esta respondiendo un desafio en el momento."; + LanguageConstants.CPQInicioEscolhaEnviada = "Un desafio fue enviado al grupo en la sala. Espera un momento."; + LanguageConstants.CPQEscolha = "No se pudo encontrar un grupo en esta sala.\\r\\nProbablemente el grupo fue deshecho dentro de la sala!"; + LanguageConstants.CPQEntradaLobby = "Ahora usted recibira los retos de otros grupos. Si usted no acepta un desafio en 3 minutos, usted sera llevado hacia fuera."; + LanguageConstants.CPQEntrada = "Usted puede seleccionar \"Invocar Monstruos \", \"Habilidad \", o \"Protector \" como su tactica durante el Carnaval de los Monstruos. Utilice Tab y F1 ~ F12 para acceso rapido!"; + + + } else if (chr.getLingua() == 2) { + LanguageConstants.CPQAzul = "Maple Blue"; + LanguageConstants.CPQVermelho = "Maple Red"; + LanguageConstants.CPQPlayerExit = " left the Carnival of Monsters."; + LanguageConstants.CPQTempoExtendido = "The time has been extended."; + LanguageConstants.CPQLiderNaoEncontrado = "Could not find the Leader."; + LanguageConstants.CPQErro = "There was a problem. Please re-create a room."; + LanguageConstants.CPQInicioEscolha = "Sign up for the Monster Festival!\\r\\n"; + LanguageConstants.CPQInicioEscolhaEmEscolha = "The group is currently facing a challenge."; + LanguageConstants.CPQInicioEscolhaEnviada = "A challenge has been sent to the group in the room. Please wait a while."; + LanguageConstants.CPQEscolha = "We could not find a group in this room.\\r\\nProbably the group was scrapped inside the room!"; + LanguageConstants.CPQEntradaLobby = "You will now receive challenges from other groups. If you do not accept a challenge within 3 minutes, you will be taken out."; + LanguageConstants.CPQEntrada = "You can select \"Summon Monsters \", \"Ability \", or \"Protector \" as your tactic during the Monster Carnival. Use Tab and F1 ~ F12 for quick access!"; + + } + return null; + } +} diff --git a/src/constants/LinguaConstants.java b/src/constants/LinguaConstants.java deleted file mode 100644 index af1089d60e..0000000000 --- a/src/constants/LinguaConstants.java +++ /dev/null @@ -1,69 +0,0 @@ -package constants; - -import client.MapleCharacter; - -/** - * - * @author Drago - Dragohe4rt - */ -public class LinguaConstants { - // Portugues - public static String CPQAzul; - public static String CPQErro; - public static String CPQEntrada; - public static String CPQEscolha; - public static String CPQVermelho; - public static String CPQPlayerExit; - public static String CPQEntradaLobby; - public static String CPQInicioEscolha; - public static String CPQTempoExtendido; - public static String CPQLiderNaoEncontrado; - public static String CPQInicioEscolhaEmEscolha; - - public static LinguaConstants Linguas(MapleCharacter chr) { - if (chr.getLingua() == 0) { - LinguaConstants.CPQAzul = "Maple Azul"; - LinguaConstants.CPQVermelho = "Maple Vermelho"; - LinguaConstants.CPQTempoExtendido = "O tempo foi estendido."; - LinguaConstants.CPQPlayerExit = " deixou o Carnaval de Monstros."; - LinguaConstants.CPQErro = "Ocorreu um problema. Favor recriar a sala."; - LinguaConstants.CPQLiderNaoEncontrado = "Não foi possível encontrar o Lider."; - LinguaConstants.CPQInicioEscolha = "Inscreva-se no Festival de Monstros!\\r\\n"; - LinguaConstants.CPQInicioEscolhaEmEscolha = "O grupo esta respondendo um desafio no momento."; - LinguaConstants.CPQEscolha = "Não foi possí­vel encontrar um grupo nesta sala.\\r\\nProvavelmente o grupo foi desfeito dentro da sala!"; - LinguaConstants.CPQEntradaLobby = "[CPQ MapleStorySA] Agora você irá receber desafios de outros grupos. Se você não aceitar um desafio em 3 minutos, você será levado para fora."; - LinguaConstants.CPQEntrada = "Você pode selecionar \"Invocar Monstros\", \"Habilidade\", ou \"Protetor\" como sua tática durante o Carnaval dos Monstros. Use Tab a F1~F12 para acesso rápido!"; - - - - } else if (chr.getLingua() == 1) { - LinguaConstants.CPQAzul = "Maple Azul"; - LinguaConstants.CPQVermelho = "Maple Rojo"; - LinguaConstants.CPQTempoExtendido = "El tiempo se ha ampliado."; - LinguaConstants.CPQPlayerExit = " ha dejado el Carnaval de Monstruos."; - LinguaConstants.CPQLiderNaoEncontrado = "No se pudo encontrar el Lider."; - LinguaConstants.CPQInicioEscolha = "¡Inscríbete en el Festival de Monstruos!\\r\\n"; - LinguaConstants.CPQErro = "Se ha producido un problema. Por favor, volver a crear una sala."; - LinguaConstants.CPQInicioEscolhaEmEscolha = "El grupo esta respondiendo un desafío en el momento."; - LinguaConstants.CPQEscolha = "No se pudo encontrar un grupo en esta sala.\\r\\nProbablemente el grupo fue deshecho dentro de la sala!"; - LinguaConstants.CPQEntradaLobby = "[CPQ MapleStorySA] Ahora usted recibirá los retos de otros grupos. Si usted no acepta un desafío en 3 minutos, usted será llevado hacia fuera."; - LinguaConstants.CPQEntrada = "Usted puede seleccionar \"Invocar Monstruos \", \"Habilidad \", o \"Protector \" como su táctica durante el Carnaval de los Monstruos. Utilice Tab y F1 ~ F12 para acceso rápido!"; - - - } else if (chr.getLingua() == 2) { - LinguaConstants.CPQAzul = "Maple Blue"; - LinguaConstants.CPQVermelho = "Maple Red"; - LinguaConstants.CPQPlayerExit = " left the Carnival of Monsters."; - LinguaConstants.CPQTempoExtendido = "The time has been extended."; - LinguaConstants.CPQLiderNaoEncontrado = "Could not find the Leader."; - LinguaConstants.CPQErro = "There was a problem. Please re-create a room."; - LinguaConstants.CPQInicioEscolha = "Sign up for the Monster Festival!\\r\\n"; - LinguaConstants.CPQInicioEscolhaEmEscolha = "The group is currently facing a challenge."; - LinguaConstants.CPQEscolha = "We could not find a group in this room.\\r\\nProbably the group was scrapped inside the room!"; - LinguaConstants.CPQEntradaLobby = "[CPQ MapleStorySA] You will now receive challenges from other groups. If you do not accept a challenge within 3 minutes, you will be taken out."; - LinguaConstants.CPQEntrada = "You can select \"Summon Monsters \", \"Ability \", or \"Protector \" as your tactic during the Monster Carnival. Use Tab and F1 ~ F12 for quick access!"; - - } - return null; - } -} diff --git a/src/constants/ServerConstants.java b/src/constants/ServerConstants.java index 7a9b0fac83..1268c7faa0 100644 --- a/src/constants/ServerConstants.java +++ b/src/constants/ServerConstants.java @@ -34,7 +34,7 @@ public class ServerConstants { public static final int BYPASS_PIC_EXPIRATION = 20; //Enables PIC bypass, which will remain active for that account by that client machine for N minutes. Set 0 to disable. public static final int BYPASS_PIN_EXPIRATION = 15; //Enables PIN bypass, which will remain active for that account by that client machine for N minutes. Set 0 to disable. - public static final boolean AUTOMATIC_REGISTER = false; //Automatically register players when they login with a nonexistent username. + public static final boolean AUTOMATIC_REGISTER = true; //Automatically register players when they login with a nonexistent username. public static final boolean BCRYPT_MIGRATION = true; //Performs a migration from old SHA-1 and SHA-512 password to bcrypt. public static final boolean COLLECTIVE_CHARSLOT = false; //Available character slots are contabilized globally rather than per world server. public static final boolean DETERRED_MULTICLIENT = false; //Enables multi-client and suspicious remote IP detection on the login system. @@ -59,7 +59,7 @@ public class ServerConstants { public static final boolean USE_CUSTOM_KEYSET = true; //Enables auto-setup of the HeavenMS's custom keybindings when creating characters. public static final boolean USE_DEBUG = false; //Will enable some text prints on the client, oriented for debugging purposes. public static final boolean USE_DEBUG_SHOW_INFO_EQPEXP = false; //Prints on the cmd all equip exp gain info. - public static boolean USE_DEBUG_SHOW_RCVD_PACKET = true; //Prints on the cmd all received packet ids. + public static boolean USE_DEBUG_SHOW_RCVD_PACKET = false; //Prints on the cmd all received packet ids. public static boolean USE_DEBUG_SHOW_RCVD_MVLIFE = false; //Prints on the cmd all received move life content. public static boolean USE_SUPPLY_RATE_COUPONS = true; //Allows rate coupons to be sold through the Cash Shop. @@ -277,6 +277,7 @@ public class ServerConstants { public static final int WEDDING_RESERVATION_TIMEOUT = 10; //Limit time in minutes for the couple to show up before cancelling the wedding reservation. public static final int WEDDING_RESERVATION_INTERVAL = 60; //Time between wedding starts in minutes. public static final int WEDDING_BLESS_EXP = 30000; //Exp gained per bless count. + public static final int WEDDING_GIFT_LIMIT = 1; //Max number of gifts per person to same wishlist on marriage instances. public static final boolean WEDDING_BLESSER_SHOWFX = true; //Pops bubble sprite effect on players blessing the couple. Setting this false shows the blessing effect on the couple instead. //Buyback Configuration diff --git a/src/net/server/channel/handlers/MonsterCarnivalHandler.java b/src/net/server/channel/handlers/MonsterCarnivalHandler.java index fe18b82532..16c78e6a80 100644 --- a/src/net/server/channel/handlers/MonsterCarnivalHandler.java +++ b/src/net/server/channel/handlers/MonsterCarnivalHandler.java @@ -33,6 +33,7 @@ import server.life.MapleLifeFactory; import server.life.MapleMonster; import server.partyquest.MapleCarnivalFactory; import server.partyquest.MapleCarnivalFactory.MCSkill; +import server.partyquest.MonsterCarnival; import tools.MaplePacketCreator; import tools.Pair; import tools.data.input.SeekableLittleEndianAccessor; @@ -46,87 +47,95 @@ public final class MonsterCarnivalHandler extends AbstractMaplePacketHandler { @Override public void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) { + c.tryacquireClient(); try { - int tab = slea.readByte(); - int num = slea.readByte(); - int neededCP = 0; - if (tab == 0) { - final List> mobs = c.getPlayer().getMap().getMobsToSpawn(); - if (num >= mobs.size() || c.getPlayer().getCP() < mobs.get(num).right) { - c.announce(MaplePacketCreator.CPQMessage((byte) 1)); - c.getSession().write(MaplePacketCreator.enableActions()); - return; - } - - final MapleMonster mob = MapleLifeFactory.getMonster(mobs.get(num).left); - if (c.getPlayer().getMonsterCarnival() != null) { - Point spawnPos = c.getPlayer().getMap().getRandomSP(c.getPlayer().getTeam()); - if (!c.getPlayer().getMonsterCarnival().canSummon() && c.getPlayer().getTeam() == 0 || !c.getPlayer().getMonsterCarnival().canSummons() && c.getPlayer().getTeam() == 1) { - c.announce(MaplePacketCreator.CPQMessage((byte) 2)); - c.getSession().write(MaplePacketCreator.enableActions()); + try { + int tab = slea.readByte(); + int num = slea.readByte(); + int neededCP = 0; + if (tab == 0) { + final List> mobs = c.getPlayer().getMap().getMobsToSpawn(); + if (num >= mobs.size() || c.getPlayer().getCP() < mobs.get(num).right) { + c.announce(MaplePacketCreator.CPQMessage((byte) 1)); + c.announce(MaplePacketCreator.enableActions()); return; } - mob.setPosition(spawnPos); - if (c.getPlayer().getTeam() == 0) { - c.getPlayer().getMonsterCarnival().summon(); - } else { - c.getPlayer().getMonsterCarnival().summons(); - } + + final MapleMonster mob = MapleLifeFactory.getMonster(mobs.get(num).left); + MonsterCarnival mcpq = c.getPlayer().getMonsterCarnival(); + if (mcpq != null) { + if (!mcpq.canSummonR() && c.getPlayer().getTeam() == 0 || !mcpq.canSummonB() && c.getPlayer().getTeam() == 1) { + c.announce(MaplePacketCreator.CPQMessage((byte) 2)); + c.announce(MaplePacketCreator.enableActions()); + return; + } + + if (c.getPlayer().getTeam() == 0) { + mcpq.summonR(); + } else { + mcpq.summonB(); + } + + Point spawnPos = c.getPlayer().getMap().getRandomSP(c.getPlayer().getTeam()); + mob.setPosition(spawnPos); + c.getPlayer().getMap().addMonsterSpawn(mob, 1, c.getPlayer().getTeam()); - c.getSession().write(MaplePacketCreator.enableActions()); + c.getPlayer().getMap().addAllMonsterSpawn(mob, 1, c.getPlayer().getTeam()); + c.announce(MaplePacketCreator.enableActions()); } + neededCP = mobs.get(num).right; } else if (tab == 1) { //debuffs final List skillid = c.getPlayer().getMap().getSkillIds(); if (num >= skillid.size()) { c.getPlayer().dropMessage(5, "Ocorreu um erro."); - c.getSession().write(MaplePacketCreator.enableActions()); + c.announce(MaplePacketCreator.enableActions()); return; } - final MCSkill skil = MapleCarnivalFactory.getInstance().getSkill(skillid.get(num)); //ugh wtf - if (skil == null || c.getPlayer().getCP() < skil.cpLoss) { + final MCSkill skill = MapleCarnivalFactory.getInstance().getSkill(skillid.get(num)); //ugh wtf + if (skill == null || c.getPlayer().getCP() < skill.cpLoss) { c.announce(MaplePacketCreator.CPQMessage((byte) 1)); - c.getSession().write(MaplePacketCreator.enableActions()); + c.announce(MaplePacketCreator.enableActions()); return; } - final MapleDisease dis = skil.getDisease(); - MapleParty inimigos = c.getPlayer().getParty().getEnemy(); - if (skil.targetsAll) { + final MapleDisease dis = skill.getDisease(); + MapleParty enemies = c.getPlayer().getParty().getEnemy(); + if (skill.targetsAll) { int chanceAcerto = 0; if (dis.getDisease() == 121 || dis.getDisease() == 122 || dis.getDisease() == 125 || dis.getDisease() == 126) { chanceAcerto = (int) (Math.random() * 100); } if (chanceAcerto <= 80) { - for (MaplePartyCharacter chrS : inimigos.getPartyMembers()) { + for (MaplePartyCharacter chrS : enemies.getPartyMembers()) { if (dis == null) { chrS.getPlayer().dispel(); } else { - chrS.getPlayer().giveDebuff(dis, skil.getSkill()); + chrS.getPlayer().giveDebuff(dis, skill.getSkill()); } - if (!skil.targetsAll) { + if (!skill.targetsAll) { break; } } } } else { - int amount = inimigos.getMembers().size() - 1; + int amount = enemies.getMembers().size() - 1; int randd = (int) Math.floor(Math.random() * amount); - MapleCharacter chrApp = c.getChannelServer().getPlayerStorage().getCharacterById(inimigos.getMemberByPos(randd).getId()); + MapleCharacter chrApp = c.getChannelServer().getPlayerStorage().getCharacterById(enemies.getMemberByPos(randd).getId()); if (chrApp != null && chrApp.getMap().isCPQMap()) { if (dis == null) { chrApp.dispel(); } else { - chrApp.giveDebuff(dis, skil.getSkill()); + chrApp.giveDebuff(dis, skill.getSkill()); } } } - neededCP = skil.cpLoss; - c.getSession().write(MaplePacketCreator.enableActions()); + neededCP = skill.cpLoss; + c.announce(MaplePacketCreator.enableActions()); } else if (tab == 2) { //protectors - final MCSkill skil = MapleCarnivalFactory.getInstance().getGuardian(num); - if (skil == null || c.getPlayer().getCP() < skil.cpLoss) { + final MCSkill skill = MapleCarnivalFactory.getInstance().getGuardian(num); + if (skill == null || c.getPlayer().getCP() < skill.cpLoss) { c.announce(MaplePacketCreator.CPQMessage((byte) 1)); - c.getSession().write(MaplePacketCreator.enableActions()); + c.announce(MaplePacketCreator.enableActions()); return; } int success = c.getPlayer().getMap().spawnGuardian(c.getPlayer().getTeam(), num); @@ -138,17 +147,20 @@ public final class MonsterCarnivalHandler extends AbstractMaplePacketHandler { } else if (success == 2) { c.announce(MaplePacketCreator.CPQMessage((byte) 3)); } - c.getSession().write(MaplePacketCreator.enableActions()); + c.announce(MaplePacketCreator.enableActions()); return; } else { - neededCP = skil.cpLoss; + neededCP = skill.cpLoss; } } c.getPlayer().gainCP(-neededCP); c.getPlayer().getMap().broadcastMessage(MaplePacketCreator.playerSummoned(c.getPlayer().getName(), tab, num)); }catch (Exception e) { - e.printStackTrace(); + e.printStackTrace(); + } + } finally { + c.releaseClient(); } - } - } + +} diff --git a/src/net/server/channel/handlers/RingActionHandler.java b/src/net/server/channel/handlers/RingActionHandler.java index 33a9f29648..7424877e31 100644 --- a/src/net/server/channel/handlers/RingActionHandler.java +++ b/src/net/server/channel/handlers/RingActionHandler.java @@ -21,32 +21,34 @@ */ package net.server.channel.handlers; -import client.MapleClient; -import client.MapleCharacter; -import client.inventory.MapleInventoryType; -import client.processor.DueyProcessor; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; -import net.AbstractMaplePacketHandler; -import client.inventory.manipulator.MapleInventoryManipulator; -import tools.DatabaseConnection; -import tools.data.input.SeekableLittleEndianAccessor; -import tools.Pair; -import tools.MaplePacketCreator; -import tools.packets.Wedding; -import net.server.world.World; -import net.server.channel.Channel; -import server.MapleItemInformationProvider; + +import client.MapleClient; +import client.MapleCharacter; import client.MapleRing; import client.inventory.Equip; import client.inventory.Item; +import client.inventory.MapleInventoryType; +import client.inventory.manipulator.MapleInventoryManipulator; +import client.processor.DueyProcessor; +import net.AbstractMaplePacketHandler; +import net.server.world.World; +import net.server.channel.Channel; +import server.MapleItemInformationProvider; +import scripting.event.EventInstanceManager; +import tools.DatabaseConnection; +import tools.Pair; +import tools.MaplePacketCreator; +import tools.data.input.SeekableLittleEndianAccessor; +import tools.packets.Wedding; /** * @author Jvlaple * @author Ronan - major overhaul on Ring handling mechanics - * @author Drago/Dragohe4rt on Wishlist + * @author Drago/Dragohe4rt - on Wishlist */ public final class RingActionHandler extends AbstractMaplePacketHandler { private static int getBoxId(int useItemId) { @@ -463,57 +465,42 @@ public final class RingActionHandler extends AbstractMaplePacketHandler { break; case 9: - // By Drago/Dragohe4rt - // Groom and Bride's Wishlist - //short size = slea.readShort(); - int amount = slea.readShort(); - if (amount > 10) { - amount = 10; - } - for (int i = 0; i < amount; i++) { - c.getPlayer().setItens(slea.readMapleAsciiString()); - } - - //System.out.println("G&B WISHLIST: " + itemnames); - - /* - if (c.getPlayer().getMarriageItemId() > -1) { - switch(c.getPlayer().getMarriageItemId()) { - case 10: // Premium Cathedral - c.getAbstractPlayerInteraction().gainItem(4031375, (short)1); - c.getAbstractPlayerInteraction().gainItem(4031395, (short)15); - break; - case 11: // Normal Cathedral - c.getAbstractPlayerInteraction().gainItem(4031480, (short)1); - c.getAbstractPlayerInteraction().gainItem(4031395, (short)15); - break; - case 20: // Premium Chapel - c.getAbstractPlayerInteraction().gainItem(4031376, (short)1); - c.getAbstractPlayerInteraction().gainItem(4031377, (short)15); - break; - case 21: // Normal Chapel - c.getAbstractPlayerInteraction().gainItem(4031481, (short)1); - c.getAbstractPlayerInteraction().gainItem(4031377, (short)15); - break; - default: { - System.out.println("Invalid Wedding Type for player " + c.getPlayer().getName() + "!"); - break; + try { + // By Drago/Dragohe4rt + // Groom and Bride's Wishlist + + MapleCharacter player = c.getPlayer(); + + EventInstanceManager eim = player.getEventInstance(); + if (eim != null) { + boolean isMarrying = (player.getId() == eim.getIntProperty("groomId") || player.getId() == eim.getIntProperty("brideId")); + + if (isMarrying) { + int amount = slea.readShort(); + if (amount > 10) { + amount = 10; + } + + String wishlistItems = ""; + for (int i = 0; i < amount; i++) { + String s = slea.readMapleAsciiString(); + wishlistItems += (s + "\r\n"); + } + + String wlKey; + if (player.getId() == eim.getIntProperty("groomId")) { + wlKey = "groomWishlist"; + } else { + wlKey = "brideWishlist"; + } + + if (eim.getProperty(wlKey).contentEquals("")) { + eim.setProperty(wlKey, wishlistItems); + } } } - - //c.getPlayer().setMarriageItemId(-1); ????? - } + } catch (NumberFormatException nfe) {} - if (c.getPlayer().getWishlist() == null) { - c.getPlayer().registerWishlist(itemnames); - } - - if (c.getPlayer().getWedding() != null) { - if (c.getPlayer().getGender() == 0 ? c.getPlayer().getWedding().isExistantGroom(c.getPlayer().getId()) : c.getPlayer().getWedding().isExistantBride(c.getPlayer().getId())) { - c.getPlayer().getWedding().registerWishlist(c.getPlayer().getGender() == 1, itemnames); - } - } - */ break; default: diff --git a/src/net/server/channel/handlers/WeddingHandler.java b/src/net/server/channel/handlers/WeddingHandler.java index 301c3ce5db..f7eb05bc9b 100644 --- a/src/net/server/channel/handlers/WeddingHandler.java +++ b/src/net/server/channel/handlers/WeddingHandler.java @@ -6,19 +6,23 @@ package net.server.channel.handlers; -import client.inventory.Item; -import client.inventory.MapleInventoryType; + import client.MapleCharacter; import client.MapleClient; -import client.inventory.Equip; -import constants.ItemConstants; -import net.AbstractMaplePacketHandler; +import client.inventory.Item; +import client.inventory.MapleInventory; +import client.inventory.MapleInventoryType; import client.inventory.manipulator.MapleInventoryManipulator; -import net.server.channel.Channel; -import scripting.event.EventInstanceManager; +import client.inventory.manipulator.MapleKarmaManipulator; +import constants.ItemConstants; +import constants.ServerConstants; +import net.AbstractMaplePacketHandler; +import server.MapleMarriage; import tools.MaplePacketCreator; import tools.data.input.SeekableLittleEndianAccessor; import tools.packets.Wedding; +import java.util.Collections; +import java.util.List; /** * @@ -28,43 +32,123 @@ public final class WeddingHandler extends AbstractMaplePacketHandler { @Override public final void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) { - MapleCharacter chr = c.getPlayer(); - final byte mode = slea.readByte(); - Channel cs = c.getChannelServer(); - if (mode == 6) { //additem - short slot = slea.readShort(); - int itemid = slea.readInt(); - short quantity = slea.readShort(); - EventInstanceManager eim = c.getPlayer().getEventInstance(); - if (eim != null) { - String name = eim.getProperty("brideId"); - MapleCharacter chrs = cs.getPlayerStorage().getCharacterById(Integer.parseInt(name)); - //MapleCharacter chrs = cs.getPlayerStorage().getCharacterById(3); - MapleInventoryType type = ItemConstants.getInventoryType(itemid); - Item item = chr.getInventory(type).getItem((byte) slot); - if (itemid == item.getItemId() && quantity <= item.getQuantity()) { - if(!(item instanceof Equip)) { - item = new Item(itemid, slot, quantity); - } - chrs.setEquips(item); - MapleInventoryManipulator.removeById(chr.getClient(), type, itemid, quantity, false, false); - c.announce(Wedding.OnWeddingGiftResult((byte) 0xB, chrs.getItens(), chrs.getItem())); - } - } - } else if (mode == 7) { // noiva abre e pega itens - byte inventId = slea.readByte(); - int itemPos = slea.readByte(); - MapleInventoryType inv = MapleInventoryType.getByType(inventId); - Item item = chr.getItemid(itemPos); - c.getAbstractPlayerInteraction().gainItem(item.getItemId(), item.getQuantity()); - chr.removeItem(item); - c.announce(Wedding.OnWeddingGiftResult((byte) 0xF, chr.getItens(), chr.getItem())); - } else if (mode == 8) { // sair update? + c.tryacquireClient(); + try { + MapleCharacter chr = c.getPlayer(); + final byte mode = slea.readByte(); - c.announce(MaplePacketCreator.enableActions()); - } else { - System.out.println(mode); + if (mode == 6) { //additem + short slot = slea.readShort(); + int itemid = slea.readInt(); + short quantity = slea.readShort(); + + MapleMarriage marriage = c.getPlayer().getMarriageInstance(); + if (marriage != null) { + try { + boolean groomWishlist = marriage.giftItemToSpouse(chr.getId()); + String groomWishlistProp = "giftedItem" + (groomWishlist ? "G" : "B") + chr.getId(); + + int giftCount = marriage.getIntProperty(groomWishlistProp); + if (giftCount < ServerConstants.WEDDING_GIFT_LIMIT) { + int cid = marriage.getIntProperty(groomWishlist ? "groomId" : "brideId"); + if (chr.getId() != cid) { // cannot gift yourself + MapleCharacter spouse = marriage.getPlayerById(cid); + if (spouse != null) { + MapleInventoryType type = ItemConstants.getInventoryType(itemid); + MapleInventory chrInv = chr.getInventory(type); + + chrInv.lockInventory(); + try { + Item item = chrInv.getItem((byte) slot); + if (item != null) { + if (!item.isUntradeable()) { + if (itemid == item.getItemId() && quantity <= item.getQuantity()) { + Item newItem = item.copy(); + + marriage.addGiftItem(groomWishlist, newItem); + MapleInventoryManipulator.removeFromSlot(c, type, slot, quantity, false, false); + + if (ServerConstants.USE_ENFORCE_MERCHANT_SAVE) chr.saveCharToDB(false); + marriage.saveGiftItemsToDb(c, groomWishlist, cid); + + MapleKarmaManipulator.toggleKarmaFlagToUntradeable(newItem); + marriage.setIntProperty(groomWishlistProp, giftCount + 1); + + c.announce(Wedding.OnWeddingGiftResult((byte) 0xB, marriage.getWishlistItems(groomWishlist), Collections.singletonList(newItem))); + } + } else { + c.announce(Wedding.OnWeddingGiftResult((byte) 0xE, marriage.getWishlistItems(groomWishlist), null)); + } + } + } finally { + chrInv.unlockInventory(); + } + } else { + c.announce(Wedding.OnWeddingGiftResult((byte) 0xE, marriage.getWishlistItems(groomWishlist), null)); + } + } else { + c.announce(Wedding.OnWeddingGiftResult((byte) 0xE, marriage.getWishlistItems(groomWishlist), null)); + } + } else { + c.announce(Wedding.OnWeddingGiftResult((byte) 0xC, marriage.getWishlistItems(groomWishlist), null)); + } + } catch (NumberFormatException nfe) {} + } else { + c.announce(MaplePacketCreator.enableActions()); + } + } else if (mode == 7) { // take items + slea.readByte(); // invType + int itemPos = slea.readByte(); + + MapleMarriage marriage = chr.getMarriageInstance(); + if (marriage != null) { + Boolean groomWishlist = marriage.isMarriageGroom(chr); + if (groomWishlist != null) { + Item item = marriage.getGiftItem(c, groomWishlist, itemPos); + if (item != null) { + if (MapleInventory.checkSpot(chr, item)) { + marriage.removeGiftItem(groomWishlist, item); + marriage.saveGiftItemsToDb(c, groomWishlist, chr.getId()); + + MapleInventoryManipulator.addFromDrop(c, item, true); + + c.announce(Wedding.OnWeddingGiftResult((byte) 0xF, marriage.getWishlistItems(groomWishlist), marriage.getGiftItems(c, groomWishlist))); + } else { + c.getPlayer().dropMessage(1, "Free a slot on your inventory before collecting this item."); + c.announce(Wedding.OnWeddingGiftResult((byte) 0xE, marriage.getWishlistItems(groomWishlist), marriage.getGiftItems(c, groomWishlist))); + } + } else { + c.getPlayer().dropMessage(1, "You have already collected this item."); + c.announce(Wedding.OnWeddingGiftResult((byte) 0xE, marriage.getWishlistItems(groomWishlist), marriage.getGiftItems(c, groomWishlist))); + } + } + } else { + List items = c.getAbstractPlayerInteraction().getUnclaimedMarriageGifts(); + try { + Item item = items.get(itemPos); + if (MapleInventory.checkSpot(chr, item)) { + items.remove(itemPos); + MapleMarriage.saveGiftItemsToDb(c, items, chr.getId()); + + MapleInventoryManipulator.addFromDrop(c, item, true); + c.announce(Wedding.OnWeddingGiftResult((byte) 0xF, Collections.singletonList(""), items)); + } else { + c.getPlayer().dropMessage(1, "Free a slot on your inventory before collecting this item."); + c.announce(Wedding.OnWeddingGiftResult((byte) 0xE, Collections.singletonList(""), items)); + } + } catch (Exception e) { + c.getPlayer().dropMessage(1, "You have already collected this item."); + c.announce(Wedding.OnWeddingGiftResult((byte) 0xE, Collections.singletonList(""), items)); + } + } + } else if (mode == 8) { // out of Wedding Registry + c.announce(MaplePacketCreator.enableActions()); + } else { + System.out.println(mode); + } + } finally { + c.releaseClient(); } } } \ No newline at end of file diff --git a/src/net/server/world/MaplePartyCharacter.java b/src/net/server/world/MaplePartyCharacter.java index d2c4096c51..4fd23306cf 100644 --- a/src/net/server/world/MaplePartyCharacter.java +++ b/src/net/server/world/MaplePartyCharacter.java @@ -182,7 +182,7 @@ public class MaplePartyCharacter { case 222: return "Arquimago (Gelo, Raio)"; case 230: - return "Clérigo"; + return "Clerigo"; case 231: return "Sacerdote"; case 232: @@ -191,7 +191,7 @@ public class MaplePartyCharacter { case 300: return "Arqueiro"; case 310: - return "Caçador"; + return "Cacador"; case 311: return "Rastreador"; case 312: @@ -231,7 +231,7 @@ public class MaplePartyCharacter { case 521: return "Bucaneiro"; case 522: - return "Captain"; + return "Capitao"; default: return "Unknown Job"; diff --git a/src/scripting/AbstractPlayerInteraction.java b/src/scripting/AbstractPlayerInteraction.java index 5085fee67e..b108af4180 100644 --- a/src/scripting/AbstractPlayerInteraction.java +++ b/src/scripting/AbstractPlayerInteraction.java @@ -55,7 +55,6 @@ import tools.MaplePacketCreator; import client.MapleCharacter; import client.MapleClient; import client.MapleQuestStatus; -import client.MapleStat; import client.SkillFactory; import client.inventory.Equip; import client.inventory.Item; @@ -68,6 +67,7 @@ import client.inventory.manipulator.MapleInventoryManipulator; import constants.GameConstants; import constants.ItemConstants; import constants.ServerConstants; +import server.MapleMarriage; import server.life.MapleNPC; import tools.Pair; @@ -1048,6 +1048,10 @@ public class AbstractPlayerInteraction { return list; } + public List getUnclaimedMarriageGifts() { + return MapleMarriage.loadGiftItemsFromDb(this.getClient(), this.getPlayer().getId()); + } + public boolean startDungeonInstance(int dungeonid) { return c.getChannelServer().addMiniDungeon(dungeonid); } @@ -1101,7 +1105,7 @@ public class AbstractPlayerInteraction { c.announce(MaplePacketCreator.getNPCTalk(npcid, (byte) 0, message, "00 00", (byte) 0)); } - public long getCurrentTime() { - return System.currentTimeMillis(); - } + public long getCurrentTime() { + return Server.getInstance().getCurrentTime(); + } } \ No newline at end of file diff --git a/src/scripting/event/EventInstanceManager.java b/src/scripting/event/EventInstanceManager.java index 6c0fb043f7..859c8c82a2 100644 --- a/src/scripting/event/EventInstanceManager.java +++ b/src/scripting/event/EventInstanceManager.java @@ -55,10 +55,16 @@ import tools.DatabaseConnection; import client.MapleCharacter; import client.SkillFactory; import client.Skill; +import client.inventory.Item; +import client.inventory.ItemFactory; +import client.inventory.MapleInventory; +import client.inventory.MapleInventoryType; +import client.inventory.manipulator.MapleInventoryManipulator; import constants.ItemConstants; import constants.ServerConstants; import java.awt.Point; import java.sql.Connection; +import java.util.Arrays; import java.util.concurrent.ScheduledFuture; import java.util.concurrent.locks.ReentrantReadWriteLock; import java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock; @@ -73,6 +79,7 @@ import server.ThreadManager; import server.life.MapleLifeFactory; import server.life.MapleNPC; import tools.MaplePacketCreator; +import tools.Randomizer; /** * @@ -89,6 +96,7 @@ public class EventInstanceManager { private MapleMapFactory mapFactory; private String name; private Properties props = new Properties(); + private Map objectProps = new HashMap<>(); private long timeStarted = 0; private long eventTime = 0; private MapleExpedition expedition = null; @@ -628,6 +636,7 @@ public class EventInstanceManager { killCount.clear(); mapIds.clear(); props.clear(); + objectProps.clear(); disposeExpedition(); @@ -741,6 +750,15 @@ public class EventInstanceManager { pL.unlock(); } } + + public void setObjectProperty(String key, Object obj) { + pL.lock(); + try { + objectProps.put(key, obj); + } finally { + pL.unlock(); + } + } public String getProperty(String key) { pL.lock(); @@ -759,6 +777,15 @@ public class EventInstanceManager { pL.unlock(); } } + + public Object getObjectProperty(String key) { + pL.lock(); + try { + return objectProps.get(key); + } finally { + pL.unlock(); + } + } public void leftParty(final MapleCharacter chr) { try { diff --git a/src/scripting/event/EventManager.java b/src/scripting/event/EventManager.java index b856f461d1..ba91944e1f 100644 --- a/src/scripting/event/EventManager.java +++ b/src/scripting/event/EventManager.java @@ -42,6 +42,7 @@ import net.server.guild.MapleGuild; import net.server.world.MapleParty; import net.server.world.MaplePartyCharacter; import scripting.event.worker.EventScriptScheduler; +import server.MapleMarriage; import server.expeditions.MapleExpedition; import server.maps.MapleMap; import server.life.MapleMonster; @@ -279,6 +280,19 @@ public class EventManager { } return ret; } + + public MapleMarriage newMarriage(String name) throws EventInstanceInProgressException { + MapleMarriage ret = new MapleMarriage(this, name); + + synchronized (instances) { + if (instances.containsKey(name)) { + throw new EventInstanceInProgressException(name, this.getName()); + } + + instances.put(name, ret); + } + return ret; + } public void disposeInstance(final String name) { ess.registerEntry(new Runnable() { diff --git a/src/scripting/npc/NPCConversationManager.java b/src/scripting/npc/NPCConversationManager.java index cb42d07499..76a6741a3a 100644 --- a/src/scripting/npc/NPCConversationManager.java +++ b/src/scripting/npc/NPCConversationManager.java @@ -58,22 +58,23 @@ import client.inventory.Item; import client.inventory.ItemFactory; import client.inventory.MaplePet; import constants.ItemConstants; -import constants.LinguaConstants; +import constants.LanguageConstants; +import net.server.PlayerStorage; import net.server.channel.Channel; -import scripting.event.EventInstanceManager; import server.MapleSkillbookInformationProvider; import server.MapleSkillbookInformationProvider.SkillBookEntry; import server.TimerManager; import server.maps.MapleMapObject; import server.maps.MapleMapObjectType; import server.partyquest.MonsterCarnival; -import tools.FilePrinter; import tools.packets.Wedding; import java.awt.Point; import java.util.Arrays; +import java.util.Collections; import java.util.LinkedList; import java.util.List; +import server.MapleMarriage; /** * @@ -619,8 +620,7 @@ public class NPCConversationManager extends AbstractPlayerInteraction { public int calcAvgLvl(int map) { int num = 0; int avg = 0; - for (MapleMapObject mmo - : c.getChannelServer().getMapFactory().getMap(map).getAllPlayer()) { + for (MapleMapObject mmo : c.getChannelServer().getMapFactory().getMap(map).getAllPlayer()) { avg += ((MapleCharacter) mmo).getLevel(); num++; } @@ -629,7 +629,7 @@ public class NPCConversationManager extends AbstractPlayerInteraction { } public void sendCPQMapLists() { - String msg = LinguaConstants.Linguas(getPlayer()).CPQInicioEscolha; + String msg = LanguageConstants.Linguas(getPlayer()).CPQInicioEscolha; for (int i = 0; i < 6; i++) { if (fieldTaken(i)) { if (fieldLobbied(i)) { @@ -641,7 +641,7 @@ public class NPCConversationManager extends AbstractPlayerInteraction { continue; } } else { - if (i == 0 || i == 1 || i == 2 || i == 3) { + if (i >= 0 && i <= 3) { msg += "#b#L" + i + "#Map " + (i + 1) + " (2x2) #l\\r\\n"; } else { msg += "#b#L" + i + "#Map " + (i + 1) + " (3x3) #l\\r\\n"; @@ -673,16 +673,18 @@ public class NPCConversationManager extends AbstractPlayerInteraction { public void cpqLobby(int field) { try { - final MapleMap map, mapsaida; + final MapleMap map, mapExit; Channel cs = c.getChannelServer(); + PlayerStorage ps = cs.getPlayerStorage(); + map = cs.getMapFactory().getMap(980000100 + 100 * field); - mapsaida = cs.getMapFactory().getMap(980000000); + mapExit = cs.getMapFactory().getMap(980000000); for (MaplePartyCharacter mpc : c.getPlayer().getParty().getMembers()) { final MapleCharacter mc; - mc = cs.getPlayerStorage().getCharacterByName(mpc.getName()); + mc = ps.getCharacterById(mpc.getId()); if (mc != null) { mc.changeMap(map, map.getPortal(0)); - mc.getClient().getSession().write(MaplePacketCreator.serverNotice(6, LinguaConstants.Linguas(mc).CPQEntradaLobby)); + mc.announce(MaplePacketCreator.serverNotice(6, LanguageConstants.Linguas(mc).CPQEntradaLobby)); TimerManager tMan = TimerManager.getInstance(); tMan.schedule(new Runnable() { @Override @@ -690,13 +692,14 @@ public class NPCConversationManager extends AbstractPlayerInteraction { mapClock(3 * 60); } }, 1500); + + mc.setCpqTimer(TimerManager.getInstance().schedule(new Runnable() { + @Override + public void run() { + mc.changeMap(mapExit, mapExit.getPortal(0)); + } + }, 3 * 60 * 1000)); } - mc.timer = TimerManager.getInstance().schedule(new Runnable() { - @Override - public void run() { - mc.changeMap(mapsaida, mapsaida.getPortal(0)); - } - }, 3 * 60 * 1000); } } catch (Exception ex) { ex.printStackTrace(); @@ -704,17 +707,15 @@ public class NPCConversationManager extends AbstractPlayerInteraction { } public MapleCharacter getChrById(int id) { - Channel cs = c.getChannelServer(); - return cs.getPlayerStorage().getCharacterById(id); + return c.getChannelServer().getPlayerStorage().getCharacterById(id); } public void cancelarSaida() { - Channel cs = c.getChannelServer(); + PlayerStorage ps = c.getChannelServer().getPlayerStorage(); for (MaplePartyCharacter mpc : c.getPlayer().getParty().getMembers()) { - MapleCharacter mc = cs.getPlayerStorage().getCharacterByName(mpc.getName()); - if (mc.timer != null) { - mc.timer.cancel(true); - mc.timer = null; + MapleCharacter mc = ps.getCharacterById(mpc.getId()); + if (mc != null) { + mc.clearCpqTimer(); } } } @@ -726,8 +727,9 @@ public class NPCConversationManager extends AbstractPlayerInteraction { if (challenger.getParty() == null) { throw new RuntimeException("Nao existe oponente!"); } + PlayerStorage ps = c.getChannelServer().getPlayerStorage(); for (MaplePartyCharacter mpc : challenger.getParty().getMembers()) { - MapleCharacter mc = c.getChannelServer().getPlayerStorage().getCharacterByName(mpc.getName()); + MapleCharacter mc = ps.getCharacterById(mpc.getId()); if (mc != null) { mc.changeMap(getPlayer().getMap(), getPlayer().getMap().getPortal(0)); TimerManager tMan = TimerManager.getInstance(); @@ -740,7 +742,7 @@ public class NPCConversationManager extends AbstractPlayerInteraction { } } for (MaplePartyCharacter mpc : getPlayer().getParty().getMembers()) { - MapleCharacter mc = c.getChannelServer().getPlayerStorage().getCharacterByName(mpc.getName()); + MapleCharacter mc = ps.getCharacterById(mpc.getId()); if (mc != null) { TimerManager tMan = TimerManager.getInstance(); tMan.schedule(new Runnable() { @@ -757,17 +759,17 @@ public class NPCConversationManager extends AbstractPlayerInteraction { tMan.schedule(new Runnable() { @Override public void run() { - Channel cs = c.getChannelServer(); + PlayerStorage ps = c.getChannelServer().getPlayerStorage(); for (MaplePartyCharacter mpc : getPlayer().getParty().getMembers()) { - MapleCharacter mc = cs.getPlayerStorage().getCharacterByName(mpc.getName()); + MapleCharacter mc = ps.getCharacterById(mpc.getId()); mc.setMonsterCarnival(null); } for (MaplePartyCharacter mpc : challenger.getParty().getMembers()) { - MapleCharacter mc = cs.getPlayerStorage().getCharacterByName(mpc.getName()); + MapleCharacter mc = ps.getCharacterById(mpc.getId()); mc.setMonsterCarnival(null); } - new MonsterCarnival(getPlayer().getParty(), challenger.getParty(), mapid, true); + new MonsterCarnival(getPlayer().getParty(), challenger.getParty(), mapid, true, (field / 100) % 10); } }, 11000); } catch (Exception e) { @@ -782,8 +784,9 @@ public class NPCConversationManager extends AbstractPlayerInteraction { if (challenger.getParty() == null) { throw new RuntimeException("Não existe oponente!"); } + PlayerStorage ps = c.getChannelServer().getPlayerStorage(); for (MaplePartyCharacter mpc : challenger.getParty().getMembers()) { - MapleCharacter mc = c.getChannelServer().getPlayerStorage().getCharacterByName(mpc.getName()); + MapleCharacter mc = ps.getCharacterById(mpc.getId()); if (mc != null) { mc.changeMap(getPlayer().getMap(), getPlayer().getMap().getPortal(0)); mapClock(10); @@ -795,17 +798,18 @@ public class NPCConversationManager extends AbstractPlayerInteraction { tMan.schedule(new Runnable() { @Override public void run() { - Channel cs = c.getChannelServer(); + PlayerStorage ps = c.getChannelServer().getPlayerStorage(); + for (MaplePartyCharacter mpc : getPlayer().getParty().getMembers()) { - MapleCharacter mc = cs.getPlayerStorage().getCharacterByName(mpc.getName()); + MapleCharacter mc = ps.getCharacterById(mpc.getId()); mc.setMonsterCarnival(null); } for (MaplePartyCharacter mpc : challenger.getParty().getMembers()) { - MapleCharacter mc = cs.getPlayerStorage().getCharacterByName(mpc.getName()); + MapleCharacter mc = ps.getCharacterById(mpc.getId()); mc.setMonsterCarnival(null); } - new MonsterCarnival(getPlayer().getParty(), challenger.getParty(), mapid, false); + new MonsterCarnival(getPlayer().getParty(), challenger.getParty(), mapid, false, (field / 1000) % 10); } }, 10000); } catch (Exception e) { @@ -814,7 +818,7 @@ public class NPCConversationManager extends AbstractPlayerInteraction { } public void sendCPQMapLists2() { - String msg = LinguaConstants.Linguas(getPlayer()).CPQInicioEscolha; + String msg = LanguageConstants.Linguas(getPlayer()).CPQInicioEscolha; for (int i = 0; i < 3; i++) { if (fieldTaken2(i)) { if (fieldLobbied2(i)) { @@ -856,16 +860,18 @@ public class NPCConversationManager extends AbstractPlayerInteraction { public void cpqLobby2(int field) { try { - final MapleMap map, mapsaida; + final MapleMap map, mapExit; Channel cs = c.getChannelServer(); - mapsaida = cs.getMapFactory().getMap(980030000); + PlayerStorage ps = c.getChannelServer().getPlayerStorage(); + + mapExit = cs.getMapFactory().getMap(980030000); map = cs.getMapFactory().getMap(980031000 + 1000 * field); for (MaplePartyCharacter mpc : c.getPlayer().getParty().getMembers()) { final MapleCharacter mc; - mc = cs.getPlayerStorage().getCharacterByName(mpc.getName()); + mc = ps.getCharacterByName(mpc.getName()); if (mc != null) { mc.changeMap(map, map.getPortal(0)); - mc.getClient().getSession().write(MaplePacketCreator.serverNotice(6, LinguaConstants.Linguas(mc).CPQEntradaLobby)); + mc.announce(MaplePacketCreator.serverNotice(6, LanguageConstants.Linguas(mc).CPQEntradaLobby)); TimerManager tMan = TimerManager.getInstance(); tMan.schedule(new Runnable() { @Override @@ -873,13 +879,14 @@ public class NPCConversationManager extends AbstractPlayerInteraction { mapClock(3 * 60); } }, 1500); + + mc.setCpqTimer(TimerManager.getInstance().schedule(new Runnable() { + @Override + public void run() { + mc.changeMap(mapExit, mapExit.getPortal(0)); + } + }, 3 * 60 * 1000)); } - mc.timer = TimerManager.getInstance().schedule(new Runnable() { - @Override - public void run() { - mc.changeMap(mapsaida, mapsaida.getPortal(0)); - } - }, 3 * 60 * 1000); } } catch (Exception ex) { ex.printStackTrace(); @@ -892,7 +899,7 @@ public class NPCConversationManager extends AbstractPlayerInteraction { for (MapleMapObject mmo : map.getAllPlayer()) { MapleCharacter mc = (MapleCharacter) mmo; if (mc.getParty() == null) { - sendOk(LinguaConstants.Linguas(mc).CPQEscolha); + sendOk(LanguageConstants.Linguas(mc).CPQEscolha); return; } if (mc.getParty().getLeader().getId() == mc.getId()) { @@ -908,15 +915,14 @@ public class NPCConversationManager extends AbstractPlayerInteraction { } NPCScriptManager.getInstance().start("cpqchallenge2", leader.getClient(), npc, members); } else { - sendOk(LinguaConstants.Linguas(leader).CPQInicioEscolhaEmEscolha); + sendOk(LanguageConstants.Linguas(leader).CPQInicioEscolhaEmEscolha); } } else { - sendOk(LinguaConstants.Linguas(leader).CPQLiderNaoEncontrado); + sendOk(LanguageConstants.Linguas(leader).CPQLiderNaoEncontrado); } } public void mapClock(int time) { - //getPlayer().getMap().broadcastMessage(MaplePacketCreator.serverNotice(type, message)); getPlayer().getMap().broadcastMessage(MaplePacketCreator.getClock(time)); } @@ -930,7 +936,7 @@ public class NPCConversationManager extends AbstractPlayerInteraction { for (MapleMapObject mmo : map.getAllPlayer()) { MapleCharacter mc = (MapleCharacter) mmo; if (mc.getParty() == null) { - sendOk(LinguaConstants.Linguas(mc).CPQEscolha); + sendOk(LanguageConstants.Linguas(mc).CPQEscolha); return; } if (mc.getParty().getLeader().getId() == mc.getId()) { @@ -941,15 +947,17 @@ public class NPCConversationManager extends AbstractPlayerInteraction { if (leader != null) { if (!leader.isChallenged()) { List members = new LinkedList<>(); - for (MaplePartyCharacter fucker : c.getPlayer().getParty().getMembers()) { - members.add(fucker); + for (MaplePartyCharacter mpc : c.getPlayer().getParty().getMembers()) { + members.add(mpc); } + NPCScriptManager.getInstance().start("cpqchallenge", leader.getClient(), npc, members); + sendOk(LanguageConstants.Linguas(leader).CPQInicioEscolhaEnviada); } else { - sendOk(LinguaConstants.Linguas(leader).CPQInicioEscolhaEmEscolha); + sendOk(LanguageConstants.Linguas(leader).CPQInicioEscolhaEmEscolha); } } else { - sendOk(LinguaConstants.Linguas(leader).CPQLiderNaoEncontrado); + sendOk(LanguageConstants.Linguas(leader).CPQLiderNaoEncontrado); } } @@ -961,24 +969,46 @@ public class NPCConversationManager extends AbstractPlayerInteraction { } } - public void enviarLista() { - EventInstanceManager eim = getEventInstance(); - if(eim != null) { - String name = eim.getProperty("brideId"); - MapleCharacter chr = getChrById(Integer.parseInt(name)); - //MapleCharacter chr = getChrById(3); + public void sendMarriageWishlist(boolean groom) { + MapleCharacter player = this.getPlayer(); + MapleMarriage marriage = player.getMarriageInstance(); + if(marriage != null) { + int cid = marriage.getIntProperty(groom ? "groomId" : "brideId"); + MapleCharacter chr = marriage.getPlayerById(cid); if (chr != null) { - if (chr.getId() == getPlayer().getId()) { - getPlayer().announce(Wedding.OnWeddingGiftResult((byte) 0xA, chr.getItens(), chr.getItem())); + if (chr.getId() == player.getId()) { + player.announce(Wedding.OnWeddingGiftResult((byte) 0xA, marriage.getWishlistItems(groom), marriage.getGiftItems(player.getClient(), groom))); } else { - getPlayer().announce(Wedding.OnWeddingGiftResult((byte) 0x09, chr.getItens(), chr.getItem())); + marriage.setIntProperty("wishlistSelection", groom ? 0 : 1); + player.announce(Wedding.OnWeddingGiftResult((byte) 0x09, marriage.getWishlistItems(groom), marriage.getGiftItems(player.getClient(), groom))); } } } } - - public void criarLista() { - getClient().getSession().write(Wedding.sendWishList()); - } + public void sendMarriageGifts(List gifts) { + this.getPlayer().announce(Wedding.OnWeddingGiftResult((byte) 0xA, Collections.singletonList(""), gifts)); + } + + public boolean createMarriageWishlist() { + MapleMarriage marriage = this.getPlayer().getMarriageInstance(); + if (marriage != null) { + Boolean groom = marriage.isMarriageGroom(this.getPlayer()); + if (groom != null) { + String wlKey; + if (groom) { + wlKey = "groomWishlist"; + } else { + wlKey = "brideWishlist"; + } + + if (marriage.getProperty(wlKey).contentEquals("")) { + getClient().announce(Wedding.sendWishList()); + return true; + } + } + } + + return false; + } } \ No newline at end of file diff --git a/src/server/MapleMarriage.java b/src/server/MapleMarriage.java new file mode 100644 index 0000000000..69c7853091 --- /dev/null +++ b/src/server/MapleMarriage.java @@ -0,0 +1,183 @@ +/* + This file is part of the HeavenMS MapleStory Server + Copyleft (L) 2016 - 2018 RonanLana + + 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 server; + +import client.MapleClient; +import client.MapleCharacter; +import client.inventory.Item; +import client.inventory.ItemFactory; +import client.inventory.MapleInventory; +import client.inventory.MapleInventoryType; +import client.inventory.manipulator.MapleInventoryManipulator; +import scripting.event.EventInstanceManager; +import java.sql.Connection; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.LinkedList; +import java.util.List; +import scripting.event.EventManager; +import tools.DatabaseConnection; +import tools.Pair; + +/** + * + * @author Ronan + */ +public class MapleMarriage extends EventInstanceManager { + + public MapleMarriage(EventManager em, String name) { + super(em, name); + } + + public boolean giftItemToSpouse(int cid) { + return this.getIntProperty("wishlistSelection") == 0; + } + + public List getWishlistItems(boolean groom) { + String strItems = this.getProperty(groom ? "groomWishlist" : "brideWishlist"); + if (strItems != null) { + return Arrays.asList(strItems.split("\r\n")); + } + + return new LinkedList<>(); + } + + public void initializeGiftItems() { + List groomGifts = new ArrayList<>(); + this.setObjectProperty("groomGiftlist", groomGifts); + + List brideGifts = new ArrayList<>(); + this.setObjectProperty("brideGiftlist", brideGifts); + } + + public List getGiftItems(MapleClient c, boolean groom) { + c.tryacquireClient(); + try { + List gifts = getGiftItemsList(groom); + synchronized (gifts) { + return new LinkedList<>(gifts); + } + } finally { + c.releaseClient(); + } + } + + private List getGiftItemsList(boolean groom) { + return (List) this.getObjectProperty(groom ? "groomGiftlist" : "brideGiftlist"); + } + + public Item getGiftItem(MapleClient c, boolean groom, int idx) { + try { + return getGiftItems(c, groom).get(idx); + } catch (IndexOutOfBoundsException e) { + return null; + } + } + + public void addGiftItem(boolean groom, Item item) { + List gifts = getGiftItemsList(groom); + synchronized (gifts) { + gifts.add(item); + } + } + + public void removeGiftItem(boolean groom, Item item) { + List gifts = getGiftItemsList(groom); + synchronized (gifts) { + gifts.remove(item); + } + } + + public Boolean isMarriageGroom(MapleCharacter chr) { + Boolean groom = null; + try { + int groomid = this.getIntProperty("groomId"), brideid = this.getIntProperty("brideId"); + if (chr.getId() == groomid) { + groom = true; + } else if (chr.getId() == brideid) { + groom = false; + } + } catch (NumberFormatException nfe) {} + + return groom; + } + + public static boolean claimGiftItems(MapleClient c, MapleCharacter chr) { + List gifts = loadGiftItemsFromDb(c, chr.getId()); + if (MapleInventory.checkSpot(chr, gifts)) { + try { + Connection con = DatabaseConnection.getConnection(); + ItemFactory.MARRIAGE_GIFTS.saveItems(new LinkedList>(), chr.getId(), con); + con.close(); + } catch (SQLException sqle) {} + + for (Item item : gifts) { + MapleInventoryManipulator.addFromDrop(chr.getClient(), item, false); + } + + return true; + } + + return false; + } + + public static List loadGiftItemsFromDb(MapleClient c, int cid) { + c.tryacquireClient(); + try { + List items = new LinkedList<>(); + try { + for (Pair it : ItemFactory.MARRIAGE_GIFTS.loadItems(cid, false)) { + items.add(it.getLeft()); + } + } catch (SQLException sqle) { + sqle.printStackTrace(); + } + + return items; + } finally { + c.releaseClient(); + } + } + + public void saveGiftItemsToDb(MapleClient c, boolean groom, int cid) { + MapleMarriage.saveGiftItemsToDb(c, getGiftItems(c, groom), cid); + } + + public static void saveGiftItemsToDb(MapleClient c, List giftItems, int cid) { + List> items = new LinkedList<>(); + for (Item it : giftItems) { + items.add(new Pair<>(it, it.getInventoryType())); + } + + c.tryacquireClient(); + try { + try { + Connection con = DatabaseConnection.getConnection(); + ItemFactory.MARRIAGE_GIFTS.saveItems(items, cid, con); + con.close(); + } catch (SQLException sqle) { + sqle.printStackTrace(); + } + } finally { + c.releaseClient(); + } + } +} diff --git a/src/server/MapleStatEffect.java b/src/server/MapleStatEffect.java index 5c83c32285..3acf762f62 100644 --- a/src/server/MapleStatEffect.java +++ b/src/server/MapleStatEffect.java @@ -940,26 +940,17 @@ public class MapleStatEffect { } else if (cp != 0 && applyto.getMonsterCarnival() != null) { applyto.gainCP(cp); } else if (nuffSkill != 0 && applyto.getParty() != null && applyto.getMap().isCPQMap()) { // by Drago-Dragohe4rt - final MCSkill skil = MapleCarnivalFactory.getInstance().getSkill(nuffSkill); - if (skil != null) { - final MapleDisease dis = skil.getDisease(); - MapleParty inimigos = applyfrom.getParty().getEnemy(); - if (nuffSkill == 8) { - int amount = inimigos.getMembers().size() - 1; - int randd = (int) Math.floor(Math.random() * amount); - MapleCharacter chrApp = applyfrom.getClient().getChannelServer().getPlayerStorage().getCharacterById(inimigos.getMemberByPos(randd).getId()); + final MCSkill skill = MapleCarnivalFactory.getInstance().getSkill(nuffSkill); + if (skill != null) { + final MapleDisease dis = skill.getDisease(); + MapleParty opposition = applyfrom.getParty().getEnemy(); + for (MaplePartyCharacter enemyChrs : opposition.getPartyMembers()) { + MapleCharacter chrApp = enemyChrs.getPlayer(); if (chrApp != null && chrApp.getMap().isCPQMap()) { - chrApp.dispel(); - } - } else { - for (MaplePartyCharacter chrsInimigos : inimigos.getPartyMembers()) { - MapleCharacter chrApp = chrsInimigos.getPlayer(); - if (chrApp != null && chrApp.getMap().isCPQMap()) { - if (dis == null) { - chrApp.dispel(); - } else if (skil.getSkill() != null) { - chrApp.giveDebuff(dis, skil.getSkill()); - } + if (dis == null) { + chrApp.dispel(); + } else { + chrApp.giveDebuff(dis, MCSkill.getMobSkill(dis.getDisease())); } } } diff --git a/src/server/life/MapleMonsterInformationProvider.java b/src/server/life/MapleMonsterInformationProvider.java index 4854d125be..f4d44ea319 100644 --- a/src/server/life/MapleMonsterInformationProvider.java +++ b/src/server/life/MapleMonsterInformationProvider.java @@ -182,45 +182,38 @@ public class MapleMonsterInformationProvider { return drops.get(monsterId); } final List ret = new LinkedList<>(); + + PreparedStatement ps = null; + ResultSet rs = null; + Connection con = null; + try { + con = DatabaseConnection.getConnection(); + ps = con.prepareStatement("SELECT itemid, chance, minimum_quantity, maximum_quantity, questid FROM drop_data WHERE dropperid = ?"); + ps.setInt(1, monsterId); + rs = ps.executeQuery(); - if (monsterId >= 9300127 && monsterId <= 9300136 || monsterId >= 9300315 && monsterId <= 9300324) { - int dropArray[] = {2022157, 2022158, 2022159, 2022160, 2022161, 2022162, 2022163, 2022164, 2022165, 2022166, 2022167, 2022168, 2022169, 2022170, 2022171, 2022172, 2022173, 2022174, 2022175, 2022176, 2022177, 2022178, 4001129}; //These are the drops, -1 means meso :D - for (int id : dropArray) { - ret.add(new MonsterDropEntry(id, 2000, 1, 1, (short) 0)); + while (rs.next()) { + ret.add(new MonsterDropEntry(rs.getInt("itemid"), rs.getInt("chance"), rs.getInt("minimum_quantity"), rs.getInt("maximum_quantity"), rs.getShort("questid"))); } - } else { - PreparedStatement ps = null; - ResultSet rs = null; - Connection con = null; + + con.close(); + } catch (SQLException e) { + e.printStackTrace(); + return ret; + } finally { try { - con = DatabaseConnection.getConnection(); - ps = con.prepareStatement("SELECT itemid, chance, minimum_quantity, maximum_quantity, questid FROM drop_data WHERE dropperid = ?"); - ps.setInt(1, monsterId); - rs = ps.executeQuery(); - - while (rs.next()) { - ret.add(new MonsterDropEntry(rs.getInt("itemid"), rs.getInt("chance"), rs.getInt("minimum_quantity"), rs.getInt("maximum_quantity"), rs.getShort("questid"))); + if (ps != null && !ps.isClosed()) { + ps.close(); } - - con.close(); - } catch (SQLException e) { - e.printStackTrace(); + if (rs != null && !rs.isClosed()) { + rs.close(); + } + if (con != null && !con.isClosed()) { + con.close(); + } + } catch (SQLException ignore) { + ignore.printStackTrace(); return ret; - } finally { - try { - if (ps != null && !ps.isClosed()) { - ps.close(); - } - if (rs != null && !rs.isClosed()) { - rs.close(); - } - if (con != null && !con.isClosed()) { - con.close(); - } - } catch (SQLException ignore) { - ignore.printStackTrace(); - return ret; - } } } drops.put(monsterId, ret); diff --git a/src/server/maps/MapleMapFactory.java b/src/server/maps/MapleMapFactory.java index 05a41ef13c..c1955e030f 100644 --- a/src/server/maps/MapleMapFactory.java +++ b/src/server/maps/MapleMapFactory.java @@ -166,18 +166,20 @@ public class MapleMapFactory { } } - private synchronized MapleMap loadMapFromWz(int mapid, Integer omapid) { + private synchronized MapleMap loadMapFromWz(int mapid, Integer omapid, boolean cache) { MapleMap map; - mapsRLock.lock(); - try { - map = maps.get(omapid); - } finally { - mapsRLock.unlock(); - } + if (cache) { + mapsRLock.lock(); + try { + map = maps.get(omapid); + } finally { + mapsRLock.unlock(); + } - if (map != null) { - return map; + if (map != null) { + return map; + } } String mapName = getMapName(mapid); @@ -389,11 +391,13 @@ public class MapleMapFactory { map.setBackgroundTypes(backTypes); map.generateMapDropRangeCache(); - mapsWLock.lock(); - try { - maps.put(omapid, map); - } finally { - mapsWLock.unlock(); + if (cache) { + mapsWLock.lock(); + try { + maps.put(omapid, map); + } finally { + mapsWLock.unlock(); + } } return map; @@ -410,7 +414,11 @@ public class MapleMapFactory { mapsRLock.unlock(); } - return (map != null) ? map : loadMapFromWz(mapid, omapid); + return (map != null) ? map : loadMapFromWz(mapid, omapid, true); + } + + public MapleMap getDisposableMap(int mapid) { + return loadMapFromWz(mapid, mapid, false); } public boolean isMapLoaded(int mapId) { diff --git a/src/server/partyquest/MapleCarnivalFactory.java b/src/server/partyquest/MapleCarnivalFactory.java index a38d2e6680..81483bcd81 100644 --- a/src/server/partyquest/MapleCarnivalFactory.java +++ b/src/server/partyquest/MapleCarnivalFactory.java @@ -63,6 +63,10 @@ public class MapleCarnivalFactory { } public MobSkill getSkill() { + return getMobSkill(skillid); + } + + public static MobSkill getMobSkill(int skillid) { return MobSkillFactory.getMobSkill(skillid, 1); //level? } diff --git a/src/server/partyquest/MonsterCarnival.java b/src/server/partyquest/MonsterCarnival.java index 490322a237..e310a0aeb5 100644 --- a/src/server/partyquest/MonsterCarnival.java +++ b/src/server/partyquest/MonsterCarnival.java @@ -2,7 +2,8 @@ package server.partyquest; import java.util.concurrent.ScheduledFuture; import client.MapleCharacter; -import constants.LinguaConstants; +import constants.LanguageConstants; +import constants.ServerConstants; import net.server.Server; import net.server.channel.Channel; import net.server.world.MapleParty; @@ -24,22 +25,23 @@ public class MonsterCarnival { private MapleParty p1, p2; private MapleMap map; - private ScheduledFuture timer, effectTimer; + private ScheduledFuture timer, effectTimer, respawnTask; private long startTime = 0; - private int summons = 8, summonss = 8; + private int summonsR = 8, summonsB = 8, room = 0; private MapleCharacter leader1, leader2, Grupo1, Grupo2; private int redCP, blueCP, redTotalCP, blueTotalCP; private boolean cpq1; - public MonsterCarnival(MapleParty p1, MapleParty p2, int mapid, boolean cpq1) { + public MonsterCarnival(MapleParty p1, MapleParty p2, int mapid, boolean cpq1, int room) { try { this.cpq1 = cpq1; + this.room = room; this.p1 = p1; this.p2 = p2; Channel cs = Server.getInstance().getWorld(p2.getLeader().getWorld()).getChannel(p2.getLeader().getChannel()); p1.setEnemy(p2); p2.setEnemy(p1); - map = cs.getMapFactory().resetMap(mapid); + map = cs.getMapFactory().getDisposableMap(mapid); int redPortal = 0; int bluePortal = 0; if (map.isPurpleCPQMap()) { @@ -47,13 +49,13 @@ public class MonsterCarnival { bluePortal = 1; } for (MaplePartyCharacter mpc : p1.getMembers()) { - MapleCharacter mc = cs.getPlayerStorage().getCharacterByName(mpc.getName()); + MapleCharacter mc = cs.getPlayerStorage().getCharacterById(mpc.getId()); if (mc != null) { mc.setMonsterCarnival(this); mc.setTeam(0); mc.setFestivalPoints(0); - mc.changeMap(map, map.getPortal(redPortal)); - mc.dropMessage(6, LinguaConstants.Linguas(mc).CPQEntrada); + mc.forceChangeMap(map, map.getPortal(redPortal)); + mc.dropMessage(6, LanguageConstants.Linguas(mc).CPQEntrada); if (p1.getLeader().getId() == mc.getId()) { leader1 = mc; } @@ -61,13 +63,13 @@ public class MonsterCarnival { } } for (MaplePartyCharacter mpc : p2.getMembers()) { - MapleCharacter mc = cs.getPlayerStorage().getCharacterByName(mpc.getName()); + MapleCharacter mc = cs.getPlayerStorage().getCharacterById(mpc.getId()); if (mc != null) { mc.setMonsterCarnival(this); mc.setTeam(1); mc.setFestivalPoints(0); - mc.changeMap(map, map.getPortal(bluePortal)); - mc.dropMessage(6, LinguaConstants.Linguas(mc).CPQEntrada); + mc.forceChangeMap(map, map.getPortal(bluePortal)); + mc.dropMessage(6, LanguageConstants.Linguas(mc).CPQEntrada); if (p2.getLeader().getId() == mc.getId()) { leader2 = mc; } @@ -76,10 +78,10 @@ public class MonsterCarnival { } if (Grupo1 == null || Grupo2 == null) { for (MaplePartyCharacter mpc : p2.getMembers()) { - mpc.getPlayer().dropMessage(5, LinguaConstants.Linguas(mpc.getPlayer()).CPQErro); + mpc.getPlayer().dropMessage(5, LanguageConstants.Linguas(mpc.getPlayer()).CPQErro); } for (MaplePartyCharacter mpc : p2.getMembers()) { - mpc.getPlayer().dropMessage(5, LinguaConstants.Linguas(mpc.getPlayer()).CPQErro); + mpc.getPlayer().dropMessage(5, LanguageConstants.Linguas(mpc.getPlayer()).CPQErro); } return; } @@ -98,6 +100,12 @@ public class MonsterCarnival { complete(); } }, 10 * 60 * 1000 - 10 * 1000); + respawnTask = TimerManager.getInstance().register(new Runnable() { + @Override + public void run() { + respawn(); + } + }, ServerConstants.RESPAWN_INTERVAL); TimerManager.getInstance().schedule(new Runnable() { @Override public void run() { @@ -109,6 +117,10 @@ public class MonsterCarnival { } } + private void respawn() { + map.respawn(); + } + public void playerDisconnected(int charid) { int team = -1; for (MaplePartyCharacter mpc : leader1.getParty().getMembers()) { @@ -128,13 +140,13 @@ public class MonsterCarnival { String teamS = ""; switch (team) { case 0: - teamS = LinguaConstants.Linguas(chrMap).CPQVermelho; + teamS = LanguageConstants.Linguas(chrMap).CPQVermelho; break; case 1: - teamS = LinguaConstants.Linguas(chrMap).CPQAzul; + teamS = LanguageConstants.Linguas(chrMap).CPQAzul; break; } - chrMap.dropMessage(5, teamS + LinguaConstants.Linguas(chrMap).CPQPlayerExit); + chrMap.dropMessage(5, teamS + LanguageConstants.Linguas(chrMap).CPQPlayerExit); } earlyFinish(); } @@ -151,20 +163,20 @@ public class MonsterCarnival { dispose(false); } - public void summon() { - this.summons--; + public void summonR() { + this.summonsR--; } - public boolean canSummon() { - return this.summons > 0; + public boolean canSummonR() { + return this.summonsR > 0; } - public void summons() { - this.summonss--; + public void summonB() { + this.summonsB--; } - public boolean canSummons() { - return this.summonss > 0; + public boolean canSummonB() { + return this.summonsB > 0; } protected void dispose(boolean warpout) { @@ -176,7 +188,7 @@ public class MonsterCarnival { out = cs.getMapFactory().getMap(980000000); } for (MaplePartyCharacter mpc : leader1.getParty().getMembers()) { - MapleCharacter mc = cs.getPlayerStorage().getCharacterByName(mpc.getName()); + MapleCharacter mc = cs.getPlayerStorage().getCharacterById(mpc.getId()); if (mc != null) { mc.resetCP(); mc.setTeam(-1); @@ -187,7 +199,7 @@ public class MonsterCarnival { } } for (MaplePartyCharacter mpc : leader2.getParty().getMembers()) { - MapleCharacter mc = cs.getPlayerStorage().getCharacterByName(mpc.getName()); + MapleCharacter mc = cs.getPlayerStorage().getCharacterById(mpc.getId()); if (mc != null) { mc.resetCP(); mc.setTeam(-1); @@ -205,10 +217,16 @@ public class MonsterCarnival { this.effectTimer.cancel(true); this.effectTimer = null; } + if (this.respawnTask != null) { + this.respawnTask.cancel(true); + this.respawnTask = null; + } redTotalCP = 0; blueTotalCP = 0; leader1.getParty().setEnemy(null); leader2.getParty().setEnemy(null); + map.dispose(); + map = null; } @@ -225,7 +243,7 @@ public class MonsterCarnival { Channel cs = Server.getInstance().getWorld(p1.getLeader().getWorld()).getChannel(p1.getLeader().getChannel()); if (winningTeam == 0) { for (MaplePartyCharacter mpc : leader1.getParty().getMembers()) { - MapleCharacter mc = cs.getPlayerStorage().getCharacterByName(mpc.getName()); + MapleCharacter mc = cs.getPlayerStorage().getCharacterById(mpc.getId()); if (mc != null) { mc.gainFestivalPoints(this.redTotalCP); mc.setMonsterCarnival(null); @@ -239,7 +257,7 @@ public class MonsterCarnival { } } for (MaplePartyCharacter mpc : leader2.getParty().getMembers()) { - MapleCharacter mc = cs.getPlayerStorage().getCharacterByName(mpc.getName()); + MapleCharacter mc = cs.getPlayerStorage().getCharacterById(mpc.getId()); if (mc != null) { mc.gainFestivalPoints(this.blueTotalCP); mc.setMonsterCarnival(null); @@ -254,7 +272,7 @@ public class MonsterCarnival { } } else if (winningTeam == 1) { for (MaplePartyCharacter mpc : leader2.getParty().getMembers()) { - MapleCharacter mc = cs.getPlayerStorage().getCharacterByName(mpc.getName()); + MapleCharacter mc = cs.getPlayerStorage().getCharacterById(mpc.getId()); if (mc != null) { mc.gainFestivalPoints(this.blueTotalCP); mc.setMonsterCarnival(null); @@ -268,7 +286,7 @@ public class MonsterCarnival { } } for (MaplePartyCharacter mpc : leader1.getParty().getMembers()) { - MapleCharacter mc = cs.getPlayerStorage().getCharacterByName(mpc.getName()); + MapleCharacter mc = cs.getPlayerStorage().getCharacterById(mpc.getId()); if (mc != null) { mc.gainFestivalPoints(this.redTotalCP); mc.setMonsterCarnival(null); @@ -312,7 +330,7 @@ public class MonsterCarnival { public void extendTime() { for (MapleCharacter chrMap : map.getAllPlayers()) { - chrMap.dropMessage(5, LinguaConstants.Linguas(chrMap).CPQTempoExtendido); + chrMap.dropMessage(5, LanguageConstants.Linguas(chrMap).CPQTempoExtendido); } startTime = System.currentTimeMillis() + 3 * 1000; map.addClock(3 * 60); @@ -340,14 +358,14 @@ public class MonsterCarnival { int chnl = leader1.getClient().getChannel(); int chnl1 = leader2.getClient().getChannel(); if (chnl != chnl1) { - throw new RuntimeException("Os líderes estão em canais diferentes."); + throw new RuntimeException("Os lideres estao em canais diferentes."); } Channel cs = Server.getInstance().getWorld(p1.getLeader().getWorld()).getChannel(p1.getLeader().getChannel()); map.killAllMonsters(); for (MaplePartyCharacter mpc : leader1.getParty().getMembers()) { MapleCharacter mc; - mc = cs.getPlayerStorage().getCharacterByName(mpc.getName()); + mc = cs.getPlayerStorage().getCharacterById(mpc.getId()); if (mc != null) { if (redWin) { mc.getClient().announce(MaplePacketCreator.showEffect("quest/carnival/win")); @@ -362,7 +380,7 @@ public class MonsterCarnival { } for (MaplePartyCharacter mpc : leader2.getParty().getMembers()) { MapleCharacter mc; - mc = cs.getPlayerStorage().getCharacterByName(mpc.getName()); + mc = cs.getPlayerStorage().getCharacterById(mpc.getId()); if (mc != null) { if (!redWin) { mc.getClient().announce(MaplePacketCreator.showEffect("quest/carnival/win")); @@ -486,4 +504,8 @@ public class MonsterCarnival { this.blueCP = CP; } } + + public int getRoom() { + return this.room; + } } diff --git a/src/server/partyquest/MonsterCarnivalParty.java b/src/server/partyquest/MonsterCarnivalParty.java index f066d74740..ab57498e25 100644 --- a/src/server/partyquest/MonsterCarnivalParty.java +++ b/src/server/partyquest/MonsterCarnivalParty.java @@ -15,7 +15,7 @@ public class MonsterCarnivalParty { private MapleCharacter leader; private byte team; private short availableCP = 0, totalCP = 0; - private int summons = 7; + private int summons = 8; private boolean winner = false; public MonsterCarnivalParty(final MapleCharacter owner, final List members1, final byte team1) { @@ -24,7 +24,7 @@ public class MonsterCarnivalParty { team = team1; for (final MapleCharacter chr : members) { - chr.setCarnivalParty(this); + chr.setMonsterCarnivalParty(this); chr.setTeam(team); } } @@ -63,8 +63,8 @@ public class MonsterCarnivalParty { public void warpOut(final int map) { for (MapleCharacter chr : members) { chr.changeMap(map, 0); - chr.setCarnivalParty(null); - chr.setCarnival(null); + chr.setMonsterCarnivalParty(null); + chr.setMonsterCarnival(null); } members.clear(); } @@ -77,9 +77,9 @@ public class MonsterCarnivalParty { public void warpOut() { if (winner == true) - warpOut(980000003 + (leader.getCarnival().getRoom() * 100)); + warpOut(980000003 + (leader.getMonsterCarnival().getRoom() * 100)); else - warpOut(980000004 + (leader.getCarnival().getRoom() * 100)); + warpOut(980000004 + (leader.getMonsterCarnival().getRoom() * 100)); } public boolean allInMap(MapleMap map) { @@ -95,8 +95,8 @@ public class MonsterCarnivalParty { public void removeMember(MapleCharacter chr) { members.remove(chr); chr.changeMap(980000010); - chr.setCarnivalParty(null); - chr.setCarnival(null); + chr.setMonsterCarnivalParty(null); + chr.setMonsterCarnival(null); } public boolean isWinner() { diff --git a/src/tools/MaplePacketCreator.java b/src/tools/MaplePacketCreator.java index bd50472cef..6be1f9ca81 100644 --- a/src/tools/MaplePacketCreator.java +++ b/src/tools/MaplePacketCreator.java @@ -4213,7 +4213,7 @@ public class MaplePacketCreator { mplew.write(reactor.getState()); mplew.writePos(pos); mplew.writeShort(0); - mplew.write(reactor.getFacingDirection()); // stance, thanks to Drago/Dragohe4rt + mplew.write(0); return mplew.getPacket(); } diff --git a/src/tools/data/output/GenericLittleEndianWriter.java b/src/tools/data/output/GenericLittleEndianWriter.java index bc8351be8a..91779e4d57 100644 --- a/src/tools/data/output/GenericLittleEndianWriter.java +++ b/src/tools/data/output/GenericLittleEndianWriter.java @@ -33,7 +33,7 @@ import constants.CharsetConstants.MapleLanguageType; * @since Revision 323 */ public class GenericLittleEndianWriter implements LittleEndianWriter { - private static Charset ASCII = Charset.forName(MapleLanguageType.LANGUAGE_PT_BR.getAscii()); + private static Charset ASCII = Charset.forName(MapleLanguageType.LANGUAGE_US.getAscii()); private ByteOutputStream bos; /** diff --git a/src/tools/packets/Wedding.java b/src/tools/packets/Wedding.java index 95946051de..437892b2d1 100644 --- a/src/tools/packets/Wedding.java +++ b/src/tools/packets/Wedding.java @@ -7,7 +7,6 @@ package tools.packets; import client.inventory.Item; -import client.inventory.MapleInventoryType; import client.MapleCharacter; import java.util.ArrayList; import java.util.List; @@ -383,59 +382,32 @@ public class Wedding extends MaplePacketCreator { * @return mplew */ public static byte[] OnWeddingGiftResult(byte mode, List itemnames, List items) { - // if (itemnames == null || itemnames.size() < 1) { // for now lol - // itemnames = new ArrayList<>(); - // itemnames.add("mesos"); - // itemnames.add("rare items"); - // itemnames.add("more mesos"); - // } MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter(); mplew.writeShort(WEDDING_GIFT_RESULT); mplew.write(mode); switch (mode) { + case 0xC: // 12 : You cannot give more than one present for each wishlist + case 0xE: // 14 : Failed to send the gift. + break; + case 0x09: { // Load Wedding Registry mplew.write(itemnames.size()); for (String names : itemnames) { mplew.writeMapleAsciiString(names); } - mplew.write(items.size()); - for (Item item : items) { - addItemInfo(mplew, item, true); - } break; } case 0xA: // Load Bride's Wishlist case 0xF: // 10, 15, 16 = CWishListRecvDlg::OnPacket case 0xB: { // Add Item to Wedding Registry - // 11 : You have sent a gift | 12 : You cannot give more than one present for each wishlist | 13 : Failed to send the gift. | 14 : Failed to send the gift. + // 11 : You have sent a gift | | 13 : Failed to send the gift. | if (mode == 0xB) { mplew.write(itemnames.size()); for (String names : itemnames) { mplew.writeMapleAsciiString(names); } } - if (items.size() >= 1) { - switch (items.get((items.size() - 1)).getInventoryType()) { - case EQUIP: - mplew.writeLong(4); - break; - case USE: - mplew.writeLong(8); - break; - case SETUP: - mplew.writeLong(16); - break; - case ETC: - mplew.writeLong(32); - break; - default: // impossible flag, cash item can't be sent - if (items.get((items.size() - 1)).getInventoryType() != MapleInventoryType.CASH) { - mplew.writeLong(0); - } - } - } else { - mplew.writeLong(0); - } + mplew.writeLong(32); mplew.write(items.size()); for (Item item : items) { addItemInfo(mplew, item, true); diff --git a/wz/Mob.wz/9300134.img.xml b/wz/Mob.wz/9300134.img.xml index a5edb6310b..18f2ec8976 100644 --- a/wz/Mob.wz/9300134.img.xml +++ b/wz/Mob.wz/9300134.img.xml @@ -18,7 +18,7 @@ - +