CPQ 1 CPQ 2 CASAMENTO
This commit is contained in:
1 parent
799870df63
commit
90ad58f17f
60 files changed
+4390
-2090
No files matched your search
+12
-12
@@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
You should have received a copy of the GNU Affero General Public License
|
You should have received a copy of the GNU Affero General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
* @author BubblesDev
|
* @author BubblesDev
|
||||||
* @author Ronan
|
* @author Ronan
|
||||||
@@ -46,14 +46,14 @@ function action(mode, type, selection) {
|
|||||||
else
|
else
|
||||||
status--;
|
status--;
|
||||||
|
|
||||||
if(cm.getMapId() == 100000200) {
|
if (cm.getMapId() == 100000200) {
|
||||||
if (status == 0) {
|
if (status == 0) {
|
||||||
em = cm.getEventManager("HenesysPQ");
|
em = cm.getEventManager("HenesysPQ");
|
||||||
if(em == null) {
|
if (em == null) {
|
||||||
cm.sendOk("The Henesys PQ has encountered an error.");
|
cm.sendOk("The Henesys PQ has encountered an error.");
|
||||||
cm.dispose();
|
cm.dispose();
|
||||||
return;
|
return;
|
||||||
} else if(cm.isUsingOldPqNpcStyle()) {
|
} else if (cm.isUsingOldPqNpcStyle()) {
|
||||||
action(1, 0, 0);
|
action(1, 0, 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -64,13 +64,13 @@ function action(mode, type, selection) {
|
|||||||
if (cm.getParty() == null) {
|
if (cm.getParty() == null) {
|
||||||
cm.sendOk("Hi there! I'm Tory. This place is covered with mysterious aura of the full moon, and no one person can enter here by him/herself.");
|
cm.sendOk("Hi there! I'm Tory. This place is covered with mysterious aura of the full moon, and no one person can enter here by him/herself.");
|
||||||
cm.dispose();
|
cm.dispose();
|
||||||
} else if(!cm.isLeader()) {
|
} else if (!cm.isLeader()) {
|
||||||
cm.sendOk("If you'd like to enter here, the leader of your party will have to talk to me. Talk to your party leader about this.");
|
cm.sendOk("If you'd like to enter here, the leader of your party will have to talk to me. Talk to your party leader about this.");
|
||||||
cm.dispose();
|
cm.dispose();
|
||||||
} else {
|
} else {
|
||||||
var eli = em.getEligibleParty(cm.getParty());
|
var eli = em.getEligibleParty(cm.getParty());
|
||||||
if(eli.size() > 0) {
|
if (eli.size() > 0) {
|
||||||
if(!em.startInstance(cm.getParty(), cm.getPlayer().getMap(), 1)) {
|
if (!em.startInstance(cm.getParty(), cm.getPlayer().getMap(), 1)) {
|
||||||
cm.sendOk("Someone is already attempting the PQ. Please wait for them to finish, or find another channel.");
|
cm.sendOk("Someone is already attempting the PQ. Please wait for them to finish, or find another channel.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -90,8 +90,8 @@ function action(mode, type, selection) {
|
|||||||
cm.sendYesNo("So you want to exchange #b20 #b#t4001158##k for the instance-designed hat?");
|
cm.sendYesNo("So you want to exchange #b20 #b#t4001158##k for the instance-designed hat?");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(cm.hasItem(4001158, 20)) {
|
if (cm.hasItem(4001158, 20)) {
|
||||||
if(cm.canHold(1002798)) {
|
if (cm.canHold(1002798)) {
|
||||||
cm.gainItem(4001158, -20);
|
cm.gainItem(4001158, -20);
|
||||||
cm.gainItem(1002798, 20);
|
cm.gainItem(1002798, 20);
|
||||||
cm.sendNext("Here it is. Enjoy!");
|
cm.sendNext("Here it is. Enjoy!");
|
||||||
@@ -106,7 +106,7 @@ function action(mode, type, selection) {
|
|||||||
if (status == 0) {
|
if (status == 0) {
|
||||||
cm.sendYesNo("Thank you for aiding in the effort of feeding the Growlie. As a matter of fact, your team has already been rewarded for reaching this far. With this problem now solved, there is another issue happening right now, if you are interessed check #bTommy#k there for the info. So, are you returning straight to Henesys now?");
|
cm.sendYesNo("Thank you for aiding in the effort of feeding the Growlie. As a matter of fact, your team has already been rewarded for reaching this far. With this problem now solved, there is another issue happening right now, if you are interessed check #bTommy#k there for the info. So, are you returning straight to Henesys now?");
|
||||||
} else if (status == 1) {
|
} else if (status == 1) {
|
||||||
if(cm.getEventInstance().giveEventReward(cm.getPlayer())) {
|
if (cm.getEventInstance().giveEventReward(cm.getPlayer())) {
|
||||||
cm.warp(100000200);
|
cm.warp(100000200);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -118,9 +118,9 @@ function action(mode, type, selection) {
|
|||||||
if (status == 0) {
|
if (status == 0) {
|
||||||
cm.sendYesNo("So, are you returning to Henesys now?");
|
cm.sendYesNo("So, are you returning to Henesys now?");
|
||||||
} else if (status == 1) {
|
} else if (status == 1) {
|
||||||
if(cm.getEventInstance() == null) {
|
if (cm.getEventInstance() == null) {
|
||||||
cm.warp(100000200);
|
cm.warp(100000200);
|
||||||
} else if(cm.getEventInstance().giveEventReward(cm.getPlayer())) {
|
} else if (cm.getEventInstance().giveEventReward(cm.getPlayer())) {
|
||||||
cm.warp(100000200);
|
cm.warp(100000200);
|
||||||
} else {
|
} else {
|
||||||
cm.sendOk("It seems you are short on space in one of your inventories. Please check that first to get rewarded properly.");
|
cm.sendOk("It seems you are short on space in one of your inventories. Please check that first to get rewarded properly.");
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
You should have received a copy of the GNU Affero General Public License
|
You should have received a copy of the GNU Affero General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
* @author BubblesDev
|
* @author BubblesDev
|
||||||
* @author Ronan
|
* @author Ronan
|
||||||
@@ -39,7 +39,7 @@ function action(mode, type, selection) {
|
|||||||
if (status == 0) {
|
if (status == 0) {
|
||||||
cm.sendNext("Hello, there! I'm Tommy. There's a Pig Town nearby where we're standing. The pigs there are rowdy and uncontrollable to the point where they have stolen numerous weapons from travelers. They were kicked out from their towns, and are currently hiding out at the Pig Town.");
|
cm.sendNext("Hello, there! I'm Tommy. There's a Pig Town nearby where we're standing. The pigs there are rowdy and uncontrollable to the point where they have stolen numerous weapons from travelers. They were kicked out from their towns, and are currently hiding out at the Pig Town.");
|
||||||
} else if (status == 1) {
|
} else if (status == 1) {
|
||||||
if(cm.isEventLeader()) {
|
if (cm.isEventLeader()) {
|
||||||
cm.sendYesNo("What do you think about making your way there with your party members and teach those rowdy pigs a lesson?");
|
cm.sendYesNo("What do you think about making your way there with your party members and teach those rowdy pigs a lesson?");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
+61
-209
@@ -1,34 +1,8 @@
|
|||||||
/*
|
var map = 980000000;
|
||||||
This file is part of the HeavenMS MapleStory Server
|
var minLvl = 0;
|
||||||
Copyleft (L) 2016 - 2018 RonanLana
|
var maxLvl = 255;
|
||||||
|
var minAmt = 0;
|
||||||
This program is free software: you can redistribute it and/or modify
|
var maxAmt = 6;
|
||||||
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 <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
/* Spiegelmann
|
|
||||||
Refining NPC:
|
|
||||||
* Auto ore refiner
|
|
||||||
*
|
|
||||||
* @author RonanLana
|
|
||||||
*/
|
|
||||||
|
|
||||||
var status;
|
|
||||||
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() {
|
function start() {
|
||||||
status = -1;
|
status = -1;
|
||||||
@@ -39,7 +13,7 @@ function action(mode, type, selection) {
|
|||||||
if (mode == -1) {
|
if (mode == -1) {
|
||||||
cm.dispose();
|
cm.dispose();
|
||||||
} else {
|
} else {
|
||||||
if (mode == 0 && type > 0) {
|
if (mode == 0 && status == 0) {
|
||||||
cm.dispose();
|
cm.dispose();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -47,186 +21,64 @@ function action(mode, type, selection) {
|
|||||||
status++;
|
status++;
|
||||||
else
|
else
|
||||||
status--;
|
status--;
|
||||||
|
if (status == 0) {
|
||||||
if(status == 0) {
|
if (cm.getParty() == null) {
|
||||||
if (!Packages.constants.ServerConstants.USE_ENABLE_CUSTOM_NPC_SCRIPT) {
|
status = 10;
|
||||||
cm.sendOk("The Monster Carnival is currently unavailable.");
|
cm.sendOk("#eÉ necessário criar um grupo antes de começar o Festival de Monstros!#k");
|
||||||
cm.dispose();
|
} else if (!cm.isLeader()) {
|
||||||
return;
|
status = 10;
|
||||||
}
|
cm.sendOk("Se você quer começar o Festival, avise o #blíder do grupo#k para falar comigo.");
|
||||||
|
|
||||||
var selStr = "The Monster Carnival is currently unavailable, but 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);
|
|
||||||
} else if(status == 1) {
|
|
||||||
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 {
|
} 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.");
|
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 (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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} 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 === 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 {
|
||||||
|
cm.cpqLobby(selection);
|
||||||
|
}
|
||||||
|
cm.dispose();
|
||||||
|
}
|
||||||
|
} else if (status == 11) {
|
||||||
cm.dispose();
|
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;
|
|
||||||
}
|
|
||||||
+289
-195
@@ -1,34 +1,12 @@
|
|||||||
/*
|
importPackage(Packages.server.maps);
|
||||||
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
|
var status = 0;
|
||||||
it under the terms of the GNU Affero General Public License as
|
var rnk = -1;
|
||||||
published by the Free Software Foundation version 3 as published by
|
var n1 = 50; //???
|
||||||
the Free Software Foundation. You may not use, modify or distribute
|
var n2 = 40; //??? ???
|
||||||
this program under any other version of the GNU Affero General Public
|
var n3 = 7; //35
|
||||||
License.
|
var n4 = 10; //40
|
||||||
|
var n5 = 20; //50
|
||||||
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 <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
/* Spiegelmann
|
|
||||||
Refining NPC:
|
|
||||||
* Auto ore refiner
|
|
||||||
*
|
|
||||||
* @author RonanLana
|
|
||||||
*/
|
|
||||||
|
|
||||||
var status;
|
|
||||||
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() {
|
function start() {
|
||||||
status = -1;
|
status = -1;
|
||||||
@@ -39,7 +17,7 @@ function action(mode, type, selection) {
|
|||||||
if (mode == -1) {
|
if (mode == -1) {
|
||||||
cm.dispose();
|
cm.dispose();
|
||||||
} else {
|
} else {
|
||||||
if (mode == 0 && type > 0) {
|
if (status >= 0 && mode == 0) {
|
||||||
cm.dispose();
|
cm.dispose();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -47,180 +25,296 @@ function action(mode, type, selection) {
|
|||||||
status++;
|
status++;
|
||||||
else
|
else
|
||||||
status--;
|
status--;
|
||||||
|
if (cm.getPlayer().getMapId() == 980000010) {
|
||||||
if(status == 0) {
|
if (status == 0) {
|
||||||
var selStr = "The Monster Carnival is currently unavailable, but 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";
|
cm.sendNext("Eu espero que você tinha divertido na Folia dos Monstros!");
|
||||||
|
} else if (status > 0) {
|
||||||
var options = new Array("Refine mineral ores","Refine jewel ores");
|
cm.warp(980000000, 0);
|
||||||
if(refineCrystals) {
|
cm.dispose();
|
||||||
options.push("Refine crystal ores");
|
|
||||||
}
|
}
|
||||||
if(refineRocks) {
|
} else if (cm.getChar().getMap().isCPQLoserMap()) {
|
||||||
options.push("Refine plates/jewels");
|
if (status == 0) {
|
||||||
}
|
if (cm.getChar().getParty() != null) {
|
||||||
|
var shiu = "";
|
||||||
for (var i = 0; i < options.length; i++){
|
if (cm.getPlayer().getFestivalPoints() >= 100) {
|
||||||
selStr += "\r\n#L" + i + "# " + options[i] + "#l";
|
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;
|
||||||
cm.sendSimple(selStr);
|
} else if (cm.getPlayer().getFestivalPoints() >= 50 && cm.getPlayer().getFestivalPoints() < 100) {
|
||||||
} else if(status == 1) {
|
shiu += "#rB#k";
|
||||||
var allDone;
|
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);
|
||||||
if (selection == 0) {
|
} else if (cm.getPlayer().getFestivalPoints() >= 30 && cm.getPlayer().getFestivalPoints() < 50) {
|
||||||
allDone = refineItems(0); // minerals
|
shiu += "#rC#k";
|
||||||
} else if (selection == 1) {
|
rnk = 30;
|
||||||
allDone = refineItems(1); // jewels
|
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 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 {
|
} else {
|
||||||
cm.sendOk("Done. Be aware some of the items could not be synthetized because either you have a lack of space on your ETC inventory or there's not enough mesos to cover the fee.");
|
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);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
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 (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 && cm.getPlayer().getFestivalPoints() < 300) {
|
||||||
|
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) {
|
||||||
|
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.warp(980000000, 0);
|
||||||
|
cm.dispose();
|
||||||
|
}
|
||||||
|
} 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 (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");
|
||||||
|
} 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 (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();
|
cm.dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else if (status == 12) {
|
||||||
|
if (selection == 12) {
|
||||||
function getRefineFee(fee) {
|
status = 10;
|
||||||
return ((feeMultiplier * fee) | 0);
|
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");
|
||||||
}
|
|
||||||
|
|
||||||
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 {
|
} else {
|
||||||
itemCount[itemid] = it.getQuantity();
|
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]);
|
||||||
for(var key in itemCount) {
|
cm.dispose();
|
||||||
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 {
|
} else {
|
||||||
refineQty--;
|
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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
var status = 0;
|
||||||
|
var request;
|
||||||
|
|
||||||
|
function start() {
|
||||||
|
status = -1;
|
||||||
|
action(1, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function action(mode, type, selection) {
|
||||||
|
if (mode == -1) {
|
||||||
|
cm.dispose();
|
||||||
|
} else {
|
||||||
|
if (mode == 0 && status == 0) {
|
||||||
|
cm.dispose();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (mode == 1)
|
||||||
|
status++;
|
||||||
|
else
|
||||||
|
status--;
|
||||||
|
if (status == 0) {
|
||||||
|
cm.warpParty(980000000);
|
||||||
|
cm.cancelarSaida();
|
||||||
|
cm.dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
var status = 0;
|
||||||
|
var request;
|
||||||
|
|
||||||
|
function start() {
|
||||||
|
status = -1;
|
||||||
|
action(1, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function action(mode, type, selection) {
|
||||||
|
cm.warpParty(980000000);
|
||||||
|
cm.cancelarSaida();
|
||||||
|
cm.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,83 @@
|
|||||||
|
var map = 980030000;
|
||||||
|
var minLvl = 30;
|
||||||
|
var maxLvl = 255;
|
||||||
|
var minAmt = 0;
|
||||||
|
var maxAmt = 6;
|
||||||
|
|
||||||
|
function start() {
|
||||||
|
status = -1;
|
||||||
|
action(1, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
function action(mode, type, selection) {
|
||||||
|
if (mode == -1) {
|
||||||
|
cm.dispose();
|
||||||
|
} else {
|
||||||
|
if (mode == 0 && status == 0) {
|
||||||
|
cm.dispose();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (mode == 1)
|
||||||
|
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 (party.get(i).getPlayer().getMapId()!= 980030000) {
|
||||||
|
//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.sendCPQMapLists2();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (status == 1) {
|
||||||
|
if (cm.fieldTaken2(selection)) {
|
||||||
|
if (cm.fieldLobbied2(selection)) {
|
||||||
|
cm.challengeParty2(selection);
|
||||||
|
cm.dispose();
|
||||||
|
} else {
|
||||||
|
cm.sendOk("A sala esta cheia.");
|
||||||
|
cm.dispose();
|
||||||
|
}
|
||||||
|
} 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.");
|
||||||
|
} else {
|
||||||
|
cm.cpqLobby2(selection);
|
||||||
|
}
|
||||||
|
cm.dispose();
|
||||||
|
}
|
||||||
|
} else if (status == 11) {
|
||||||
|
cm.dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,132 @@
|
|||||||
|
importPackage(net.sf.odinms.server.maps);
|
||||||
|
|
||||||
|
var status = 0;
|
||||||
|
var rnk = -1;
|
||||||
|
|
||||||
|
function start() {
|
||||||
|
status = -1;
|
||||||
|
action(1, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
function action(mode, type, selection) {
|
||||||
|
if (mode == -1) {
|
||||||
|
cm.dispose();
|
||||||
|
} else {
|
||||||
|
if (status >= 0 && mode == 0) {
|
||||||
|
cm.sendOk("Alright then, I hope we can chat later next time.");
|
||||||
|
cm.dispose();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (mode == 1)
|
||||||
|
status++;
|
||||||
|
else
|
||||||
|
status--;
|
||||||
|
if (cm.getChar().getMap().isCPQLoserMap()) {
|
||||||
|
if (status == 0) {
|
||||||
|
if (cm.getChar().getParty() != null) {
|
||||||
|
var shiu = "";
|
||||||
|
if (cm.getPlayer().getFestivalPoints() >= 100) {
|
||||||
|
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() >= 50 && 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) {
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
cm.warp(980030000, 0);
|
||||||
|
cm.dispose();
|
||||||
|
}
|
||||||
|
} else if (status == 1) {
|
||||||
|
switch (rnk) {
|
||||||
|
case 10:
|
||||||
|
cm.warp(980030000, 0);
|
||||||
|
cm.gainExp(35000);
|
||||||
|
cm.dispose();
|
||||||
|
break;
|
||||||
|
case 20:
|
||||||
|
cm.warp(980030000, 0);
|
||||||
|
cm.gainExp(25000);
|
||||||
|
cm.dispose();
|
||||||
|
break;
|
||||||
|
case 30:
|
||||||
|
cm.warp(980030000, 0);
|
||||||
|
cm.gainExp(12500);
|
||||||
|
cm.dispose();
|
||||||
|
break;
|
||||||
|
case 40:
|
||||||
|
cm.warp(980030000, 0);
|
||||||
|
cm.gainExp(3500);
|
||||||
|
cm.dispose();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
cm.warp(980030000, 0);
|
||||||
|
cm.dispose();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} 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 && cm.getPlayer().getFestivalPoints() < 300) {
|
||||||
|
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) {
|
||||||
|
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.warp(980030000, 0);
|
||||||
|
cm.dispose();
|
||||||
|
}
|
||||||
|
} else if (status == 1) {
|
||||||
|
switch (rnk) {
|
||||||
|
case 1:
|
||||||
|
cm.warp(980030000, 0);
|
||||||
|
cm.gainExp(875000);
|
||||||
|
cm.dispose();
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
cm.warp(980030000, 0);
|
||||||
|
cm.gainExp(700000);
|
||||||
|
cm.dispose();
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
cm.warp(980030000, 0);
|
||||||
|
cm.gainExp(555000);
|
||||||
|
cm.dispose();
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
cm.warp(980030000, 0);
|
||||||
|
cm.gainExp(100000);
|
||||||
|
cm.dispose();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
cm.warp(980030000, 0);
|
||||||
|
cm.dispose();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
var status = 0;
|
||||||
|
var request;
|
||||||
|
|
||||||
|
function start() {
|
||||||
|
status = -1;
|
||||||
|
action(1, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function action(mode, type, selection) {
|
||||||
|
if (mode == -1) {
|
||||||
|
cm.dispose();
|
||||||
|
} else {
|
||||||
|
if (mode == 0 && status == 0) {
|
||||||
|
cm.dispose();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (mode == 1)
|
||||||
|
status++;
|
||||||
|
else
|
||||||
|
status--;
|
||||||
|
if (status == 0) {
|
||||||
|
cm.warpParty(980030000, 4);
|
||||||
|
cm.cancelarSaida();
|
||||||
|
cm.dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
var status = 0;
|
||||||
|
var request;
|
||||||
|
|
||||||
|
function start() {
|
||||||
|
status = -1;
|
||||||
|
action(1, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function action(mode, type, selection) {
|
||||||
|
if (mode == -1) {
|
||||||
|
cm.dispose();
|
||||||
|
} else {
|
||||||
|
if (mode == 0 && status == 0) {
|
||||||
|
cm.dispose();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (mode == 1)
|
||||||
|
status++;
|
||||||
|
else
|
||||||
|
status--;
|
||||||
|
if (status == 0) {
|
||||||
|
cm.warpParty(980030000, 4);
|
||||||
|
cm.cancelarSaida();
|
||||||
|
cm.dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
+60
-51
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
You should have received a copy of the GNU Affero General Public License
|
You should have received a copy of the GNU Affero General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
/* High Priest John
|
/* High Priest John
|
||||||
Marriage NPC
|
Marriage NPC
|
||||||
*/
|
*/
|
||||||
@@ -41,9 +41,9 @@ function isWeddingIndoors(mapid) {
|
|||||||
function getMarriageInstance(player) {
|
function getMarriageInstance(player) {
|
||||||
var em = cm.getEventManager(weddingEventName);
|
var em = cm.getEventManager(weddingEventName);
|
||||||
|
|
||||||
for (var iterator = em.getInstances().iterator(); iterator.hasNext();) {
|
for (var iterator = em.getInstances().iterator(); iterator.hasNext(); ) {
|
||||||
var eim = iterator.next();
|
var eim = iterator.next();
|
||||||
if(eim.isEventLeader(player)) {
|
if (eim.isEventLeader(player)) {
|
||||||
return eim;
|
return eim;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -68,15 +68,15 @@ function getRingId(boxItemId) {
|
|||||||
function isSuitedForWedding(player, equipped) {
|
function isSuitedForWedding(player, equipped) {
|
||||||
var baseid = (player.getGender() == 0) ? 1050131 : 1051150;
|
var baseid = (player.getGender() == 0) ? 1050131 : 1051150;
|
||||||
|
|
||||||
if(equipped) {
|
if (equipped) {
|
||||||
for(var i = 0; i < 4; i++) {
|
for (var i = 0; i < 4; i++) {
|
||||||
if(player.haveItemEquipped(baseid + i)) {
|
if (player.haveItemEquipped(baseid + i)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for(var i = 0; i < 4; i++) {
|
for (var i = 0; i < 4; i++) {
|
||||||
if(player.haveItemWithId(baseid + i, true)) {
|
if (player.haveItemWithId(baseid + i, true)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -86,11 +86,15 @@ function isSuitedForWedding(player, equipped) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getWeddingPreparationStatus(player, partner) {
|
function getWeddingPreparationStatus(player, partner) {
|
||||||
if(!player.haveItem(4000313)) return -3;
|
if (!player.haveItem(4000313))
|
||||||
if(!partner.haveItem(4000313)) return 3;
|
return -3;
|
||||||
|
if (!partner.haveItem(4000313))
|
||||||
|
return 3;
|
||||||
|
|
||||||
if(!isSuitedForWedding(player, true)) return -4;
|
if (!isSuitedForWedding(player, true))
|
||||||
if(!isSuitedForWedding(partner, true)) return 4;
|
return -4;
|
||||||
|
if (!isSuitedForWedding(partner, true))
|
||||||
|
return 4;
|
||||||
|
|
||||||
var hasEngagement = false;
|
var hasEngagement = false;
|
||||||
for (var x = 4031357; x <= 4031364; x++) {
|
for (var x = 4031357; x <= 4031364; x++) {
|
||||||
@@ -99,7 +103,8 @@ function getWeddingPreparationStatus(player, partner) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!hasEngagement) return -1;
|
if (!hasEngagement)
|
||||||
|
return -1;
|
||||||
|
|
||||||
hasEngagement = false;
|
hasEngagement = false;
|
||||||
for (var x = 4031357; x <= 4031364; x++) {
|
for (var x = 4031357; x <= 4031364; x++) {
|
||||||
@@ -108,10 +113,13 @@ function getWeddingPreparationStatus(player, partner) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!hasEngagement) return -2;
|
if (!hasEngagement)
|
||||||
|
return -2;
|
||||||
|
|
||||||
if(!player.canHold(1112803)) return 1;
|
if (!player.canHold(1112803))
|
||||||
if(!partner.canHold(1112803)) return 2;
|
return 1;
|
||||||
|
if (!partner.canHold(1112803))
|
||||||
|
return 2;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -125,7 +133,8 @@ function giveCoupleBlessings(eim, player, partner) {
|
|||||||
|
|
||||||
function start() {
|
function start() {
|
||||||
weddingIndoors = isWeddingIndoors(cm.getMapId());
|
weddingIndoors = isWeddingIndoors(cm.getMapId());
|
||||||
if(weddingIndoors) eim = cm.getEventInstance();
|
if (weddingIndoors)
|
||||||
|
eim = cm.getEventInstance();
|
||||||
|
|
||||||
status = -1;
|
status = -1;
|
||||||
action(1, 0, 0);
|
action(1, 0, 0);
|
||||||
@@ -144,8 +153,8 @@ function action(mode, type, selection) {
|
|||||||
else
|
else
|
||||||
status--;
|
status--;
|
||||||
|
|
||||||
if(!weddingIndoors) {
|
if (!weddingIndoors) {
|
||||||
if(status == 0) {
|
if (status == 0) {
|
||||||
var hasEngagement = false;
|
var hasEngagement = false;
|
||||||
for (var x = 4031357; x <= 4031364; x++) {
|
for (var x = 4031357; x <= 4031364; x++) {
|
||||||
if (cm.haveItem(x, 1)) {
|
if (cm.haveItem(x, 1)) {
|
||||||
@@ -154,7 +163,7 @@ function action(mode, type, selection) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(hasEngagement) {
|
if (hasEngagement) {
|
||||||
var text = "Hi there. How can I help you?";
|
var text = "Hi there. How can I help you?";
|
||||||
var choice = new Array("We're ready to get married.");
|
var choice = new Array("We're ready to get married.");
|
||||||
for (x = 0; x < choice.length; x++) {
|
for (x = 0; x < choice.length; x++) {
|
||||||
@@ -165,27 +174,27 @@ function action(mode, type, selection) {
|
|||||||
cm.sendOk("Hmm, today two fluttering hearts are about to be joined together by the blessings of love!");
|
cm.sendOk("Hmm, today two fluttering hearts are about to be joined together by the blessings of love!");
|
||||||
cm.dispose();
|
cm.dispose();
|
||||||
}
|
}
|
||||||
} else if(status == 1) {
|
} else if (status == 1) {
|
||||||
var wid = cm.getClient().getWorldServer().getRelationshipId(cm.getPlayer().getId());
|
var wid = cm.getClient().getWorldServer().getRelationshipId(cm.getPlayer().getId());
|
||||||
var cserv = cm.getClient().getChannelServer();
|
var cserv = cm.getClient().getChannelServer();
|
||||||
|
|
||||||
if(cserv.isWeddingReserved(wid)) {
|
if (cserv.isWeddingReserved(wid)) {
|
||||||
if(wid == cserv.getOngoingWedding(cathedralWedding)) {
|
if (wid == cserv.getOngoingWedding(cathedralWedding)) {
|
||||||
var partner = cserv.getPlayerStorage().getCharacterById(cm.getPlayer().getPartnerId());
|
var partner = cserv.getPlayerStorage().getCharacterById(cm.getPlayer().getPartnerId());
|
||||||
if(!(partner == null || !cm.getMap().equals(partner.getMap()))) {
|
if (!(partner == null || !cm.getMap().equals(partner.getMap()))) {
|
||||||
if(!cm.canHold(4000313)) {
|
if (!cm.canHold(4000313)) {
|
||||||
cm.sendOk("Please have a free ETC slot available to get the #b#t4000313##k.");
|
cm.sendOk("Please have a free ETC slot available to get the #b#t4000313##k.");
|
||||||
cm.dispose();
|
cm.dispose();
|
||||||
return;
|
return;
|
||||||
} else if(!partner.canHold(4000313)) {
|
} else if (!partner.canHold(4000313)) {
|
||||||
cm.sendOk("Please let your partner know they must have a free ETC slot available to get the #b#t4000313##k.");
|
cm.sendOk("Please let your partner know they must have a free ETC slot available to get the #b#t4000313##k.");
|
||||||
cm.dispose();
|
cm.dispose();
|
||||||
return;
|
return;
|
||||||
} else if(!isSuitedForWedding(cm.getPlayer(), false)) {
|
} else if (!isSuitedForWedding(cm.getPlayer(), false)) {
|
||||||
cm.sendOk("Please purchase a #rwedding garment#k for the ceremony, quickly! Without it I am not able to marry you.");
|
cm.sendOk("Please purchase a #rwedding garment#k for the ceremony, quickly! Without it I am not able to marry you.");
|
||||||
cm.dispose();
|
cm.dispose();
|
||||||
return;
|
return;
|
||||||
} else if(!isSuitedForWedding(partner, false)) {
|
} else if (!isSuitedForWedding(partner, false)) {
|
||||||
cm.sendOk("Please let your partner know they must have a #rwedding garment#k ready for the ceremony.");
|
cm.sendOk("Please let your partner know they must have a #rwedding garment#k ready for the ceremony.");
|
||||||
cm.dispose();
|
cm.dispose();
|
||||||
return;
|
return;
|
||||||
@@ -206,19 +215,19 @@ function action(mode, type, selection) {
|
|||||||
cm.sendOk("Hmm, I'm sorry but there are no reservations made for you at this channel for the time being.");
|
cm.sendOk("Hmm, I'm sorry but there are no reservations made for you at this channel for the time being.");
|
||||||
cm.dispose();
|
cm.dispose();
|
||||||
}
|
}
|
||||||
} else if(status == 2) {
|
} else if (status == 2) {
|
||||||
var cserv = cm.getClient().getChannelServer();
|
var cserv = cm.getClient().getChannelServer();
|
||||||
var wtype = cserv.getOngoingWeddingType(cathedralWedding);
|
var wtype = cserv.getOngoingWeddingType(cathedralWedding);
|
||||||
|
|
||||||
var partner = cserv.getPlayerStorage().getCharacterById(cm.getPlayer().getPartnerId());
|
var partner = cserv.getPlayerStorage().getCharacterById(cm.getPlayer().getPartnerId());
|
||||||
if(!(partner == null || !cm.getMap().equals(partner.getMap()))) {
|
if (!(partner == null || !cm.getMap().equals(partner.getMap()))) {
|
||||||
if(cserv.acceptOngoingWedding(cathedralWedding)) {
|
if (cserv.acceptOngoingWedding(cathedralWedding)) {
|
||||||
var wid = cm.getClient().getWorldServer().getRelationshipId(cm.getPlayer().getId());
|
var wid = cm.getClient().getWorldServer().getRelationshipId(cm.getPlayer().getId());
|
||||||
if(wid > 0) {
|
if (wid > 0) {
|
||||||
var em = cm.getEventManager(weddingEventName);
|
var em = cm.getEventManager(weddingEventName);
|
||||||
if(em.startInstance(cm.getPlayer())) {
|
if (em.startInstance(cm.getPlayer())) {
|
||||||
eim = getMarriageInstance(cm.getPlayer());
|
eim = getMarriageInstance(cm.getPlayer());
|
||||||
if(eim != null) {
|
if (eim != null) {
|
||||||
eim.setIntProperty("weddingId", wid);
|
eim.setIntProperty("weddingId", wid);
|
||||||
eim.setIntProperty("groomId", cm.getPlayer().getId());
|
eim.setIntProperty("groomId", cm.getPlayer().getId());
|
||||||
eim.setIntProperty("brideId", cm.getPlayer().getPartnerId());
|
eim.setIntProperty("brideId", cm.getPlayer().getPartnerId());
|
||||||
@@ -248,20 +257,20 @@ function action(mode, type, selection) {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (status == 0) {
|
if (status == 0) {
|
||||||
if(eim == null) {
|
if (eim == null) {
|
||||||
cm.warp(680000000,0);
|
cm.warp(680000000, 0);
|
||||||
cm.dispose();
|
cm.dispose();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var playerId = cm.getPlayer().getId();
|
var playerId = cm.getPlayer().getId();
|
||||||
if(playerId == eim.getIntProperty("groomId") || playerId == eim.getIntProperty("brideId")) {
|
if (playerId == eim.getIntProperty("groomId") || playerId == eim.getIntProperty("brideId")) {
|
||||||
var wstg = eim.getIntProperty("weddingStage");
|
var wstg = eim.getIntProperty("weddingStage");
|
||||||
|
|
||||||
if(wstg == 2) {
|
if (wstg == 2) {
|
||||||
cm.sendYesNo("Very well, the guests has bestowed all their blessings to you now. The time has come, #rshould I make you Husband and Wife#k?");
|
cm.sendYesNo("Very well, the guests has bestowed all their blessings to you now. The time has come, #rshould I make you Husband and Wife#k?");
|
||||||
state = 1;
|
state = 1;
|
||||||
} else if(wstg == 1) {
|
} else if (wstg == 1) {
|
||||||
cm.sendOk("While you two are making your wedding vows to each other, your guests are currently giving their blessings to you. This is a time of happiness for both of you, please rejoice the ceremony.");
|
cm.sendOk("While you two are making your wedding vows to each other, your guests are currently giving their blessings to you. This is a time of happiness for both of you, please rejoice the ceremony.");
|
||||||
cm.dispose();
|
cm.dispose();
|
||||||
} else {
|
} else {
|
||||||
@@ -270,12 +279,12 @@ function action(mode, type, selection) {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
var wstg = eim.getIntProperty("weddingStage");
|
var wstg = eim.getIntProperty("weddingStage");
|
||||||
if(wstg == 1) {
|
if (wstg == 1) {
|
||||||
if(eim.gridCheck(cm.getPlayer()) != -1) {
|
if (eim.gridCheck(cm.getPlayer()) != -1) {
|
||||||
cm.sendOk("Everyone give your blessings to this lovely couple!");
|
cm.sendOk("Everyone give your blessings to this lovely couple!");
|
||||||
cm.dispose();
|
cm.dispose();
|
||||||
} else {
|
} else {
|
||||||
if(eim.getIntProperty("guestBlessings") == 1) {
|
if (eim.getIntProperty("guestBlessings") == 1) {
|
||||||
cm.sendYesNo("Do you want to bless this couple?");
|
cm.sendYesNo("Do you want to bless this couple?");
|
||||||
state = 0;
|
state = 0;
|
||||||
} else {
|
} else {
|
||||||
@@ -283,7 +292,7 @@ function action(mode, type, selection) {
|
|||||||
cm.dispose();
|
cm.dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if(wstg == 3) {
|
} else if (wstg == 3) {
|
||||||
cm.sendOk("The two loving birds are now married. What a lively day! Please #rget ready for the afterparty#k, it should start soon. Follow the married couple's lead.");
|
cm.sendOk("The two loving birds are now married. What a lively day! Please #rget ready for the afterparty#k, it should start soon. Follow the married couple's lead.");
|
||||||
cm.dispose();
|
cm.dispose();
|
||||||
} else {
|
} else {
|
||||||
@@ -292,10 +301,10 @@ function action(mode, type, selection) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (status == 1) {
|
} else if (status == 1) {
|
||||||
if(state == 0) { // give player blessings
|
if (state == 0) { // give player blessings
|
||||||
eim.gridInsert(cm.getPlayer(), 1);
|
eim.gridInsert(cm.getPlayer(), 1);
|
||||||
|
|
||||||
if(ServerConstants.WEDDING_BLESSER_SHOWFX) {
|
if (ServerConstants.WEDDING_BLESSER_SHOWFX) {
|
||||||
var target = cm.getPlayer();
|
var target = cm.getPlayer();
|
||||||
target.announce(MaplePacketCreator.showSpecialEffect(9));
|
target.announce(MaplePacketCreator.showSpecialEffect(9));
|
||||||
target.getMap().broadcastMessage(target, MaplePacketCreator.showForeignEffect(target.getId(), 9), false);
|
target.getMap().broadcastMessage(target, MaplePacketCreator.showForeignEffect(target.getId(), 9), false);
|
||||||
@@ -314,9 +323,9 @@ function action(mode, type, selection) {
|
|||||||
} else { // couple wants to complete the wedding
|
} else { // couple wants to complete the wedding
|
||||||
var wstg = eim.getIntProperty("weddingStage");
|
var wstg = eim.getIntProperty("weddingStage");
|
||||||
|
|
||||||
if(wstg == 2) {
|
if (wstg == 2) {
|
||||||
var pid = cm.getPlayer().getPartnerId();
|
var pid = cm.getPlayer().getPartnerId();
|
||||||
if(pid <= 0) {
|
if (pid <= 0) {
|
||||||
cm.sendOk("It seems you are no longer engaged to your partner, just before the altar... Where did all that happiness you two had sported a while ago went?");
|
cm.sendOk("It seems you are no longer engaged to your partner, just before the altar... Where did all that happiness you two had sported a while ago went?");
|
||||||
cm.dispose();
|
cm.dispose();
|
||||||
return;
|
return;
|
||||||
@@ -324,14 +333,14 @@ function action(mode, type, selection) {
|
|||||||
|
|
||||||
var player = cm.getPlayer();
|
var player = cm.getPlayer();
|
||||||
var partner = cm.getMap().getCharacterById(cm.getPlayer().getPartnerId());
|
var partner = cm.getMap().getCharacterById(cm.getPlayer().getPartnerId());
|
||||||
if(partner != null) {
|
if (partner != null) {
|
||||||
state = getWeddingPreparationStatus(player, partner);
|
state = getWeddingPreparationStatus(player, partner);
|
||||||
|
|
||||||
switch(state) {
|
switch (state) {
|
||||||
case 0:
|
case 0:
|
||||||
var pid = eim.getIntProperty("confirmedVows");
|
var pid = eim.getIntProperty("confirmedVows");
|
||||||
if(pid != -1) {
|
if (pid != -1) {
|
||||||
if(pid == player.getId()) {
|
if (pid == player.getId()) {
|
||||||
cm.sendOk("You have already confirmed your vows. All that is left is for your partner to confirm now.");
|
cm.sendOk("You have already confirmed your vows. All that is left is for your partner to confirm now.");
|
||||||
} else {
|
} else {
|
||||||
eim.setIntProperty("weddingStage", 3);
|
eim.setIntProperty("weddingStage", 3);
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ function action(mode, type, selection) {
|
|||||||
var eim = cm.getEventInstance();
|
var eim = cm.getEventInstance();
|
||||||
if(eim == null) {
|
if(eim == null) {
|
||||||
cm.warp(680000000,0);
|
cm.warp(680000000,0);
|
||||||
|
//cm.criarLista();
|
||||||
cm.dispose();
|
cm.dispose();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -71,7 +72,7 @@ function action(mode, type, selection) {
|
|||||||
cm.sendOk("Congratulations on your wedding. Please talk to #b#p9201007##k to start the afterparty.");
|
cm.sendOk("Congratulations on your wedding. Please talk to #b#p9201007##k to start the afterparty.");
|
||||||
cm.dispose();
|
cm.dispose();
|
||||||
} else if(hasEngagement) {
|
} else if(hasEngagement) {
|
||||||
cm.sendOk("Please continue with the wedding.");
|
cm.criarLista();
|
||||||
cm.dispose();
|
cm.dispose();
|
||||||
} else {
|
} else {
|
||||||
cm.sendOk("You do not have the required item to continue through this wedding. Unfortunately, it's over...");
|
cm.sendOk("You do not have the required item to continue through this wedding. Unfortunately, it's over...");
|
||||||
|
|||||||
+6
-56
@@ -27,13 +27,10 @@
|
|||||||
1.0 - First Version by Angel
|
1.0 - First Version by Angel
|
||||||
2.0 - Second Version by happydud3 & XotiCraze
|
2.0 - Second Version by happydud3 & XotiCraze
|
||||||
3.0 - Third Version by RonanLana (HeavenMS)
|
3.0 - Third Version by RonanLana (HeavenMS)
|
||||||
|
4.0 - Four Version bby Drago(MapleStorySA)
|
||||||
---------------------------------------------------------------------------------------------------
|
---------------------------------------------------------------------------------------------------
|
||||||
**/
|
**/
|
||||||
|
var status = -1;
|
||||||
var bgPrizes = [[2022179,10], [2022282,10], [2210005,5], [2210003,5]];
|
|
||||||
var cmPrizes = [[2022011,10], [2000005,50], [2022273,10], [2022179,3]];
|
|
||||||
|
|
||||||
var status;
|
|
||||||
|
|
||||||
function start() {
|
function start() {
|
||||||
status = -1;
|
status = -1;
|
||||||
@@ -41,61 +38,14 @@ function start() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function action(mode, type, selection) {
|
function action(mode, type, selection) {
|
||||||
if (mode == -1 || mode == 0) {
|
if (mode == 1) {
|
||||||
cm.sendOk("Goodbye then.");
|
|
||||||
cm.dispose();
|
|
||||||
return;
|
|
||||||
} else if (mode == 1) {
|
|
||||||
status++;
|
status++;
|
||||||
} else {
|
} else {
|
||||||
status--;
|
cm.dispose();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (status == 0) {
|
if (status == 0) {
|
||||||
var msg = "Hello I exchange Onyx Chest for Bride and Groom and the Onyx Chest for prizes!#b";
|
cm.enviarLista();
|
||||||
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();
|
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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
/* global cm */
|
||||||
|
|
||||||
|
var status = 0;
|
||||||
|
var party;
|
||||||
|
|
||||||
|
function start(chrs) {
|
||||||
|
status = -1;
|
||||||
|
party = chrs;
|
||||||
|
action(1, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
function action(mode, type, selection) {
|
||||||
|
if (mode == -1) {
|
||||||
|
cm.getChar().setChallenged(false);
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (mode == -1)
|
||||||
|
cm.dispose();
|
||||||
|
else {
|
||||||
|
if (mode == 1)
|
||||||
|
status++;
|
||||||
|
else
|
||||||
|
status--;
|
||||||
|
if (status == 0) {
|
||||||
|
if (cm.getParty().getMembers().size() == party.size()) {
|
||||||
|
cm.getPlayer().setChallenged(true);
|
||||||
|
var snd = "";
|
||||||
|
for (var i = 0; i < party.size(); i++)
|
||||||
|
snd += "#bNome: " + party.get(i).getName() + " / (Level: " + party.get(i).getLevel() + ") / " + party.get(i).getJobNameById(party.get(i).getJobId()) + "#k\r\n\r\n";
|
||||||
|
cm.sendAcceptDecline(snd + "Gostaria de lutar contra este grupo no Festival de Monstros?");
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else if (status == 1) {
|
||||||
|
var ch = cm.getChrById(party.get(0).getId());
|
||||||
|
if (party.size() == cm.getParty().getMembers().size()) {
|
||||||
|
cm.startCPQ(ch, ch.getMapId() + 1);
|
||||||
|
ch.getParty().setEnemy(cm.getPlayer().getParty());
|
||||||
|
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.dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
var status = 0;
|
||||||
|
var party;
|
||||||
|
|
||||||
|
function start(chrs) {
|
||||||
|
status = -1;
|
||||||
|
party = chrs;
|
||||||
|
action(1, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
function action(mode, type, selection) {
|
||||||
|
if (mode == -1) {
|
||||||
|
cm.getChar().setChallenged(false);
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (mode == -1)
|
||||||
|
cm.dispose();
|
||||||
|
else {
|
||||||
|
if (mode == 1)
|
||||||
|
status++;
|
||||||
|
else
|
||||||
|
status--;
|
||||||
|
if (status == 0) {
|
||||||
|
if (cm.getParty().getMembers().size() == party.size()) {
|
||||||
|
cm.getPlayer().setChallenged(true);
|
||||||
|
var snd = "";
|
||||||
|
for (var i = 0; i < party.size(); i++)
|
||||||
|
snd += "#bNome: " + party.get(i).getName() + " / (Level: " + party.get(i).getLevel() + ") / " + party.get(i).getJobNameById(party.get(i).getJobId()) + "#k\r\n\r\n";
|
||||||
|
cm.sendAcceptDecline(snd + "Gostaria de lutar contra este grupo no Festival de Monstros?");
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else if (status == 1) {
|
||||||
|
var ch = cm.getChrById(party.get(0).getId());
|
||||||
|
cm.startCPQ2(ch, ch.getMapId() + 1);
|
||||||
|
ch.getParty().setEnemy(cm.getPlayer().getParty());
|
||||||
|
cm.getChar().getParty().setEnemy(ch.getParty());
|
||||||
|
cm.getChar().setChallenged(false);
|
||||||
|
cm.dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
function enter(pi) {
|
||||||
|
if ( pi.getPlayer().getTeam() == 0 ) {
|
||||||
|
pi.warp( pi.getMapId() - 100);
|
||||||
|
} else {
|
||||||
|
pi.warp( pi.getMapId() - 100);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
importPackage(Packages.server.maps);
|
||||||
|
|
||||||
|
/*
|
||||||
|
[CelticMS] Monster Carnival Reviving Field 1
|
||||||
|
*/
|
||||||
|
|
||||||
|
function enter(pi) {
|
||||||
|
pi.warp(980000101, 0);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
importPackage(Packages.server.maps);
|
||||||
|
|
||||||
|
/*
|
||||||
|
[CelticMS] Monster Carnival Reviving Field 1
|
||||||
|
*/
|
||||||
|
|
||||||
|
function enter(pi) {
|
||||||
|
pi.warp(980000201, 0);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
importPackage(Packages.server.maps);
|
||||||
|
|
||||||
|
/*
|
||||||
|
[CelticMS] Monster Carnival Reviving Field 1
|
||||||
|
*/
|
||||||
|
|
||||||
|
function enter(pi) {
|
||||||
|
var portal = 0;
|
||||||
|
switch (pi.getPlayer().getTeam()) {
|
||||||
|
case 0:
|
||||||
|
portal = 4;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
portal = 3;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
pi.warp(980000301, portal);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
importPackage(Packages.server.maps);
|
||||||
|
|
||||||
|
/*
|
||||||
|
[CelticMS] Monster Carnival Reviving Field 1
|
||||||
|
*/
|
||||||
|
|
||||||
|
function enter(pi) {
|
||||||
|
var portal = 0;
|
||||||
|
switch (pi.getPlayer().getTeam()) {
|
||||||
|
case 0:
|
||||||
|
portal = 4;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
portal = 3;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
pi.warp(980000401, portal);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
importPackage(Packages.server.maps);
|
||||||
|
|
||||||
|
/*
|
||||||
|
[CelticMS] Monster Carnival Reviving Field 1
|
||||||
|
*/
|
||||||
|
|
||||||
|
function enter(pi) {
|
||||||
|
pi.warp(980000501, 0);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
importPackage(Packages.server.maps);
|
||||||
|
|
||||||
|
/*
|
||||||
|
[CelticMS] Monster Carnival Reviving Field 1
|
||||||
|
*/
|
||||||
|
|
||||||
|
function enter(pi) {
|
||||||
|
pi.warp(980000601, 0);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
@@ -17,12 +17,19 @@
|
|||||||
|
|
||||||
You should have received a copy of the GNU Affero General Public License
|
You should have received a copy of the GNU Affero General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
importPackage(Packages.server.maps);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Author: kevintjuh93
|
*/
|
||||||
*/
|
|
||||||
|
|
||||||
function enter(pi) {
|
function enter(pi) {
|
||||||
pi.playPortalSound(); pi.warp(pi.getPlayer().getSavedLocation("MIRROR"));
|
var returnMap = pi.getPlayer().getSavedLocation("MONSTER_CARNIVAL");
|
||||||
|
if (returnMap < 0) {
|
||||||
|
returnMap = 102000000; // Just Incase there is no saved location.
|
||||||
|
}
|
||||||
|
var target = pi.getPlayer().getClient().getChannelServer().getMapFactory().getMap(returnMap);
|
||||||
|
pi.getPlayer().changeMap(target);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -1,28 +1,3 @@
|
|||||||
/*
|
|
||||||
* This file is part of the OdinMS Maple Story Server
|
|
||||||
Copyright (C) 2008 Patrick Huy <[email protected]>
|
|
||||||
Matthias Butz <[email protected]>
|
|
||||||
Jan Christian Meyer <[email protected]>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Affero General Public License 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 <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
@Author kevintjuh93
|
|
||||||
*/
|
|
||||||
|
|
||||||
function act() {
|
function act() {
|
||||||
rm.getReactor().removeMonsterStatus();
|
rm.dispelAllMonsters(parseInt(rm.getReactor().getName().substring(1,2)), parseInt(rm.getReactor().getName().substring(0,1)));
|
||||||
}
|
}
|
||||||
@@ -1,28 +1,3 @@
|
|||||||
/*
|
|
||||||
* This file is part of the OdinMS Maple Story Server
|
|
||||||
Copyright (C) 2008 Patrick Huy <[email protected]>
|
|
||||||
Matthias Butz <[email protected]>
|
|
||||||
Jan Christian Meyer <[email protected]>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Affero General Public License 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 <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
@Author kevintjuh93
|
|
||||||
*/
|
|
||||||
|
|
||||||
function act() {
|
function act() {
|
||||||
rm.getReactor().removeMonsterStatus();
|
rm.dispelAllMonsters(parseInt(rm.getReactor().getName().substring(1,2)), parseInt(rm.getReactor().getName().substring(0,1)));
|
||||||
}
|
}
|
||||||
+736
-466
File diff suppressed because it is too large.
Load diff
+64
-53
@@ -1,23 +1,23 @@
|
|||||||
/*
|
/*
|
||||||
This file is part of the OdinMS Maple Story Server
|
This file is part of the OdinMS Maple Story Server
|
||||||
Copyright (C) 2008 Patrick Huy <[email protected]>
|
Copyright (C) 2008 Patrick Huy <[email protected]>
|
||||||
Matthias Butz <[email protected]>
|
Matthias Butz <[email protected]>
|
||||||
Jan Christian Meyer <[email protected]>
|
Jan Christian Meyer <[email protected]>
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU Affero General Public License as
|
it under the terms of the GNU Affero General Public License as
|
||||||
published by the Free Software Foundation version 3 as published by
|
published by the Free Software Foundation version 3 as published by
|
||||||
the Free Software Foundation. You may not use, modify or distribute
|
the Free Software Foundation. You may not use, modify or distribute
|
||||||
this program under any other version of the GNU Affero General Public
|
this program under any other version of the GNU Affero General Public
|
||||||
License.
|
License.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU Affero General Public License for more details.
|
GNU Affero General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Affero General Public License
|
You should have received a copy of the GNU Affero General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package client;
|
package client;
|
||||||
|
|
||||||
@@ -228,8 +228,8 @@ public class MapleClient {
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getVoteTime(){
|
public int getVoteTime() {
|
||||||
if (voteTime != -1){
|
if (voteTime != -1) {
|
||||||
return voteTime;
|
return voteTime;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
@@ -255,7 +255,7 @@ public class MapleClient {
|
|||||||
voteTime = -1;
|
voteTime = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasVotedAlready(){
|
public boolean hasVotedAlready() {
|
||||||
Date currentDate = new Date();
|
Date currentDate = new Date();
|
||||||
int timeNow = (int) (currentDate.getTime() / 1000);
|
int timeNow = (int) (currentDate.getTime() / 1000);
|
||||||
int difference = (timeNow - getVoteTime());
|
int difference = (timeNow - getVoteTime());
|
||||||
@@ -263,8 +263,9 @@ public class MapleClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasBannedHWID() {
|
public boolean hasBannedHWID() {
|
||||||
if(hwid == null)
|
if (hwid == null) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
boolean ret = false;
|
boolean ret = false;
|
||||||
PreparedStatement ps = null;
|
PreparedStatement ps = null;
|
||||||
@@ -274,22 +275,23 @@ public class MapleClient {
|
|||||||
ps = con.prepareStatement("SELECT COUNT(*) FROM hwidbans WHERE hwid LIKE ?");
|
ps = con.prepareStatement("SELECT COUNT(*) FROM hwidbans WHERE hwid LIKE ?");
|
||||||
ps.setString(1, hwid);
|
ps.setString(1, hwid);
|
||||||
ResultSet rs = ps.executeQuery();
|
ResultSet rs = ps.executeQuery();
|
||||||
if(rs != null && rs.next()) {
|
if (rs != null && rs.next()) {
|
||||||
if(rs.getInt(1) > 0)
|
if (rs.getInt(1) > 0) {
|
||||||
ret = true;
|
ret = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
} finally {
|
} finally {
|
||||||
try {
|
try {
|
||||||
if(ps != null && !ps.isClosed()) {
|
if (ps != null && !ps.isClosed()) {
|
||||||
ps.close();
|
ps.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(con != null && !con.isClosed()) {
|
if (con != null && !con.isClosed()) {
|
||||||
con.close();
|
con.close();
|
||||||
}
|
}
|
||||||
} catch (SQLException e){
|
} catch (SQLException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -336,12 +338,12 @@ public class MapleClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void loadHWIDIfNescessary() throws SQLException {
|
private void loadHWIDIfNescessary() throws SQLException {
|
||||||
if(hwid == null) {
|
if (hwid == null) {
|
||||||
Connection con = DatabaseConnection.getConnection();
|
Connection con = DatabaseConnection.getConnection();
|
||||||
try(PreparedStatement ps = con.prepareStatement("SELECT hwid FROM accounts WHERE id = ?")) {
|
try (PreparedStatement ps = con.prepareStatement("SELECT hwid FROM accounts WHERE id = ?")) {
|
||||||
ps.setInt(1, accId);
|
ps.setInt(1, accId);
|
||||||
try(ResultSet rs = ps.executeQuery()) {
|
try (ResultSet rs = ps.executeQuery()) {
|
||||||
if(rs.next()) {
|
if (rs.next()) {
|
||||||
hwid = rs.getString("hwid");
|
hwid = rs.getString("hwid");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -386,10 +388,10 @@ public class MapleClient {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
} finally {
|
} finally {
|
||||||
try {
|
try {
|
||||||
if(ps != null && !ps.isClosed()) {
|
if (ps != null && !ps.isClosed()) {
|
||||||
ps.close();
|
ps.close();
|
||||||
}
|
}
|
||||||
if(con != null && !con.isClosed()) {
|
if (con != null && !con.isClosed()) {
|
||||||
con.close();
|
con.close();
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
@@ -502,7 +504,9 @@ public class MapleClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean checkPic(String other) {
|
public boolean checkPic(String other) {
|
||||||
if(!(ServerConstants.ENABLE_PIC && !canBypassPic())) return true;
|
if (!(ServerConstants.ENABLE_PIC && !canBypassPic())) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
picattempt++;
|
picattempt++;
|
||||||
if (picattempt > 5) {
|
if (picattempt > 5) {
|
||||||
@@ -668,12 +672,12 @@ public class MapleClient {
|
|||||||
|
|
||||||
public void updateHWID(String newHwid) {
|
public void updateHWID(String newHwid) {
|
||||||
String[] split = newHwid.split("_");
|
String[] split = newHwid.split("_");
|
||||||
if(split.length > 1 && split[1].length() == 8) {
|
if (split.length > 1 && split[1].length() == 8) {
|
||||||
StringBuilder hwid = new StringBuilder();
|
StringBuilder hwid = new StringBuilder();
|
||||||
String convert = split[1];
|
String convert = split[1];
|
||||||
|
|
||||||
int len = convert.length();
|
int len = convert.length();
|
||||||
for(int i=len-2; i>=0; i -= 2) {
|
for (int i = len - 2; i >= 0; i -= 2) {
|
||||||
hwid.append(convert.substring(i, i + 2));
|
hwid.append(convert.substring(i, i + 2));
|
||||||
}
|
}
|
||||||
hwid.insert(4, "-");
|
hwid.insert(4, "-");
|
||||||
@@ -693,10 +697,10 @@ public class MapleClient {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
} finally {
|
} finally {
|
||||||
try {
|
try {
|
||||||
if(ps != null && !ps.isClosed()) {
|
if (ps != null && !ps.isClosed()) {
|
||||||
ps.close();
|
ps.close();
|
||||||
}
|
}
|
||||||
if(con != null && !con.isClosed()) {
|
if (con != null && !con.isClosed()) {
|
||||||
con.close();
|
con.close();
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
@@ -798,7 +802,8 @@ public class MapleClient {
|
|||||||
birthday = Calendar.getInstance();
|
birthday = Calendar.getInstance();
|
||||||
try {
|
try {
|
||||||
birthday.setTime(rs.getDate("birthday"));
|
birthday.setTime(rs.getDate("birthday"));
|
||||||
} catch(SQLException e) {}
|
} catch (SQLException e) {
|
||||||
|
}
|
||||||
|
|
||||||
int state = rs.getInt("loggedin");
|
int state = rs.getInt("loggedin");
|
||||||
if (state == LOGIN_SERVER_TRANSITION) {
|
if (state == LOGIN_SERVER_TRANSITION) {
|
||||||
@@ -873,12 +878,16 @@ public class MapleClient {
|
|||||||
if (eim != null) {
|
if (eim != null) {
|
||||||
eim.playerDisconnected(player);
|
eim.playerDisconnected(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (player.getMonsterCarnival() != null) {
|
||||||
|
player.getMonsterCarnival().playerDisconnected(getPlayer().getId());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player.getMap() != null) {
|
if (player.getMap() != null) {
|
||||||
int mapId = player.getMapId();
|
int mapId = player.getMapId();
|
||||||
player.getMap().removePlayer(player);
|
player.getMap().removePlayer(player);
|
||||||
if(GameConstants.isDojo(mapId)) {
|
if (GameConstants.isDojo(mapId)) {
|
||||||
this.getChannelServer().freeDojoSectionIfEmpty(mapId);
|
this.getChannelServer().freeDojoSectionIfEmpty(mapId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -970,7 +979,9 @@ public class MapleClient {
|
|||||||
FilePrinter.printError(FilePrinter.ACCOUNT_STUCK, e);
|
FilePrinter.printError(FilePrinter.ACCOUNT_STUCK, e);
|
||||||
} finally {
|
} finally {
|
||||||
if (!this.serverTransition) {
|
if (!this.serverTransition) {
|
||||||
if(chrg != null) chrg.setCharacter(null);
|
if (chrg != null) {
|
||||||
|
chrg.setCharacter(null);
|
||||||
|
}
|
||||||
wserv.removePlayer(player);
|
wserv.removePlayer(player);
|
||||||
//getChannelServer().removePlayer(player); already being done
|
//getChannelServer().removePlayer(player); already being done
|
||||||
|
|
||||||
@@ -1043,7 +1054,7 @@ public class MapleClient {
|
|||||||
public boolean deleteCharacter(int cid, int senderAccId) {
|
public boolean deleteCharacter(int cid, int senderAccId) {
|
||||||
try {
|
try {
|
||||||
return MapleCharacter.deleteCharFromDB(MapleCharacter.loadCharFromDB(cid, this, false), senderAccId);
|
return MapleCharacter.deleteCharFromDB(MapleCharacter.loadCharFromDB(cid, this, false), senderAccId);
|
||||||
} catch(SQLException ex) {
|
} catch (SQLException ex) {
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -1156,7 +1167,7 @@ public class MapleClient {
|
|||||||
return disconnectForBeingAFaggot;
|
return disconnectForBeingAFaggot;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getVotePoints(){
|
public int getVotePoints() {
|
||||||
int points = 0;
|
int points = 0;
|
||||||
try {
|
try {
|
||||||
Connection con = DatabaseConnection.getConnection();
|
Connection con = DatabaseConnection.getConnection();
|
||||||
@@ -1183,8 +1194,8 @@ public class MapleClient {
|
|||||||
saveVotePoints();
|
saveVotePoints();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void useVotePoints(int points){
|
public void useVotePoints(int points) {
|
||||||
if (points > votePoints){
|
if (points > votePoints) {
|
||||||
//Should not happen, should probably log this
|
//Should not happen, should probably log this
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1351,7 +1362,7 @@ public class MapleClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void announceDisableServerMessage() {
|
private void announceDisableServerMessage() {
|
||||||
if(!this.getWorldServer().registerDisabledServerMessage(player.getId())) {
|
if (!this.getWorldServer().registerDisabledServerMessage(player.getId())) {
|
||||||
announce(MaplePacketCreator.serverMessage(""));
|
announce(MaplePacketCreator.serverMessage(""));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1364,8 +1375,8 @@ public class MapleClient {
|
|||||||
long timeNow = System.currentTimeMillis();
|
long timeNow = System.currentTimeMillis();
|
||||||
int targetHash = player.getTargetHpBarHash();
|
int targetHash = player.getTargetHpBarHash();
|
||||||
|
|
||||||
if(mobHash != targetHash) {
|
if (mobHash != targetHash) {
|
||||||
if(timeNow - player.getTargetHpBarTime() >= 5 * 1000) {
|
if (timeNow - player.getTargetHpBarTime() >= 5 * 1000) {
|
||||||
// is there a way to INTERRUPT this annoying thread running on the client that drops the boss bar after some time at every attack?
|
// is there a way to INTERRUPT this annoying thread running on the client that drops the boss bar after some time at every attack?
|
||||||
announceDisableServerMessage();
|
announceDisableServerMessage();
|
||||||
announce(packet);
|
announce(packet);
|
||||||
@@ -1399,14 +1410,14 @@ public class MapleClient {
|
|||||||
if (!player.isAlive() || FieldLimit.CANNOTMIGRATE.check(player.getMap().getFieldLimit())) {
|
if (!player.isAlive() || FieldLimit.CANNOTMIGRATE.check(player.getMap().getFieldLimit())) {
|
||||||
announce(MaplePacketCreator.enableActions());
|
announce(MaplePacketCreator.enableActions());
|
||||||
return;
|
return;
|
||||||
} else if(MapleMiniDungeonInfo.isDungeonMap(player.getMapId())) {
|
} else if (MapleMiniDungeonInfo.isDungeonMap(player.getMapId())) {
|
||||||
announce(MaplePacketCreator.serverNotice(5, "Changing channels or entering Cash Shop or MTS are disabled when inside a Mini-Dungeon."));
|
announce(MaplePacketCreator.serverNotice(5, "Changing channels or entering Cash Shop or MTS are disabled when inside a Mini-Dungeon."));
|
||||||
announce(MaplePacketCreator.enableActions());
|
announce(MaplePacketCreator.enableActions());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
String[] socket = Server.getInstance().getInetSocket(getWorld(), channel);
|
String[] socket = Server.getInstance().getInetSocket(getWorld(), channel);
|
||||||
if(socket == null) {
|
if (socket == null) {
|
||||||
announce(MaplePacketCreator.serverNotice(1, "Channel " + channel + " is currently disabled. Try another channel."));
|
announce(MaplePacketCreator.serverNotice(1, "Channel " + channel + " is currently disabled. Try another channel."));
|
||||||
announce(MaplePacketCreator.enableActions());
|
announce(MaplePacketCreator.enableActions());
|
||||||
return;
|
return;
|
||||||
@@ -1458,23 +1469,23 @@ public class MapleClient {
|
|||||||
this.sessionId = sessionId;
|
this.sessionId = sessionId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canRequestCharlist(){
|
public boolean canRequestCharlist() {
|
||||||
return lastNpcClick + 877 < Server.getInstance().getCurrentTime();
|
return lastNpcClick + 877 < Server.getInstance().getCurrentTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canClickNPC(){
|
public boolean canClickNPC() {
|
||||||
return lastNpcClick + 500 < Server.getInstance().getCurrentTime();
|
return lastNpcClick + 500 < Server.getInstance().getCurrentTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setClickedNPC(){
|
public void setClickedNPC() {
|
||||||
lastNpcClick = Server.getInstance().getCurrentTime();
|
lastNpcClick = Server.getInstance().getCurrentTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeClickedNPC(){
|
public void removeClickedNPC() {
|
||||||
lastNpcClick = 0;
|
lastNpcClick = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getVisibleWorlds(){
|
public int getVisibleWorlds() {
|
||||||
return visibleWorlds;
|
return visibleWorlds;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,34 +21,34 @@
|
|||||||
*/
|
*/
|
||||||
package client;
|
package client;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import tools.Randomizer;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public enum MapleDisease {
|
public enum MapleDisease {
|
||||||
NULL(0x0),
|
NULL(0x0),
|
||||||
SLOW(0x1),
|
SLOW(0x1, 126),
|
||||||
SEDUCE(0x80),
|
SEDUCE(0x80, 128),
|
||||||
FISHABLE(0x100),
|
FISHABLE(0x100),
|
||||||
ZOMBIFY(0x4000),
|
ZOMBIFY(0x4000),
|
||||||
CONFUSE(0x80000),
|
CONFUSE(0x80000),
|
||||||
STUN(0x2000000000000L),
|
STUN(0x2000000000000L, 123),
|
||||||
POISON(0x4000000000000L),
|
POISON(0x4000000000000L, 125),
|
||||||
SEAL(0x8000000000000L),
|
SEAL(0x8000000000000L, 120),
|
||||||
DARKNESS(0x10000000000000L),
|
DARKNESS(0x10000000000000L, 121),
|
||||||
WEAKEN(0x4000000000000000L),
|
WEAKEN(0x4000000000000000L, 122),
|
||||||
CURSE(0x8000000000000000L);
|
CURSE(0x8000000000000000L, 124);
|
||||||
|
|
||||||
private long i;
|
private long i;
|
||||||
private boolean first;
|
private boolean first;
|
||||||
|
private int disease;
|
||||||
|
|
||||||
private MapleDisease(long i) {
|
private MapleDisease(long i) {
|
||||||
this.i = i;
|
this.i = i;
|
||||||
this.first = false;
|
this.first = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private MapleDisease(long i, boolean first) {
|
private MapleDisease(long i, int disease) {
|
||||||
this.i = i;
|
this.i = i;
|
||||||
this.first = first;
|
this.disease = disease;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getValue() {
|
public long getValue() {
|
||||||
@@ -59,6 +59,10 @@ public enum MapleDisease {
|
|||||||
return first;
|
return first;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getDisease() {
|
||||||
|
return disease;
|
||||||
|
}
|
||||||
|
|
||||||
public static MapleDisease ordinal(int ord) {
|
public static MapleDisease ordinal(int ord) {
|
||||||
try {
|
try {
|
||||||
return MapleDisease.values()[ord];
|
return MapleDisease.values()[ord];
|
||||||
@@ -66,4 +70,24 @@ public enum MapleDisease {
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final MapleDisease getRandom() {
|
||||||
|
while (true) {
|
||||||
|
for (MapleDisease dis : MapleDisease.values()) {
|
||||||
|
if (Randomizer.nextInt(MapleDisease.values().length) == 0) {
|
||||||
|
return dis;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final MapleDisease getBySkill(final int skill) {
|
||||||
|
for (MapleDisease d : MapleDisease.values()) {
|
||||||
|
if (d.getDisease() == skill && d.getDisease() != 0) {
|
||||||
|
return d;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -39,6 +39,7 @@ import tools.MaplePacketCreator;
|
|||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import tools.packets.Wedding;
|
||||||
|
|
||||||
public class DebugCommand extends Command {
|
public class DebugCommand extends Command {
|
||||||
private final static String debugTypes[] = {"monster", "packet", "portal", "spawnpoint", "pos", "map", "mobsp", "event", "areas", "reactors", "servercoupons", "playercoupons", "timer", "marriage", ""};
|
private final static String debugTypes[] = {"monster", "packet", "portal", "spawnpoint", "pos", "map", "mobsp", "event", "areas", "reactors", "servercoupons", "playercoupons", "timer", "marriage", ""};
|
||||||
|
|||||||
@@ -0,0 +1,74 @@
|
|||||||
|
/*
|
||||||
|
* To change this license header, choose License Headers in Project Properties.
|
||||||
|
* To change this template file, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package constants;
|
||||||
|
|
||||||
|
import client.MapleCharacter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Drago
|
||||||
|
*/
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -33,7 +33,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_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 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 = true; //Automatically register players when they login with a nonexistent username.
|
public static final boolean AUTOMATIC_REGISTER = false; //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 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 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.
|
public static final boolean DETERRED_MULTICLIENT = false; //Enables multi-client and suspicious remote IP detection on the login system.
|
||||||
@@ -58,7 +58,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_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 = 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 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 = false; //Prints on the cmd all received packet ids.
|
public static boolean USE_DEBUG_SHOW_RCVD_PACKET = true; //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_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.
|
public static boolean USE_SUPPLY_RATE_COUPONS = true; //Allows rate coupons to be sold through the Cash Shop.
|
||||||
|
|
||||||
|
|||||||
@@ -1,23 +1,23 @@
|
|||||||
/*
|
/*
|
||||||
This file is part of the OdinMS Maple Story Server
|
This file is part of the OdinMS Maple Story Server
|
||||||
Copyright (C) 2008 Patrick Huy <[email protected]>
|
Copyright (C) 2008 Patrick Huy <[email protected]>
|
||||||
Matthias Butz <[email protected]>
|
Matthias Butz <[email protected]>
|
||||||
Jan Christian Meyer <[email protected]>
|
Jan Christian Meyer <[email protected]>
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU Affero General Public License as
|
it under the terms of the GNU Affero General Public License as
|
||||||
published by the Free Software Foundation version 3 as published by
|
published by the Free Software Foundation version 3 as published by
|
||||||
the Free Software Foundation. You may not use, modify or distribute
|
the Free Software Foundation. You may not use, modify or distribute
|
||||||
this program under any other version of the GNU Affero General Public
|
this program under any other version of the GNU Affero General Public
|
||||||
License.
|
License.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU Affero General Public License for more details.
|
GNU Affero General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Affero General Public License
|
You should have received a copy of the GNU Affero General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package net.server.channel.handlers;
|
package net.server.channel.handlers;
|
||||||
|
|
||||||
@@ -44,7 +44,7 @@ public final class ChangeMapHandler extends AbstractMaplePacketHandler {
|
|||||||
MapleCharacter chr = c.getPlayer();
|
MapleCharacter chr = c.getPlayer();
|
||||||
|
|
||||||
if (chr.isChangingMaps() || chr.isBanned()) {
|
if (chr.isChangingMaps() || chr.isBanned()) {
|
||||||
if(chr.isChangingMaps()) {
|
if (chr.isChangingMaps()) {
|
||||||
FilePrinter.printError(FilePrinter.PORTAL_STUCK + chr.getName() + ".txt", "Player " + chr.getName() + " got stuck when changing maps. Timestamp: " + Calendar.getInstance().getTime().toString() + " Last visited mapids: " + chr.getLastVisitedMapids());
|
FilePrinter.printError(FilePrinter.PORTAL_STUCK + chr.getName() + ".txt", "Player " + chr.getName() + " got stuck when changing maps. Timestamp: " + Calendar.getInstance().getTime().toString() + " Last visited mapids: " + chr.getLastVisitedMapids());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -55,7 +55,7 @@ public final class ChangeMapHandler extends AbstractMaplePacketHandler {
|
|||||||
MapleTrade.cancelTrade(chr);
|
MapleTrade.cancelTrade(chr);
|
||||||
}
|
}
|
||||||
if (slea.available() == 0) { //Cash Shop :)
|
if (slea.available() == 0) { //Cash Shop :)
|
||||||
if(!chr.getCashShop().isOpened()) {
|
if (!chr.getCashShop().isOpened()) {
|
||||||
c.disconnect(false, false);
|
c.disconnect(false, false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -68,7 +68,7 @@ public final class ChangeMapHandler extends AbstractMaplePacketHandler {
|
|||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(chr.getCashShop().isOpened()) {
|
if (chr.getCashShop().isOpened()) {
|
||||||
c.disconnect(false, false);
|
c.disconnect(false, false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -99,11 +99,10 @@ public final class ChangeMapHandler extends AbstractMaplePacketHandler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (targetid != -1) {
|
} else if (targetid != -1) {
|
||||||
if(chr.isGM()) {
|
if (chr.isGM()) {
|
||||||
MapleMap to = chr.getWarpMap(targetid);
|
MapleMap to = chr.getWarpMap(targetid);
|
||||||
chr.changeMap(to, to.getPortal(0));
|
chr.changeMap(to, to.getPortal(0));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
final int divi = chr.getMapId() / 100;
|
final int divi = chr.getMapId() / 100;
|
||||||
boolean warp = false;
|
boolean warp = false;
|
||||||
if (divi == 0) {
|
if (divi == 0) {
|
||||||
@@ -128,8 +127,8 @@ public final class ChangeMapHandler extends AbstractMaplePacketHandler {
|
|||||||
if (targetid == 1020000) {
|
if (targetid == 1020000) {
|
||||||
warp = true;
|
warp = true;
|
||||||
}
|
}
|
||||||
} else if(divi / 10 >= 980040 && divi / 10 <= 980045) {
|
} else if (divi / 10 >= 980040 && divi / 10 <= 980045) {
|
||||||
if(targetid == 980040000) {
|
if (targetid == 980040000) {
|
||||||
warp = true;
|
warp = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -152,7 +151,7 @@ public final class ChangeMapHandler extends AbstractMaplePacketHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (portal != null) {
|
if (portal != null) {
|
||||||
if(portal.getPosition().distanceSq(chr.getPosition()) > 400000) {
|
if (portal.getPosition().distanceSq(chr.getPosition()) > 400000) {
|
||||||
c.announce(MaplePacketCreator.enableActions());
|
c.announce(MaplePacketCreator.enableActions());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,206 +18,137 @@
|
|||||||
|
|
||||||
You should have received a copy of the GNU Affero General Public License
|
You should have received a copy of the GNU Affero General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package net.server.channel.handlers;
|
package net.server.channel.handlers;
|
||||||
|
|
||||||
import client.MapleCharacter;
|
import client.MapleCharacter;
|
||||||
import client.MapleClient;
|
import client.MapleClient;
|
||||||
|
import client.MapleDisease;
|
||||||
import java.awt.Point;
|
import java.awt.Point;
|
||||||
|
import java.util.List;
|
||||||
import net.AbstractMaplePacketHandler;
|
import net.AbstractMaplePacketHandler;
|
||||||
import server.partyquest.MonsterCarnival;
|
import net.server.world.MapleParty;
|
||||||
|
import net.server.world.MaplePartyCharacter;
|
||||||
import server.life.MapleLifeFactory;
|
import server.life.MapleLifeFactory;
|
||||||
import server.maps.MapleReactor;
|
import server.life.MapleMonster;
|
||||||
import server.maps.MapleReactorFactory;
|
import server.partyquest.MapleCarnivalFactory;
|
||||||
|
import server.partyquest.MapleCarnivalFactory.MCSkill;
|
||||||
import tools.MaplePacketCreator;
|
import tools.MaplePacketCreator;
|
||||||
|
import tools.Pair;
|
||||||
import tools.data.input.SeekableLittleEndianAccessor;
|
import tools.data.input.SeekableLittleEndianAccessor;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*@author Drago/Dragohe4rt
|
||||||
* @author kevintjuh93
|
*/
|
||||||
*/
|
|
||||||
public final class MonsterCarnivalHandler extends AbstractMaplePacketHandler{
|
public final class MonsterCarnivalHandler extends AbstractMaplePacketHandler {
|
||||||
|
|
||||||
|
@Override
|
||||||
public void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) {
|
public void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) {
|
||||||
MapleCharacter chr = c.getPlayer();
|
try {
|
||||||
MonsterCarnival carnival = chr.getCarnival();
|
|
||||||
int tab = slea.readByte();
|
int tab = slea.readByte();
|
||||||
int number = slea.readShort();
|
int num = slea.readByte();
|
||||||
if (carnival != null) {
|
int neededCP = 0;
|
||||||
if (chr.getCarnivalParty() != carnival.getPartyRed() || chr.getCarnivalParty() != carnival.getPartyBlue()) {
|
|
||||||
chr.getMap().broadcastMessage(MaplePacketCreator.leaveCPQ(chr));
|
|
||||||
chr.changeMap(980000010);
|
|
||||||
}
|
|
||||||
if (chr.getCP() > getPrice(tab, number)) {
|
|
||||||
if (tab == 0) { //SPAWNING
|
|
||||||
if (chr.getCarnivalParty().canSummon()) {
|
|
||||||
chr.getMap().spawnCPQMonster(MapleLifeFactory.getMonster(getMonster(number)), new Point(1, 1), carnival.oppositeTeam(chr.getCarnivalParty()).getTeam());
|
|
||||||
chr.getCarnivalParty().summon();
|
|
||||||
} else
|
|
||||||
chr.announce(MaplePacketCreator.CPQMessage((byte) 2));
|
|
||||||
|
|
||||||
} else if (tab == 1) {
|
|
||||||
|
|
||||||
} else if (tab == 2) {
|
|
||||||
int rid = 9980000 + chr.getTeam();
|
|
||||||
MapleReactor reactor = new MapleReactor(MapleReactorFactory.getReactor(rid), rid);
|
|
||||||
/*switch (number) {
|
|
||||||
case 0:
|
|
||||||
reactor.setMonsterStatus(tab, MonsterStatus.WEAPON_ATTACK_UP, MobSkillFactory.getMobSkill(150, 1));
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
reactor.setMonsterStatus(tab, MonsterStatus.WEAPON_DEFENSE_UP, MobSkillFactory.getMobSkill(151, 1));
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
reactor.setMonsterStatus(tab, MonsterStatus.MAGIC_ATTACK_UP, MobSkillFactory.getMobSkill(152, 1));
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
reactor.setMonsterStatus(tab, MonsterStatus.MAGIC_DEFENSE_UP, MobSkillFactory.getMobSkill(153, 1));
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
reactor.setMonsterStatus(tab, MonsterStatus.ACC, MobSkillFactory.getMobSkill(154, 1));
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
reactor.setMonsterStatus(tab, MonsterStatus.AVOID, MobSkillFactory.getMobSkill(155, 1));
|
|
||||||
break;
|
|
||||||
case 6:
|
|
||||||
reactor.setMonsterStatus(tab, MonsterStatus.SPEED, MobSkillFactory.getMobSkill(156, 1));
|
|
||||||
break;
|
|
||||||
case 7:
|
|
||||||
reactor.setMonsterStatus(tab, MonsterStatus.WEAPON_IMMUNITY, MobSkillFactory.getMobSkill(140, 1));
|
|
||||||
break;
|
|
||||||
case 8:
|
|
||||||
reactor.setMonsterStatus(tab, MonsterStatus.MAGIC_IMMUNITY, MobSkillFactory.getMobSkill(141, 1));
|
|
||||||
break;
|
|
||||||
} */
|
|
||||||
chr.getMap().spawnReactor(reactor);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
chr.getMap().broadcastMessage(MaplePacketCreator.CPQMessage((byte) 1));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
chr.announce(MaplePacketCreator.CPQMessage((byte) 5));
|
|
||||||
}
|
|
||||||
chr.announce(MaplePacketCreator.enableActions());
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getMonster(int num) {
|
|
||||||
int mid = 0;
|
|
||||||
num++;
|
|
||||||
switch (num) {
|
|
||||||
case 1:
|
|
||||||
mid = 9300127;
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
mid = 9300128;
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
mid = 9300129;
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
mid = 9300130;
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
mid = 9300131;
|
|
||||||
break;
|
|
||||||
case 6:
|
|
||||||
mid = 9300132;
|
|
||||||
break;
|
|
||||||
case 7:
|
|
||||||
mid = 9300133;
|
|
||||||
break;
|
|
||||||
case 8:
|
|
||||||
mid = 9300134;
|
|
||||||
break;
|
|
||||||
case 9:
|
|
||||||
mid = 9300135;
|
|
||||||
break;
|
|
||||||
case 10:
|
|
||||||
mid = 9300136;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return mid;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getPrice(int num, int tab) {
|
|
||||||
int price = 0;
|
|
||||||
num++;
|
|
||||||
|
|
||||||
if (tab == 0) {
|
if (tab == 0) {
|
||||||
switch (num) {
|
final List<Pair<Integer, Integer>> mobs = c.getPlayer().getMap().getMobsToSpawn();
|
||||||
case 1:
|
if (num >= mobs.size() || c.getPlayer().getCP() < mobs.get(num).right) {
|
||||||
case 2:
|
c.announce(MaplePacketCreator.CPQMessage((byte) 1));
|
||||||
price = 7;
|
c.getSession().write(MaplePacketCreator.enableActions());
|
||||||
break;
|
return;
|
||||||
case 3:
|
}
|
||||||
case 4:
|
|
||||||
price = 8;
|
final MapleMonster mob = MapleLifeFactory.getMonster(mobs.get(num).left);
|
||||||
break;
|
if (c.getPlayer().getMonsterCarnival() != null) {
|
||||||
case 5:
|
Point spawnPos = c.getPlayer().getMap().getRandomSP(c.getPlayer().getTeam());
|
||||||
case 6:
|
if (!c.getPlayer().getMonsterCarnival().canSummon() && c.getPlayer().getTeam() == 0 || !c.getPlayer().getMonsterCarnival().canSummons() && c.getPlayer().getTeam() == 1) {
|
||||||
price = 9;
|
c.announce(MaplePacketCreator.CPQMessage((byte) 2));
|
||||||
break;
|
c.getSession().write(MaplePacketCreator.enableActions());
|
||||||
case 7:
|
return;
|
||||||
price = 10;
|
}
|
||||||
break;
|
mob.setPosition(spawnPos);
|
||||||
case 8:
|
if (c.getPlayer().getTeam() == 0) {
|
||||||
price = 11;
|
c.getPlayer().getMonsterCarnival().summon();
|
||||||
break;
|
} else {
|
||||||
case 9:
|
c.getPlayer().getMonsterCarnival().summons();
|
||||||
price = 12;
|
}
|
||||||
break;
|
c.getPlayer().getMap().addMonsterSpawn(mob, 1, c.getPlayer().getTeam());
|
||||||
case 10:
|
c.getSession().write(MaplePacketCreator.enableActions());
|
||||||
price = 30;
|
}
|
||||||
|
neededCP = mobs.get(num).right;
|
||||||
|
} else if (tab == 1) { //debuffs
|
||||||
|
final List<Integer> skillid = c.getPlayer().getMap().getSkillIds();
|
||||||
|
if (num >= skillid.size()) {
|
||||||
|
c.getPlayer().dropMessage(5, "Ocorreu um erro.");
|
||||||
|
c.getSession().write(MaplePacketCreator.enableActions());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
final MCSkill skil = MapleCarnivalFactory.getInstance().getSkill(skillid.get(num)); //ugh wtf
|
||||||
|
if (skil == null || c.getPlayer().getCP() < skil.cpLoss) {
|
||||||
|
c.announce(MaplePacketCreator.CPQMessage((byte) 1));
|
||||||
|
c.getSession().write(MaplePacketCreator.enableActions());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
final MapleDisease dis = skil.getDisease();
|
||||||
|
MapleParty inimigos = c.getPlayer().getParty().getEnemy();
|
||||||
|
if (skil.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()) {
|
||||||
|
if (dis == null) {
|
||||||
|
chrS.getPlayer().dispel();
|
||||||
|
} else {
|
||||||
|
chrS.getPlayer().giveDebuff(dis, skil.getSkill());
|
||||||
|
}
|
||||||
|
if (!skil.targetsAll) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else if (tab == 1) {
|
}
|
||||||
switch (num) {
|
|
||||||
case 1:
|
|
||||||
price = 17;
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
case 4:
|
|
||||||
price = 19;
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
price = 12;
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
price = 16;
|
|
||||||
break;
|
|
||||||
case 6:
|
|
||||||
price = 14;
|
|
||||||
break;
|
|
||||||
case 7:
|
|
||||||
price = 22;
|
|
||||||
break;
|
|
||||||
case 8:
|
|
||||||
price = 18;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
switch (num) {
|
int amount = inimigos.getMembers().size() - 1;
|
||||||
case 1:
|
int randd = (int) Math.floor(Math.random() * amount);
|
||||||
case 3:
|
MapleCharacter chrApp = c.getChannelServer().getPlayerStorage().getCharacterById(inimigos.getMemberByPos(randd).getId());
|
||||||
price = 17;
|
if (chrApp != null && chrApp.getMap().isCPQMap()) {
|
||||||
break;
|
if (dis == null) {
|
||||||
case 2:
|
chrApp.dispel();
|
||||||
case 4:
|
} else {
|
||||||
case 6:
|
chrApp.giveDebuff(dis, skil.getSkill());
|
||||||
price = 16;
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
price = 13;
|
|
||||||
break;
|
|
||||||
case 7:
|
|
||||||
price = 12;
|
|
||||||
break;
|
|
||||||
case 8:
|
|
||||||
case 9:
|
|
||||||
price = 35;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return price;
|
|
||||||
}
|
}
|
||||||
}
|
neededCP = skil.cpLoss;
|
||||||
|
c.getSession().write(MaplePacketCreator.enableActions());
|
||||||
|
} else if (tab == 2) { //protectors
|
||||||
|
final MCSkill skil = MapleCarnivalFactory.getInstance().getGuardian(num);
|
||||||
|
if (skil == null || c.getPlayer().getCP() < skil.cpLoss) {
|
||||||
|
c.announce(MaplePacketCreator.CPQMessage((byte) 1));
|
||||||
|
c.getSession().write(MaplePacketCreator.enableActions());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int success = c.getPlayer().getMap().spawnGuardian(c.getPlayer().getTeam(), num);
|
||||||
|
if (success == -1 || success == 0 || success == 2) {
|
||||||
|
if (success == -1) {
|
||||||
|
c.announce(MaplePacketCreator.CPQMessage((byte) 3));
|
||||||
|
} else if (success == 0) {
|
||||||
|
c.announce(MaplePacketCreator.CPQMessage((byte) 4));
|
||||||
|
} else if (success == 2) {
|
||||||
|
c.announce(MaplePacketCreator.CPQMessage((byte) 3));
|
||||||
|
}
|
||||||
|
c.getSession().write(MaplePacketCreator.enableActions());
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
neededCP = skil.cpLoss;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
c.getPlayer().gainCP(-neededCP);
|
||||||
|
c.getPlayer().getMap().broadcastMessage(MaplePacketCreator.playerSummoned(c.getPlayer().getName(), tab, num));
|
||||||
|
}catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -21,8 +21,6 @@
|
|||||||
*/
|
*/
|
||||||
package net.server.channel.handlers;
|
package net.server.channel.handlers;
|
||||||
|
|
||||||
//import java.sql.Connection;
|
|
||||||
//import java.sql.PreparedStatement;
|
|
||||||
import client.MapleClient;
|
import client.MapleClient;
|
||||||
import client.MapleCharacter;
|
import client.MapleCharacter;
|
||||||
import client.inventory.MapleInventoryType;
|
import client.inventory.MapleInventoryType;
|
||||||
@@ -31,14 +29,10 @@ import java.sql.Connection;
|
|||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
//import tools.DatabaseConnection;
|
|
||||||
import net.AbstractMaplePacketHandler;
|
import net.AbstractMaplePacketHandler;
|
||||||
import client.inventory.manipulator.MapleInventoryManipulator;
|
import client.inventory.manipulator.MapleInventoryManipulator;
|
||||||
import tools.DatabaseConnection;
|
import tools.DatabaseConnection;
|
||||||
import tools.data.input.SeekableLittleEndianAccessor;
|
import tools.data.input.SeekableLittleEndianAccessor;
|
||||||
//import scripting.npc.NPCScriptManager;
|
|
||||||
import tools.Pair;
|
import tools.Pair;
|
||||||
import tools.MaplePacketCreator;
|
import tools.MaplePacketCreator;
|
||||||
import tools.packets.Wedding;
|
import tools.packets.Wedding;
|
||||||
@@ -52,6 +46,7 @@ import client.inventory.Item;
|
|||||||
/**
|
/**
|
||||||
* @author Jvlaple
|
* @author Jvlaple
|
||||||
* @author Ronan - major overhaul on Ring handling mechanics
|
* @author Ronan - major overhaul on Ring handling mechanics
|
||||||
|
* @author Drago/Dragohe4rt on Wishlist
|
||||||
*/
|
*/
|
||||||
public final class RingActionHandler extends AbstractMaplePacketHandler {
|
public final class RingActionHandler extends AbstractMaplePacketHandler {
|
||||||
private static int getBoxId(int useItemId) {
|
private static int getBoxId(int useItemId) {
|
||||||
@@ -467,11 +462,16 @@ public final class RingActionHandler extends AbstractMaplePacketHandler {
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 9: // Groom and Bride's Wishlist
|
case 9:
|
||||||
short size = slea.readShort();
|
// By Drago/Dragohe4rt
|
||||||
List<String> itemnames = new ArrayList<>(size);
|
// Groom and Bride's Wishlist
|
||||||
for (int i = 0; i < size; i++) {
|
//short size = slea.readShort();
|
||||||
itemnames.add(slea.readMapleAsciiString());
|
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);
|
//System.out.println("G&B WISHLIST: " + itemnames);
|
||||||
|
|||||||
@@ -10,84 +10,61 @@ import client.inventory.Item;
|
|||||||
import client.inventory.MapleInventoryType;
|
import client.inventory.MapleInventoryType;
|
||||||
import client.MapleCharacter;
|
import client.MapleCharacter;
|
||||||
import client.MapleClient;
|
import client.MapleClient;
|
||||||
|
import client.inventory.Equip;
|
||||||
import constants.ItemConstants;
|
import constants.ItemConstants;
|
||||||
import tools.DatabaseConnection;
|
|
||||||
import java.sql.Connection;
|
|
||||||
import java.sql.PreparedStatement;
|
|
||||||
import java.sql.ResultSet;
|
|
||||||
import java.sql.SQLException;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import net.AbstractMaplePacketHandler;
|
import net.AbstractMaplePacketHandler;
|
||||||
import client.inventory.manipulator.MapleInventoryManipulator;
|
import client.inventory.manipulator.MapleInventoryManipulator;
|
||||||
|
import net.server.channel.Channel;
|
||||||
|
import scripting.event.EventInstanceManager;
|
||||||
import tools.MaplePacketCreator;
|
import tools.MaplePacketCreator;
|
||||||
import tools.data.input.SeekableLittleEndianAccessor;
|
import tools.data.input.SeekableLittleEndianAccessor;
|
||||||
import tools.packets.Wedding;
|
import tools.packets.Wedding;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Eric
|
* @author By Drago/Dragohe4rt
|
||||||
*/
|
*/
|
||||||
public final class WeddingHandler extends AbstractMaplePacketHandler {
|
public final class WeddingHandler extends AbstractMaplePacketHandler {
|
||||||
/*
|
|
||||||
public static final void OnWeddingProgress(byte action, MapleClient c) {
|
|
||||||
// -- Pelvis Bebop:
|
|
||||||
// 0x00: "We are gathered here today..."
|
|
||||||
// 0x01: "Very well! I pronounce you..."
|
|
||||||
// 0x02: "You two truly are a sight to..."
|
|
||||||
// 0x03: Wedding Ceremony Ended, initialize the Wedding Effect upon the two married characters
|
|
||||||
// -- High Priest John: (Unknown action bytes)
|
|
||||||
// 0x00: " "
|
|
||||||
// 0x01: " "
|
|
||||||
// 0x02: "Do you wish to bless this couple?..."
|
|
||||||
// 0x03: Wedding Ceremony Ended, initialize the Wedding Effect upon the two married characters
|
|
||||||
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().getMap().broadcastMessage(Wedding.OnWeddingProgress(action == 2, c.getPlayer().getId(), c.getPlayer().getPartnerId(), (byte)(action+1)));
|
|
||||||
c.getPlayer().getWedding().incrementStage();
|
|
||||||
c.getPlayer().getPartner().getWedding().incrementStage(); // pls don't b a bitch and throw npe ):<
|
|
||||||
if (action == 2) {
|
|
||||||
c.getPlayer().setMarried(true);
|
|
||||||
c.getChannelServer().getPlayerStorage().getCharacterById(c.getPlayer().getPartnerId()).setMarried(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
c.announce(MaplePacketCreator.enableActions());
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final void OnWeddingGiftResult(SeekableLittleEndianAccessor slea, MapleClient c) {
|
|
||||||
System.out.println("New WEDDING_GIFT_RESULT: " + slea.toString());
|
|
||||||
byte mode = slea.readByte();
|
|
||||||
switch(mode) {
|
|
||||||
case 0x06: // "SEND ITEM"
|
|
||||||
short slot = slea.readShort(); // isn't this a byte? o.O
|
|
||||||
int itemId = slea.readInt();
|
|
||||||
short quantity = slea.readShort();
|
|
||||||
if (c.getPlayer().getInventory(ItemConstants.getInventoryType(itemId)).getItem((byte)slot).getItemId() == itemId && c.getPlayer().getInventory(InventoryConstants.getInventoryType(itemId)).getItem((byte)slot).getQuantity() >= quantity) {
|
|
||||||
if (c.getPlayer().getWedding() == null) {
|
|
||||||
c.getPlayer().startWedding(); // TODO
|
|
||||||
}
|
|
||||||
List<String> itemnames = new ArrayList<>();
|
|
||||||
Item item = c.getPlayer().getInventory(ItemConstants.getInventoryType(itemId)).getItem((byte)slot);
|
|
||||||
boolean bride = false;
|
|
||||||
c.getPlayer().getWedding().registerWishlistItem(item, bride);
|
|
||||||
c.announce(Wedding.OnWeddingGiftResult((byte)11, itemnames, c.getPlayer().getWedding().getWishlistItems(bride))); // todo: remove item from inventory if success
|
|
||||||
}
|
|
||||||
case 0x08: // "EXIT"
|
|
||||||
if (slea.available() != 0) {
|
|
||||||
System.out.println("WEDDING_GIFT_RESULT: " + slea.toString());
|
|
||||||
}
|
|
||||||
c.announce(MaplePacketCreator.enableActions());
|
|
||||||
break;
|
|
||||||
default: {
|
|
||||||
System.out.println("Unknown Mode Found: " + mode + " : " + slea.toString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) {
|
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.announce(MaplePacketCreator.enableActions());
|
c.announce(MaplePacketCreator.enableActions());
|
||||||
|
} else {
|
||||||
|
System.out.println(mode);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
You should have received a copy of the GNU Affero General Public License
|
You should have received a copy of the GNU Affero General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package net.server.world;
|
package net.server.world;
|
||||||
|
|
||||||
import client.MapleClient;
|
import client.MapleClient;
|
||||||
@@ -37,8 +37,9 @@ import net.server.audit.locks.factory.MonitoredReentrantLockFactory;
|
|||||||
import server.maps.MapleDoor;
|
import server.maps.MapleDoor;
|
||||||
|
|
||||||
public class MapleParty {
|
public class MapleParty {
|
||||||
private int id;
|
|
||||||
|
|
||||||
|
private int id;
|
||||||
|
private MapleParty enemy = null;
|
||||||
private int leaderId;
|
private int leaderId;
|
||||||
private List<MaplePartyCharacter> members = new LinkedList<>();
|
private List<MaplePartyCharacter> members = new LinkedList<>();
|
||||||
private List<MaplePartyCharacter> pqMembers = null;
|
private List<MaplePartyCharacter> pqMembers = null;
|
||||||
@@ -160,8 +161,8 @@ public class MapleParty {
|
|||||||
public MaplePartyCharacter getLeader() {
|
public MaplePartyCharacter getLeader() {
|
||||||
lock.lock();
|
lock.lock();
|
||||||
try {
|
try {
|
||||||
for(MaplePartyCharacter mpc: members) {
|
for (MaplePartyCharacter mpc : members) {
|
||||||
if(mpc.getId() == leaderId) {
|
if (mpc.getId() == leaderId) {
|
||||||
return mpc;
|
return mpc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -172,6 +173,14 @@ public class MapleParty {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public MapleParty getEnemy() {
|
||||||
|
return enemy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEnemy(MapleParty enemy) {
|
||||||
|
this.enemy = enemy;
|
||||||
|
}
|
||||||
|
|
||||||
public List<Integer> getMembersSortedByHistory() {
|
public List<Integer> getMembersSortedByHistory() {
|
||||||
List<Entry<Integer, Integer>> histList;
|
List<Entry<Integer, Integer>> histList;
|
||||||
|
|
||||||
@@ -182,17 +191,15 @@ public class MapleParty {
|
|||||||
lock.unlock();
|
lock.unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
Collections.sort(histList, new Comparator<Entry<Integer, Integer>>()
|
Collections.sort(histList, new Comparator<Entry<Integer, Integer>>() {
|
||||||
{
|
|
||||||
@Override
|
@Override
|
||||||
public int compare( Entry<Integer, Integer> o1, Entry<Integer, Integer> o2 )
|
public int compare(Entry<Integer, Integer> o1, Entry<Integer, Integer> o2) {
|
||||||
{
|
return (o1.getValue()).compareTo(o2.getValue());
|
||||||
return ( o1.getValue() ).compareTo( o2.getValue() );
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
List<Integer> histSort = new LinkedList<>();
|
List<Integer> histSort = new LinkedList<>();
|
||||||
for(Entry<Integer, Integer> e : histList) {
|
for (Entry<Integer, Integer> e : histList) {
|
||||||
histSort.add(e.getKey());
|
histSort.add(e.getKey());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -202,8 +209,10 @@ public class MapleParty {
|
|||||||
public byte getPartyDoor(int cid) {
|
public byte getPartyDoor(int cid) {
|
||||||
List<Integer> histList = getMembersSortedByHistory();
|
List<Integer> histList = getMembersSortedByHistory();
|
||||||
byte slot = 0;
|
byte slot = 0;
|
||||||
for(Integer e: histList) {
|
for (Integer e : histList) {
|
||||||
if(e == cid) break;
|
if (e == cid) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
slot++;
|
slot++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -243,8 +252,8 @@ public class MapleParty {
|
|||||||
|
|
||||||
lock.lock();
|
lock.lock();
|
||||||
try {
|
try {
|
||||||
for(MaplePartyCharacter mpc : members) {
|
for (MaplePartyCharacter mpc : members) {
|
||||||
if(mpc.getId() != leaderId && (newLeadr == null || newLeadr.getLevel() < mpc.getLevel())) {
|
if (mpc.getId() != leaderId && (newLeadr == null || newLeadr.getLevel() < mpc.getLevel())) {
|
||||||
newLeadr = mpc;
|
newLeadr = mpc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -252,7 +261,9 @@ public class MapleParty {
|
|||||||
lock.unlock();
|
lock.unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(newLeadr != null) world.updateParty(this.getId(), PartyOperation.CHANGE_LEADER, newLeadr);
|
if (newLeadr != null) {
|
||||||
|
world.updateParty(this.getId(), PartyOperation.CHANGE_LEADER, newLeadr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void disposeLocks() {
|
public void disposeLocks() {
|
||||||
@@ -276,6 +287,17 @@ public class MapleParty {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public MaplePartyCharacter getMemberByPos(int pos) {
|
||||||
|
int i = 0;
|
||||||
|
for (MaplePartyCharacter chr : members) {
|
||||||
|
if (pos == i) {
|
||||||
|
return chr;
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if (this == obj) {
|
if (this == obj) {
|
||||||
|
|||||||
@@ -141,4 +141,100 @@ public class MaplePartyCharacter {
|
|||||||
public int getWorld() {
|
public int getWorld() {
|
||||||
return world;
|
return world;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getJobNameById(int job) {
|
||||||
|
switch (job) {
|
||||||
|
case 0:
|
||||||
|
return "Aprendiz";
|
||||||
|
case 100:
|
||||||
|
return "Guerreiro";// Warrior
|
||||||
|
case 110:
|
||||||
|
return "Soldado";
|
||||||
|
case 111:
|
||||||
|
return "Templario";
|
||||||
|
case 112:
|
||||||
|
return "Heroi";
|
||||||
|
case 120:
|
||||||
|
return "Escudeiro";
|
||||||
|
case 121:
|
||||||
|
return "Cavaleiro Branco";
|
||||||
|
case 122:
|
||||||
|
return "Paladino";
|
||||||
|
case 130:
|
||||||
|
return "Lanceiro";
|
||||||
|
case 131:
|
||||||
|
return "Cavaleiro Draconiano";
|
||||||
|
case 132:
|
||||||
|
return "Cavaleiro Negro";
|
||||||
|
|
||||||
|
case 200:
|
||||||
|
return "Bruxo";
|
||||||
|
case 210:
|
||||||
|
return "Feiticeiro (Fogo, Veneno)";
|
||||||
|
case 211:
|
||||||
|
return "Mago (Fogo, Veneno)";
|
||||||
|
case 212:
|
||||||
|
return "Arquimago (Fogo, Veneno)";
|
||||||
|
case 220:
|
||||||
|
return "Feiticeiro (Gelo, Raio)";
|
||||||
|
case 221:
|
||||||
|
return "Mago (Gelo, Raio)";
|
||||||
|
case 222:
|
||||||
|
return "Arquimago (Gelo, Raio)";
|
||||||
|
case 230:
|
||||||
|
return "Clérigo";
|
||||||
|
case 231:
|
||||||
|
return "Sacerdote";
|
||||||
|
case 232:
|
||||||
|
return "Sumo Sacerdote";
|
||||||
|
|
||||||
|
case 300:
|
||||||
|
return "Arqueiro";
|
||||||
|
case 310:
|
||||||
|
return "Caçador";
|
||||||
|
case 311:
|
||||||
|
return "Rastreador";
|
||||||
|
case 312:
|
||||||
|
return "Mestre Arqueiro";
|
||||||
|
case 320:
|
||||||
|
return "Balestreiro";
|
||||||
|
case 321:
|
||||||
|
return "Atirador";
|
||||||
|
case 322:
|
||||||
|
return "Atirador De Elite";
|
||||||
|
|
||||||
|
case 400:
|
||||||
|
return "Gatuno";
|
||||||
|
case 410:
|
||||||
|
return "Mercenario";
|
||||||
|
case 411:
|
||||||
|
return "Andarilho";
|
||||||
|
case 412:
|
||||||
|
return "Lorde Negro";
|
||||||
|
case 420:
|
||||||
|
return "Arruaceiro";
|
||||||
|
case 421:
|
||||||
|
return "Mestre Arruaceiro";
|
||||||
|
case 422:
|
||||||
|
return "Mestre Das Sombras";
|
||||||
|
|
||||||
|
case 500:
|
||||||
|
return "Pirata";
|
||||||
|
case 510:
|
||||||
|
return "Lutador";
|
||||||
|
case 511:
|
||||||
|
return "Saqueador";
|
||||||
|
case 512:
|
||||||
|
return "Foragido";
|
||||||
|
case 520:
|
||||||
|
return "Pistoleiro";
|
||||||
|
case 521:
|
||||||
|
return "Bucaneiro";
|
||||||
|
case 522:
|
||||||
|
return "Captain";
|
||||||
|
|
||||||
|
default:
|
||||||
|
return "Unknown Job";
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -138,7 +138,7 @@ public class AbstractPlayerInteraction {
|
|||||||
|
|
||||||
public void warpParty(int id, int portalId, int fromMinId, int fromMaxId) {
|
public void warpParty(int id, int portalId, int fromMinId, int fromMaxId) {
|
||||||
for (MapleCharacter mc : getPartyMembers()) {
|
for (MapleCharacter mc : getPartyMembers()) {
|
||||||
if(mc.getMapId() >= fromMinId && mc.getMapId() <= fromMaxId) {
|
if (mc.getMapId() >= fromMinId && mc.getMapId() <= fromMaxId) {
|
||||||
mc.changeMap(id, portalId);
|
mc.changeMap(id, portalId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -237,7 +237,9 @@ public class AbstractPlayerInteraction {
|
|||||||
|
|
||||||
private static List<Integer> convertToIntegerArray(List<Double> list) {
|
private static List<Integer> convertToIntegerArray(List<Double> list) {
|
||||||
List<Integer> intList = new LinkedList<>();
|
List<Integer> intList = new LinkedList<>();
|
||||||
for(Double d: list) intList.add(d.intValue());
|
for (Double d : list) {
|
||||||
|
intList.add(d.intValue());
|
||||||
|
}
|
||||||
|
|
||||||
return intList;
|
return intList;
|
||||||
}
|
}
|
||||||
@@ -259,7 +261,7 @@ public class AbstractPlayerInteraction {
|
|||||||
int size = Math.min(itemids.size(), quantity.size());
|
int size = Math.min(itemids.size(), quantity.size());
|
||||||
|
|
||||||
List<Pair<Item, MapleInventoryType>> addedItems = new LinkedList<>();
|
List<Pair<Item, MapleInventoryType>> addedItems = new LinkedList<>();
|
||||||
for(int i = 0; i < size; i++) {
|
for (int i = 0; i < size; i++) {
|
||||||
Item it = new Item(itemids.get(i), (short) 0, quantity.get(i).shortValue());
|
Item it = new Item(itemids.get(i), (short) 0, quantity.get(i).shortValue());
|
||||||
addedItems.add(new Pair<>(it, ItemConstants.getInventoryType(itemids.get(i))));
|
addedItems.add(new Pair<>(it, ItemConstants.getInventoryType(itemids.get(i))));
|
||||||
}
|
}
|
||||||
@@ -269,7 +271,7 @@ public class AbstractPlayerInteraction {
|
|||||||
|
|
||||||
private static List<Pair<Item, MapleInventoryType>> prepareProofInventoryItems(List<Pair<Integer, Integer>> items) {
|
private static List<Pair<Item, MapleInventoryType>> prepareProofInventoryItems(List<Pair<Integer, Integer>> items) {
|
||||||
List<Pair<Item, MapleInventoryType>> addedItems = new LinkedList<>();
|
List<Pair<Item, MapleInventoryType>> addedItems = new LinkedList<>();
|
||||||
for(Pair<Integer, Integer> p : items) {
|
for (Pair<Integer, Integer> p : items) {
|
||||||
Item it = new Item(p.getLeft(), (short) 0, p.getRight().shortValue());
|
Item it = new Item(p.getLeft(), (short) 0, p.getRight().shortValue());
|
||||||
addedItems.add(new Pair<>(it, MapleInventoryType.CANHOLD));
|
addedItems.add(new Pair<>(it, MapleInventoryType.CANHOLD));
|
||||||
}
|
}
|
||||||
@@ -281,11 +283,11 @@ public class AbstractPlayerInteraction {
|
|||||||
int size = Math.min(itemids.size(), quantity.size());
|
int size = Math.min(itemids.size(), quantity.size());
|
||||||
|
|
||||||
List<List<Pair<Integer, Integer>>> invList = new ArrayList<>(6);
|
List<List<Pair<Integer, Integer>>> invList = new ArrayList<>(6);
|
||||||
for(int i = MapleInventoryType.UNDEFINED.getType(); i < MapleInventoryType.CASH.getType(); i++) {
|
for (int i = MapleInventoryType.UNDEFINED.getType(); i < MapleInventoryType.CASH.getType(); i++) {
|
||||||
invList.add(new LinkedList<Pair<Integer, Integer>>());
|
invList.add(new LinkedList<Pair<Integer, Integer>>());
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int i = 0; i < size; i++) {
|
for (int i = 0; i < size; i++) {
|
||||||
int itemid = itemids.get(i);
|
int itemid = itemids.get(i);
|
||||||
invList.get(ItemConstants.getInventoryType(itemid).getType()).add(new Pair<>(itemid, quantity.get(i)));
|
invList.get(ItemConstants.getInventoryType(itemid).getType()).add(new Pair<>(itemid, quantity.get(i)));
|
||||||
}
|
}
|
||||||
@@ -300,23 +302,23 @@ public class AbstractPlayerInteraction {
|
|||||||
MapleInventoryProof prfInv = (MapleInventoryProof) this.getInventory(MapleInventoryType.CANHOLD);
|
MapleInventoryProof prfInv = (MapleInventoryProof) this.getInventory(MapleInventoryType.CANHOLD);
|
||||||
prfInv.lockInventory();
|
prfInv.lockInventory();
|
||||||
try {
|
try {
|
||||||
for(int i = MapleInventoryType.EQUIP.getType(); i < MapleInventoryType.CASH.getType(); i++) {
|
for (int i = MapleInventoryType.EQUIP.getType(); i < MapleInventoryType.CASH.getType(); i++) {
|
||||||
List<Pair<Integer, Integer>> toAdd = toAddItemList.get(i);
|
List<Pair<Integer, Integer>> toAdd = toAddItemList.get(i);
|
||||||
|
|
||||||
if(!toAdd.isEmpty()) {
|
if (!toAdd.isEmpty()) {
|
||||||
List<Pair<Integer, Integer>> toRemove = toRemoveItemList.get(i);
|
List<Pair<Integer, Integer>> toRemove = toRemoveItemList.get(i);
|
||||||
|
|
||||||
MapleInventory inv = this.getInventory(i);
|
MapleInventory inv = this.getInventory(i);
|
||||||
prfInv.cloneContents(inv);
|
prfInv.cloneContents(inv);
|
||||||
|
|
||||||
for(Pair<Integer, Integer> p : toRemove) {
|
for (Pair<Integer, Integer> p : toRemove) {
|
||||||
MapleInventoryManipulator.removeById(c, MapleInventoryType.CANHOLD, p.getLeft(), p.getRight(), false, false);
|
MapleInventoryManipulator.removeById(c, MapleInventoryType.CANHOLD, p.getLeft(), p.getRight(), false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Pair<Item, MapleInventoryType>> addItems = prepareProofInventoryItems(toAdd);
|
List<Pair<Item, MapleInventoryType>> addItems = prepareProofInventoryItems(toAdd);
|
||||||
|
|
||||||
boolean canHold = MapleInventory.checkSpots(c.getPlayer(), addItems, true);
|
boolean canHold = MapleInventory.checkSpots(c.getPlayer(), addItems, true);
|
||||||
if(!canHold) {
|
if (!canHold) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -330,7 +332,6 @@ public class AbstractPlayerInteraction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//---- \/ \/ \/ \/ \/ \/ \/ NOT TESTED \/ \/ \/ \/ \/ \/ \/ \/ \/ ----
|
//---- \/ \/ \/ \/ \/ \/ \/ NOT TESTED \/ \/ \/ \/ \/ \/ \/ \/ \/ ----
|
||||||
|
|
||||||
public final MapleQuestStatus getQuestRecord(final int id) {
|
public final MapleQuestStatus getQuestRecord(final int id) {
|
||||||
return c.getPlayer().getQuestNAdd(MapleQuest.getInstance(id));
|
return c.getPlayer().getQuestNAdd(MapleQuest.getInstance(id));
|
||||||
}
|
}
|
||||||
@@ -340,13 +341,14 @@ public class AbstractPlayerInteraction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//---- /\ /\ /\ /\ /\ /\ /\ NOT TESTED /\ /\ /\ /\ /\ /\ /\ /\ /\ ----
|
//---- /\ /\ /\ /\ /\ /\ /\ NOT TESTED /\ /\ /\ /\ /\ /\ /\ /\ /\ ----
|
||||||
|
|
||||||
public void openNpc(int npcid) {
|
public void openNpc(int npcid) {
|
||||||
openNpc(npcid, null);
|
openNpc(npcid, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void openNpc(int npcid, String script) {
|
public void openNpc(int npcid, String script) {
|
||||||
if(c.getCM() != null) return;
|
if (c.getCM() != null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
c.removeClickedNPC();
|
c.removeClickedNPC();
|
||||||
NPCScriptManager.getInstance().dispose(c);
|
NPCScriptManager.getInstance().dispose(c);
|
||||||
@@ -423,17 +425,23 @@ public class AbstractPlayerInteraction {
|
|||||||
MapleQuestStatus status = c.getPlayer().getQuest(MapleQuest.getInstance(qid));
|
MapleQuestStatus status = c.getPlayer().getQuest(MapleQuest.getInstance(qid));
|
||||||
String progress = status.getProgress(status.getAnyProgressKey());
|
String progress = status.getProgress(status.getAnyProgressKey());
|
||||||
|
|
||||||
if(progress.isEmpty()) return 0;
|
if (progress.isEmpty()) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
return Integer.parseInt(progress);
|
return Integer.parseInt(progress);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getQuestProgress(int qid, int pid) {
|
public int getQuestProgress(int qid, int pid) {
|
||||||
if(getPlayer().getQuest(MapleQuest.getInstance(qid)).getProgress(pid).isEmpty()) return 0;
|
if (getPlayer().getQuest(MapleQuest.getInstance(qid)).getProgress(pid).isEmpty()) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
return Integer.parseInt(getPlayer().getQuest(MapleQuest.getInstance(qid)).getProgress(pid));
|
return Integer.parseInt(getPlayer().getQuest(MapleQuest.getInstance(qid)).getProgress(pid));
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getStringQuestProgress(int qid, int pid) {
|
public String getStringQuestProgress(int qid, int pid) {
|
||||||
if(getPlayer().getQuest(MapleQuest.getInstance(qid)).getProgress(pid).isEmpty()) return "";
|
if (getPlayer().getQuest(MapleQuest.getInstance(qid)).getProgress(pid).isEmpty()) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
return getPlayer().getQuest(MapleQuest.getInstance(qid)).getProgress(pid);
|
return getPlayer().getQuest(MapleQuest.getInstance(qid)).getProgress(pid);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -454,9 +462,9 @@ public class AbstractPlayerInteraction {
|
|||||||
long period = (long) 90 * 24 * 60 * 60 * 1000; //refreshes expiration date: 90 days
|
long period = (long) 90 * 24 * 60 * 60 * 1000; //refreshes expiration date: 90 days
|
||||||
|
|
||||||
target = getPlayer().getPet(slot);
|
target = getPlayer().getPet(slot);
|
||||||
if(target == null) {
|
if (target == null) {
|
||||||
getPlayer().message("Pet could not be evolved...");
|
getPlayer().message("Pet could not be evolved...");
|
||||||
return(null);
|
return (null);
|
||||||
}
|
}
|
||||||
|
|
||||||
Item tmp = gainItem(afterId, (short) 1, false, true, period, target);
|
Item tmp = gainItem(afterId, (short) 1, false, true, period, target);
|
||||||
@@ -481,7 +489,6 @@ public class AbstractPlayerInteraction {
|
|||||||
c.announce(MaplePacketCreator.enableActions());
|
c.announce(MaplePacketCreator.enableActions());
|
||||||
chr.getClient().getWorldServer().registerPetHunger(chr, chr.getPetIndex(evolved));
|
chr.getClient().getWorldServer().registerPetHunger(chr, chr.getPetIndex(evolved));
|
||||||
*/
|
*/
|
||||||
|
|
||||||
MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.CASH, target.getPosition(), (short) 1, false);
|
MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.CASH, target.getPosition(), (short) 1, false);
|
||||||
|
|
||||||
return evolved;
|
return evolved;
|
||||||
@@ -520,7 +527,7 @@ public class AbstractPlayerInteraction {
|
|||||||
if (ItemConstants.isPet(id)) {
|
if (ItemConstants.isPet(id)) {
|
||||||
petId = MaplePet.createPet(id);
|
petId = MaplePet.createPet(id);
|
||||||
|
|
||||||
if(from != null) {
|
if (from != null) {
|
||||||
evolved = MaplePet.loadFromDb(id, (short) 0, petId);
|
evolved = MaplePet.loadFromDb(id, (short) 0, petId);
|
||||||
|
|
||||||
Point pos = getPlayer().getPosition();
|
Point pos = getPlayer().getPosition();
|
||||||
@@ -546,14 +553,16 @@ public class AbstractPlayerInteraction {
|
|||||||
if (ItemConstants.getInventoryType(id).equals(MapleInventoryType.EQUIP)) {
|
if (ItemConstants.getInventoryType(id).equals(MapleInventoryType.EQUIP)) {
|
||||||
item = ii.getEquipById(id);
|
item = ii.getEquipById(id);
|
||||||
|
|
||||||
if(item != null) {
|
if (item != null) {
|
||||||
Equip it = (Equip)item;
|
Equip it = (Equip) item;
|
||||||
if(ItemConstants.isAccessory(item.getItemId()) && it.getUpgradeSlots() <= 0) it.setUpgradeSlots(3);
|
if (ItemConstants.isAccessory(item.getItemId()) && it.getUpgradeSlots() <= 0) {
|
||||||
|
it.setUpgradeSlots(3);
|
||||||
|
}
|
||||||
|
|
||||||
if(ServerConstants.USE_ENHANCED_CRAFTING == true && c.getPlayer().getCS() == true) {
|
if (ServerConstants.USE_ENHANCED_CRAFTING == true && c.getPlayer().getCS() == true) {
|
||||||
Equip eqp = (Equip)item;
|
Equip eqp = (Equip) item;
|
||||||
if(!(c.getPlayer().isGM() && ServerConstants.USE_PERFECT_GM_SCROLL)) {
|
if (!(c.getPlayer().isGM() && ServerConstants.USE_PERFECT_GM_SCROLL)) {
|
||||||
eqp.setUpgradeSlots((byte)(eqp.getUpgradeSlots() + 1));
|
eqp.setUpgradeSlots((byte) (eqp.getUpgradeSlots() + 1));
|
||||||
}
|
}
|
||||||
item = MapleItemInformationProvider.getInstance().scrollEquipWithId(item, 2049100, true, 2049100, c.getPlayer().isGM());
|
item = MapleItemInformationProvider.getInstance().scrollEquipWithId(item, 2049100, true, 2049100, c.getPlayer().isGM());
|
||||||
}
|
}
|
||||||
@@ -562,8 +571,9 @@ public class AbstractPlayerInteraction {
|
|||||||
item = new Item(id, (short) 0, quantity, petId);
|
item = new Item(id, (short) 0, quantity, petId);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(expires >= 0)
|
if (expires >= 0) {
|
||||||
item.setExpiration(System.currentTimeMillis() + expires);
|
item.setExpiration(System.currentTimeMillis() + expires);
|
||||||
|
}
|
||||||
|
|
||||||
if (!MapleInventoryManipulator.checkSpace(c, id, quantity, "")) {
|
if (!MapleInventoryManipulator.checkSpace(c, id, quantity, "")) {
|
||||||
c.getPlayer().dropMessage(1, "Your inventory is full. Please remove an item from your " + ItemConstants.getInventoryType(id).name() + " inventory.");
|
c.getPlayer().dropMessage(1, "Your inventory is full. Please remove an item from your " + ItemConstants.getInventoryType(id).name() + " inventory.");
|
||||||
@@ -641,8 +651,6 @@ public class AbstractPlayerInteraction {
|
|||||||
showIntro(intro);
|
showIntro(intro);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void showIntro(String path) {
|
public void showIntro(String path) {
|
||||||
c.announce(MaplePacketCreator.showIntro(path));
|
c.announce(MaplePacketCreator.showIntro(path));
|
||||||
}
|
}
|
||||||
@@ -680,8 +688,9 @@ public class AbstractPlayerInteraction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isPartyLeader() {
|
public boolean isPartyLeader() {
|
||||||
if(getParty() == null)
|
if (getParty() == null) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return getParty().getLeaderId() == getPlayer().getId();
|
return getParty().getLeaderId() == getPlayer().getId();
|
||||||
}
|
}
|
||||||
@@ -704,7 +713,7 @@ public class AbstractPlayerInteraction {
|
|||||||
|
|
||||||
public void removeHPQItems() {
|
public void removeHPQItems() {
|
||||||
int[] items = {4001095, 4001096, 4001097, 4001098, 4001099, 4001100, 4001101};
|
int[] items = {4001095, 4001096, 4001097, 4001098, 4001099, 4001100, 4001101};
|
||||||
for (int i = 0; i < items.length; i ++) {
|
for (int i = 0; i < items.length; i++) {
|
||||||
removePartyItems(items[i]);
|
removePartyItems(items[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -715,7 +724,7 @@ public class AbstractPlayerInteraction {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (MaplePartyCharacter chr : getParty().getMembers()) {
|
for (MaplePartyCharacter chr : getParty().getMembers()) {
|
||||||
if (chr != null && chr.isOnline() && chr.getPlayer().getClient() != null){
|
if (chr != null && chr.isOnline() && chr.getPlayer().getClient() != null) {
|
||||||
removeAll(id, chr.getPlayer().getClient());
|
removeAll(id, chr.getPlayer().getClient());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -735,7 +744,6 @@ public class AbstractPlayerInteraction {
|
|||||||
givePartyExp(PQ, true);
|
givePartyExp(PQ, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void givePartyExp(String PQ, boolean instance) {
|
public void givePartyExp(String PQ, boolean instance) {
|
||||||
//1 player = +0% bonus (100)
|
//1 player = +0% bonus (100)
|
||||||
//2 players = +0% bonus (100)
|
//2 players = +0% bonus (100)
|
||||||
@@ -746,9 +754,9 @@ public class AbstractPlayerInteraction {
|
|||||||
MapleParty party = getPlayer().getParty();
|
MapleParty party = getPlayer().getParty();
|
||||||
int size = party.getMembers().size();
|
int size = party.getMembers().size();
|
||||||
|
|
||||||
if(instance) {
|
if (instance) {
|
||||||
for(MaplePartyCharacter member: party.getMembers()) {
|
for (MaplePartyCharacter member : party.getMembers()) {
|
||||||
if(member == null || !member.isOnline() || member.getPlayer().getEventInstance() == null){
|
if (member == null || !member.isOnline() || member.getPlayer().getEventInstance() == null) {
|
||||||
size--;
|
size--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -756,17 +764,17 @@ public class AbstractPlayerInteraction {
|
|||||||
|
|
||||||
int bonus = size < 4 ? 100 : 70 + (size * 10);
|
int bonus = size < 4 ? 100 : 70 + (size * 10);
|
||||||
for (MaplePartyCharacter member : party.getMembers()) {
|
for (MaplePartyCharacter member : party.getMembers()) {
|
||||||
if(member == null || !member.isOnline()){
|
if (member == null || !member.isOnline()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
MapleCharacter player = member.getPlayer();
|
MapleCharacter player = member.getPlayer();
|
||||||
if(instance && player.getEventInstance() == null){
|
if (instance && player.getEventInstance() == null) {
|
||||||
continue; // They aren't in the instance, don't give EXP.
|
continue; // They aren't in the instance, don't give EXP.
|
||||||
}
|
}
|
||||||
int base = PartyQuest.getExp(PQ, player.getLevel());
|
int base = PartyQuest.getExp(PQ, player.getLevel());
|
||||||
int exp = base * bonus / 100;
|
int exp = base * bonus / 100;
|
||||||
player.gainExp(exp, true, true);
|
player.gainExp(exp, true, true);
|
||||||
if(ServerConstants.PQ_BONUS_EXP_RATE > 0 && System.currentTimeMillis() <= ServerConstants.EVENT_END_TIMESTAMP) {
|
if (ServerConstants.PQ_BONUS_EXP_RATE > 0 && System.currentTimeMillis() <= ServerConstants.EVENT_END_TIMESTAMP) {
|
||||||
player.gainExp((int) (exp * ServerConstants.PQ_BONUS_EXP_RATE), true, true);
|
player.gainExp((int) (exp * ServerConstants.PQ_BONUS_EXP_RATE), true, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -796,8 +804,8 @@ public class AbstractPlayerInteraction {
|
|||||||
cl.announce(MaplePacketCreator.getShowItemGain(id, (short) -possessed, true));
|
cl.announce(MaplePacketCreator.getShowItemGain(id, (short) -possessed, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(invType == MapleInventoryType.EQUIP) {
|
if (invType == MapleInventoryType.EQUIP) {
|
||||||
if(cl.getPlayer().getInventory(MapleInventoryType.EQUIPPED).countById(id) > 0) {
|
if (cl.getPlayer().getInventory(MapleInventoryType.EQUIPPED).countById(id) > 0) {
|
||||||
MapleInventoryManipulator.removeById(cl, MapleInventoryType.EQUIPPED, id, 1, true, false);
|
MapleInventoryManipulator.removeById(cl, MapleInventoryType.EQUIPPED, id, 1, true, false);
|
||||||
cl.announce(MaplePacketCreator.getShowItemGain(id, (short) -1, true));
|
cl.announce(MaplePacketCreator.getShowItemGain(id, (short) -1, true));
|
||||||
}
|
}
|
||||||
@@ -926,7 +934,7 @@ public class AbstractPlayerInteraction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void resetPartyDojoEnergy() {
|
public void resetPartyDojoEnergy() {
|
||||||
for(MapleCharacter pchr: c.getPlayer().getPartyMembersOnSameMap()) {
|
for (MapleCharacter pchr : c.getPlayer().getPartyMembersOnSameMap()) {
|
||||||
pchr.setDojoEnergy(0);
|
pchr.setDojoEnergy(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -935,7 +943,7 @@ public class AbstractPlayerInteraction {
|
|||||||
c.announce(MaplePacketCreator.enableActions());
|
c.announce(MaplePacketCreator.enableActions());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void showEffect(String effect){
|
public void showEffect(String effect) {
|
||||||
c.announce(MaplePacketCreator.showEffect(effect));
|
c.announce(MaplePacketCreator.showEffect(effect));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1025,8 +1033,8 @@ public class AbstractPlayerInteraction {
|
|||||||
List<MaplePet> list = new LinkedList<>();
|
List<MaplePet> list = new LinkedList<>();
|
||||||
|
|
||||||
long curTime = System.currentTimeMillis();
|
long curTime = System.currentTimeMillis();
|
||||||
for(Item it : getPlayer().getInventory(MapleInventoryType.CASH).list()) {
|
for (Item it : getPlayer().getInventory(MapleInventoryType.CASH).list()) {
|
||||||
if(ItemConstants.isPet(it.getItemId()) && it.getExpiration() < curTime) {
|
if (ItemConstants.isPet(it.getItemId()) && it.getExpiration() < curTime) {
|
||||||
MaplePet pet = it.getPet();
|
MaplePet pet = it.getPet();
|
||||||
if (pet != null) {
|
if (pet != null) {
|
||||||
list.add(pet);
|
list.add(pet);
|
||||||
@@ -1048,7 +1056,7 @@ public class AbstractPlayerInteraction {
|
|||||||
|
|
||||||
MapleCharacter chr = this.getPlayer();
|
MapleCharacter chr = this.getPlayer();
|
||||||
|
|
||||||
switch(jobType) {
|
switch (jobType) {
|
||||||
case 1:
|
case 1:
|
||||||
return chr.getStr() >= 35;
|
return chr.getStr() >= 35;
|
||||||
|
|
||||||
@@ -1068,7 +1076,7 @@ public class AbstractPlayerInteraction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static String getFirstJobStatRequirement(int jobType) {
|
public static String getFirstJobStatRequirement(int jobType) {
|
||||||
switch(jobType) {
|
switch (jobType) {
|
||||||
case 1:
|
case 1:
|
||||||
return "STR " + 35;
|
return "STR " + 35;
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
You should have received a copy of the GNU Affero General Public License
|
You should have received a copy of the GNU Affero General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package scripting.event;
|
package scripting.event;
|
||||||
|
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
@@ -40,6 +40,7 @@ import scripting.AbstractScriptManager;
|
|||||||
public class EventScriptManager extends AbstractScriptManager {
|
public class EventScriptManager extends AbstractScriptManager {
|
||||||
|
|
||||||
private class EventEntry {
|
private class EventEntry {
|
||||||
|
|
||||||
public EventEntry(Invocable iv, EventManager em) {
|
public EventEntry(Invocable iv, EventManager em) {
|
||||||
this.iv = iv;
|
this.iv = iv;
|
||||||
this.em = em;
|
this.em = em;
|
||||||
@@ -80,7 +81,9 @@ public class EventScriptManager extends AbstractScriptManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void reloadScripts() {
|
private void reloadScripts() {
|
||||||
if (events.isEmpty()) return;
|
if (events.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Channel cserv = events.values().iterator().next().em.getChannelServer();
|
Channel cserv = events.values().iterator().next().em.getChannelServer();
|
||||||
for (Entry<String, EventEntry> entry : events.entrySet()) {
|
for (Entry<String, EventEntry> entry : events.entrySet()) {
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
You should have received a copy of the GNU Affero General Public License
|
You should have received a copy of the GNU Affero General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package scripting.event.worker;
|
package scripting.event.worker;
|
||||||
|
|
||||||
import constants.ServerConstants;
|
import constants.ServerConstants;
|
||||||
@@ -39,6 +39,7 @@ import server.ThreadManager;
|
|||||||
* @author Ronan
|
* @author Ronan
|
||||||
*/
|
*/
|
||||||
public class EventScriptScheduler {
|
public class EventScriptScheduler {
|
||||||
|
|
||||||
private boolean disposed = false;
|
private boolean disposed = false;
|
||||||
private int idleProcs = 0;
|
private int idleProcs = 0;
|
||||||
private Map<Runnable, Long> registeredEntries = new HashMap<>();
|
private Map<Runnable, Long> registeredEntries = new HashMap<>();
|
||||||
@@ -62,11 +63,11 @@ public class EventScriptScheduler {
|
|||||||
|
|
||||||
schedulerLock.lock();
|
schedulerLock.lock();
|
||||||
try {
|
try {
|
||||||
if(registeredEntries.isEmpty()) {
|
if (registeredEntries.isEmpty()) {
|
||||||
idleProcs++;
|
idleProcs++;
|
||||||
|
|
||||||
if(idleProcs >= ServerConstants.MOB_STATUS_MONITOR_LIFE) {
|
if (idleProcs >= ServerConstants.MOB_STATUS_MONITOR_LIFE) {
|
||||||
if(schedulerTask != null) {
|
if (schedulerTask != null) {
|
||||||
schedulerTask.cancel(false);
|
schedulerTask.cancel(false);
|
||||||
schedulerTask = null;
|
schedulerTask = null;
|
||||||
}
|
}
|
||||||
@@ -83,8 +84,8 @@ public class EventScriptScheduler {
|
|||||||
|
|
||||||
long timeNow = Server.getInstance().getCurrentTime();
|
long timeNow = Server.getInstance().getCurrentTime();
|
||||||
toRemove = new LinkedList<>();
|
toRemove = new LinkedList<>();
|
||||||
for(Entry<Runnable, Long> rmd : registeredEntriesCopy.entrySet()) {
|
for (Entry<Runnable, Long> rmd : registeredEntriesCopy.entrySet()) {
|
||||||
if(rmd.getValue() < timeNow) {
|
if (rmd.getValue() < timeNow) {
|
||||||
Runnable r = rmd.getKey();
|
Runnable r = rmd.getKey();
|
||||||
|
|
||||||
r.run(); // runs the scheduled action
|
r.run(); // runs the scheduled action
|
||||||
@@ -92,10 +93,10 @@ public class EventScriptScheduler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!toRemove.isEmpty()) {
|
if (!toRemove.isEmpty()) {
|
||||||
schedulerLock.lock();
|
schedulerLock.lock();
|
||||||
try {
|
try {
|
||||||
for(Runnable r : toRemove) {
|
for (Runnable r : toRemove) {
|
||||||
registeredEntries.remove(r);
|
registeredEntries.remove(r);
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
@@ -112,8 +113,10 @@ public class EventScriptScheduler {
|
|||||||
schedulerLock.lock();
|
schedulerLock.lock();
|
||||||
try {
|
try {
|
||||||
idleProcs = 0;
|
idleProcs = 0;
|
||||||
if(schedulerTask == null) {
|
if (schedulerTask == null) {
|
||||||
if(disposed) return;
|
if (disposed) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
schedulerTask = TimerManager.getInstance().register(monitorTask, ServerConstants.MOB_STATUS_MONITOR_PROC, ServerConstants.MOB_STATUS_MONITOR_PROC);
|
schedulerTask = TimerManager.getInstance().register(monitorTask, ServerConstants.MOB_STATUS_MONITOR_PROC, ServerConstants.MOB_STATUS_MONITOR_PROC);
|
||||||
}
|
}
|
||||||
@@ -148,7 +151,7 @@ public class EventScriptScheduler {
|
|||||||
public void run() {
|
public void run() {
|
||||||
schedulerLock.lock();
|
schedulerLock.lock();
|
||||||
try {
|
try {
|
||||||
if(schedulerTask != null) {
|
if (schedulerTask != null) {
|
||||||
schedulerTask.cancel(false);
|
schedulerTask.cancel(false);
|
||||||
schedulerTask = null;
|
schedulerTask = null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,35 @@
|
|||||||
|
/*
|
||||||
|
This file is part of the OdinMS Maple Story Server
|
||||||
|
Copyright (C) 2008 Patrick Huy <[email protected]>
|
||||||
|
Matthias Butz <[email protected]>
|
||||||
|
Jan Christian Meyer <[email protected]>
|
||||||
|
|
||||||
|
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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package scripting.item;
|
||||||
|
|
||||||
|
import client.MapleClient;
|
||||||
|
import scripting.AbstractPlayerInteraction;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author kevintjuh93
|
||||||
|
*/
|
||||||
|
public class ItemScriptMethods extends AbstractPlayerInteraction {
|
||||||
|
public ItemScriptMethods(MapleClient c) {
|
||||||
|
super(c);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,23 +1,23 @@
|
|||||||
/*
|
/*
|
||||||
This file is part of the OdinMS Maple Story Server
|
This file is part of the OdinMS Maple Story Server
|
||||||
Copyright (C) 2008 Patrick Huy <[email protected]>
|
Copyright (C) 2008 Patrick Huy <[email protected]>
|
||||||
Matthias Butz <[email protected]>
|
Matthias Butz <[email protected]>
|
||||||
Jan Christian Meyer <[email protected]>
|
Jan Christian Meyer <[email protected]>
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU Affero General Public License as
|
it under the terms of the GNU Affero General Public License as
|
||||||
published by the Free Software Foundation version 3 as published by
|
published by the Free Software Foundation version 3 as published by
|
||||||
the Free Software Foundation. You may not use, modify or distribute
|
the Free Software Foundation. You may not use, modify or distribute
|
||||||
this program under any other version of the GNU Affero General Public
|
this program under any other version of the GNU Affero General Public
|
||||||
License.
|
License.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU Affero General Public License for more details.
|
GNU Affero General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Affero General Public License
|
You should have received a copy of the GNU Affero General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package scripting.npc;
|
package scripting.npc;
|
||||||
|
|
||||||
@@ -58,28 +58,46 @@ import client.inventory.Item;
|
|||||||
import client.inventory.ItemFactory;
|
import client.inventory.ItemFactory;
|
||||||
import client.inventory.MaplePet;
|
import client.inventory.MaplePet;
|
||||||
import constants.ItemConstants;
|
import constants.ItemConstants;
|
||||||
|
import constants.LinguaConstants;
|
||||||
import java.awt.Point;
|
import java.awt.Point;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
|
import net.server.channel.Channel;
|
||||||
|
import scripting.event.EventInstanceManager;
|
||||||
import server.MapleSkillbookInformationProvider;
|
import server.MapleSkillbookInformationProvider;
|
||||||
import server.MapleSkillbookInformationProvider.SkillBookEntry;
|
import server.MapleSkillbookInformationProvider.SkillBookEntry;
|
||||||
|
import server.TimerManager;
|
||||||
import server.maps.MapleMapObject;
|
import server.maps.MapleMapObject;
|
||||||
import server.maps.MapleMapObjectType;
|
import server.maps.MapleMapObjectType;
|
||||||
|
import server.partyquest.MonsterCarnival;
|
||||||
|
import tools.FilePrinter;
|
||||||
|
import tools.packets.Wedding;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Matze
|
* @author Matze
|
||||||
*/
|
*/
|
||||||
public class NPCConversationManager extends AbstractPlayerInteraction {
|
public class NPCConversationManager extends AbstractPlayerInteraction {
|
||||||
|
|
||||||
private int npc;
|
private int npc;
|
||||||
private int npcOid;
|
private int npcOid;
|
||||||
private String scriptName;
|
private String scriptName;
|
||||||
private String getText;
|
private String getText;
|
||||||
private boolean itemScript;
|
private boolean itemScript;
|
||||||
|
private List<MaplePartyCharacter> otherParty;
|
||||||
|
|
||||||
public NPCConversationManager(MapleClient c, int npc, String scriptName) {
|
public NPCConversationManager(MapleClient c, int npc, String scriptName) {
|
||||||
this(c, npc, -1, scriptName, false);
|
this(c, npc, -1, scriptName, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public NPCConversationManager(MapleClient c, int npc, List<MaplePartyCharacter> otherParty, boolean test) {
|
||||||
|
super(c);
|
||||||
|
this.c = c;
|
||||||
|
this.npc = npc;
|
||||||
|
this.otherParty = otherParty;
|
||||||
|
}
|
||||||
|
|
||||||
public NPCConversationManager(MapleClient c, int npc, int oid, String scriptName, boolean itemScript) {
|
public NPCConversationManager(MapleClient c, int npc, int oid, String scriptName, boolean itemScript) {
|
||||||
super(c);
|
super(c);
|
||||||
this.npc = npc;
|
this.npc = npc;
|
||||||
@@ -206,7 +224,7 @@ public class NPCConversationManager extends AbstractPlayerInteraction {
|
|||||||
return getPlayer().getJob().getId();
|
return getPlayer().getJob().getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
public MapleJob getJob(){
|
public MapleJob getJob() {
|
||||||
return getPlayer().getJob();
|
return getPlayer().getJob();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -335,10 +353,10 @@ public class NPCConversationManager extends AbstractPlayerInteraction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public MaplePlayerNPC getPlayerNPCByScriptid(int scriptId) {
|
public MaplePlayerNPC getPlayerNPCByScriptid(int scriptId) {
|
||||||
for(MapleMapObject pnpcObj : getPlayer().getMap().getMapObjectsInRange(new Point(0, 0), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.PLAYER_NPC))) {
|
for (MapleMapObject pnpcObj : getPlayer().getMap().getMapObjectsInRange(new Point(0, 0), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.PLAYER_NPC))) {
|
||||||
MaplePlayerNPC pn = (MaplePlayerNPC) pnpcObj;
|
MaplePlayerNPC pn = (MaplePlayerNPC) pnpcObj;
|
||||||
|
|
||||||
if(pn.getScriptId() == scriptId) {
|
if (pn.getScriptId() == scriptId) {
|
||||||
return pn;
|
return pn;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -358,7 +376,7 @@ public class NPCConversationManager extends AbstractPlayerInteraction {
|
|||||||
|
|
||||||
public void gainCloseness(int closeness) {
|
public void gainCloseness(int closeness) {
|
||||||
for (MaplePet pet : getPlayer().getPets()) {
|
for (MaplePet pet : getPlayer().getPets()) {
|
||||||
if(pet != null) {
|
if (pet != null) {
|
||||||
pet.gainClosenessFullness(getPlayer(), closeness, 0, 0);
|
pet.gainClosenessFullness(getPlayer(), closeness, 0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -424,7 +442,7 @@ public class NPCConversationManager extends AbstractPlayerInteraction {
|
|||||||
|
|
||||||
LogHelper.logGacha(getPlayer(), item.getId(), map);
|
LogHelper.logGacha(getPlayer(), item.getId(), map);
|
||||||
|
|
||||||
if (item.getTier() > 0){ //Uncommon and Rare
|
if (item.getTier() > 0) { //Uncommon and Rare
|
||||||
Server.getInstance().broadcastMessage(c.getWorld(), MaplePacketCreator.gachaponMessage(itemGained, map, getPlayer()));
|
Server.getInstance().broadcastMessage(c.getWorld(), MaplePacketCreator.gachaponMessage(itemGained, map, getPlayer()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -547,7 +565,9 @@ public class NPCConversationManager extends AbstractPlayerInteraction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int getCosmeticItem(int itemid) {
|
public int getCosmeticItem(int itemid) {
|
||||||
if (itemExists(itemid)) return itemid;
|
if (itemExists(itemid)) {
|
||||||
|
return itemid;
|
||||||
|
}
|
||||||
|
|
||||||
int baseid;
|
int baseid;
|
||||||
if (itemid < 30000) {
|
if (itemid < 30000) {
|
||||||
@@ -592,4 +612,370 @@ public class NPCConversationManager extends AbstractPlayerInteraction {
|
|||||||
return sbe != SkillBookEntry.UNAVAILABLE ? " Obtainable through #rquestline#k." : "";
|
return sbe != SkillBookEntry.UNAVAILABLE ? " Obtainable through #rquestline#k." : "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// By Drago/Dragohe4rt CPQ + WED
|
||||||
|
|
||||||
|
public int calcAvgLvl(int map) {
|
||||||
|
int num = 0;
|
||||||
|
int avg = 0;
|
||||||
|
for (MapleMapObject mmo
|
||||||
|
: c.getChannelServer().getMapFactory().getMap(map).getAllPlayer()) {
|
||||||
|
avg += ((MapleCharacter) mmo).getLevel();
|
||||||
|
num++;
|
||||||
|
}
|
||||||
|
avg /= num;
|
||||||
|
return avg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void sendCPQMapLists() {
|
||||||
|
String msg = LinguaConstants.Linguas(getPlayer()).CPQInicioEscolha;
|
||||||
|
for (int i = 0; i < 6; i++) {
|
||||||
|
if (fieldTaken(i)) {
|
||||||
|
if (fieldLobbied(i)) {
|
||||||
|
msg += "#b#L" + i + "#Map " + (i + 1) + " (nível: "
|
||||||
|
+ calcAvgLvl(980000100 + i * 100) + " / "
|
||||||
|
+ getPlayerCount(980000100 + i * 100) + "x"
|
||||||
|
+ getPlayerCount(980000100 + i * 100) + ") #l\\r\\n";
|
||||||
|
} else {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (i == 0 || i == 1 || i == 2 || 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";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sendSimple(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean fieldTaken(int field) {
|
||||||
|
if (!c.getChannelServer().getMapFactory().getMap(980000100 + field * 100).getAllPlayer().isEmpty()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (!c.getChannelServer().getMapFactory().getMap(980000101 + field * 100).getAllPlayer().isEmpty()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (!c.getChannelServer().getMapFactory().getMap(980000102 + field * 100).getAllPlayer().isEmpty()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean fieldLobbied(int field) {
|
||||||
|
if (!c.getChannelServer().getMapFactory().getMap(980000100 + field * 100).getAllPlayer().isEmpty()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void cpqLobby(int field) {
|
||||||
|
try {
|
||||||
|
final MapleMap map, mapsaida;
|
||||||
|
Channel cs = c.getChannelServer();
|
||||||
|
map = cs.getMapFactory().getMap(980000100 + 100 * field);
|
||||||
|
mapsaida = cs.getMapFactory().getMap(980000000);
|
||||||
|
for (MaplePartyCharacter mpc : c.getPlayer().getParty().getMembers()) {
|
||||||
|
final MapleCharacter mc;
|
||||||
|
mc = cs.getPlayerStorage().getCharacterByName(mpc.getName());
|
||||||
|
if (mc != null) {
|
||||||
|
mc.changeMap(map, map.getPortal(0));
|
||||||
|
mc.getClient().getSession().write(MaplePacketCreator.serverNotice(6, LinguaConstants.Linguas(mc).CPQEntradaLobby));
|
||||||
|
TimerManager tMan = TimerManager.getInstance();
|
||||||
|
tMan.schedule(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
mapClock(3 * 60);
|
||||||
|
}
|
||||||
|
}, 1500);
|
||||||
|
}
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public MapleCharacter getChrById(int id) {
|
||||||
|
Channel cs = c.getChannelServer();
|
||||||
|
return cs.getPlayerStorage().getCharacterById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void cancelarSaida() {
|
||||||
|
Channel cs = c.getChannelServer();
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void startCPQ(final MapleCharacter challenger, int field) {
|
||||||
|
try {
|
||||||
|
cancelarSaida();
|
||||||
|
if (challenger != null) {
|
||||||
|
if (challenger.getParty() == null) {
|
||||||
|
throw new RuntimeException("Não existe oponente!");
|
||||||
|
}
|
||||||
|
for (MaplePartyCharacter mpc : challenger.getParty().getMembers()) {
|
||||||
|
MapleCharacter mc = c.getChannelServer().getPlayerStorage().getCharacterByName(mpc.getName());
|
||||||
|
if (mc != null) {
|
||||||
|
mc.changeMap(getPlayer().getMap(), getPlayer().getMap().getPortal(0));
|
||||||
|
TimerManager tMan = TimerManager.getInstance();
|
||||||
|
tMan.schedule(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
mapClock(10);
|
||||||
|
}
|
||||||
|
}, 1500);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (MaplePartyCharacter mpc : getPlayer().getParty().getMembers()) {
|
||||||
|
MapleCharacter mc = c.getChannelServer().getPlayerStorage().getCharacterByName(mpc.getName());
|
||||||
|
if (mc != null) {
|
||||||
|
TimerManager tMan = TimerManager.getInstance();
|
||||||
|
tMan.schedule(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
mapClock(10);
|
||||||
|
}
|
||||||
|
}, 1500);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
final int mapid = c.getPlayer().getMapId() + 1;
|
||||||
|
TimerManager tMan = TimerManager.getInstance();
|
||||||
|
tMan.schedule(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
Channel cs = c.getChannelServer();
|
||||||
|
for (MaplePartyCharacter mpc : getPlayer().getParty().getMembers()) {
|
||||||
|
MapleCharacter mc = cs.getPlayerStorage().getCharacterByName(mpc.getName());
|
||||||
|
mc.setMonsterCarnival(null);
|
||||||
|
}
|
||||||
|
for (MaplePartyCharacter mpc : challenger.getParty().getMembers()) {
|
||||||
|
MapleCharacter mc = cs.getPlayerStorage().getCharacterByName(mpc.getName());
|
||||||
|
mc.setMonsterCarnival(null);
|
||||||
|
}
|
||||||
|
new MonsterCarnival(getPlayer().getParty(), challenger.getParty(), mapid, true);
|
||||||
|
}
|
||||||
|
}, 11000);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void startCPQ2(final MapleCharacter challenger, int field) {
|
||||||
|
try {
|
||||||
|
cancelarSaida();
|
||||||
|
if (challenger != null) {
|
||||||
|
if (challenger.getParty() == null) {
|
||||||
|
throw new RuntimeException("Não existe oponente!");
|
||||||
|
}
|
||||||
|
for (MaplePartyCharacter mpc : challenger.getParty().getMembers()) {
|
||||||
|
MapleCharacter mc = c.getChannelServer().getPlayerStorage().getCharacterByName(mpc.getName());
|
||||||
|
if (mc != null) {
|
||||||
|
mc.changeMap(getPlayer().getMap(), getPlayer().getMap().getPortal(0));
|
||||||
|
mapClock(10);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
final int mapid = c.getPlayer().getMapId() + 100;
|
||||||
|
TimerManager tMan = TimerManager.getInstance();
|
||||||
|
tMan.schedule(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
Channel cs = c.getChannelServer();
|
||||||
|
for (MaplePartyCharacter mpc : getPlayer().getParty().getMembers()) {
|
||||||
|
MapleCharacter mc = cs.getPlayerStorage().getCharacterByName(mpc.getName());
|
||||||
|
mc.setMonsterCarnival(null);
|
||||||
|
}
|
||||||
|
for (MaplePartyCharacter mpc : challenger.getParty().getMembers()) {
|
||||||
|
MapleCharacter mc = cs.getPlayerStorage().getCharacterByName(mpc.getName());
|
||||||
|
mc.setMonsterCarnival(null);
|
||||||
|
}
|
||||||
|
new MonsterCarnival(getPlayer().getParty(), challenger.getParty(), mapid, false);
|
||||||
|
}
|
||||||
|
}, 10000);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void sendCPQMapLists2() {
|
||||||
|
String msg = LinguaConstants.Linguas(getPlayer()).CPQInicioEscolha;
|
||||||
|
for (int i = 0; i < 3; i++) {
|
||||||
|
if (fieldTaken2(i)) {
|
||||||
|
if (fieldLobbied2(i)) {
|
||||||
|
msg += "#b#L" + i + "#Map " + (i + 1) + " (Nível: "
|
||||||
|
+ calcAvgLvl(980031000 + i * 1000) + "#l\\r\\n";
|
||||||
|
} else {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (i == 0 || i == 1) {
|
||||||
|
msg += "#b#L" + i + "#Map " + (i + 1) + " (2x2) #l\\r\\n";
|
||||||
|
} else {
|
||||||
|
msg += "#b#L" + i + "#Map " + (i + 1) + " (3x3) #l\\r\\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sendSimple(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean fieldTaken2(int field) {
|
||||||
|
if (!c.getChannelServer().getMapFactory().getMap(980031000 + field * 1000).getAllPlayer().isEmpty()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (!c.getChannelServer().getMapFactory().getMap(980031000 + field * 1000).getAllPlayer().isEmpty()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (!c.getChannelServer().getMapFactory().getMap(980031000 + field * 1000).getAllPlayer().isEmpty()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean fieldLobbied2(int field) {
|
||||||
|
if (!c.getChannelServer().getMapFactory().getMap(980031000 + field * 1000).getAllPlayer().isEmpty()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void cpqLobby2(int field) {
|
||||||
|
try {
|
||||||
|
final MapleMap map, mapsaida;
|
||||||
|
Channel cs = c.getChannelServer();
|
||||||
|
mapsaida = 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());
|
||||||
|
if (mc != null) {
|
||||||
|
mc.changeMap(map, map.getPortal(0));
|
||||||
|
mc.getClient().getSession().write(MaplePacketCreator.serverNotice(6, LinguaConstants.Linguas(mc).CPQEntradaLobby));
|
||||||
|
TimerManager tMan = TimerManager.getInstance();
|
||||||
|
tMan.schedule(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
mapClock(3 * 60);
|
||||||
|
}
|
||||||
|
}, 1500);
|
||||||
|
}
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void challengeParty2(int field) {
|
||||||
|
MapleCharacter leader = null;
|
||||||
|
MapleMap map = c.getChannelServer().getMapFactory().getMap(980031000 + 1000 * field);
|
||||||
|
for (MapleMapObject mmo : map.getAllPlayer()) {
|
||||||
|
MapleCharacter mc = (MapleCharacter) mmo;
|
||||||
|
if (mc.getParty() == null) {
|
||||||
|
sendOk(LinguaConstants.Linguas(mc).CPQEscolha);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (mc.getParty().getLeader().getId() == mc.getId()) {
|
||||||
|
leader = mc;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (leader != null) {
|
||||||
|
if (!leader.isChallenged()) {
|
||||||
|
List<MaplePartyCharacter> members = new LinkedList<>();
|
||||||
|
for (MaplePartyCharacter fucker : c.getPlayer().getParty().getMembers()) {
|
||||||
|
members.add(fucker);
|
||||||
|
}
|
||||||
|
NPCScriptManager.getInstance().start("cpqchallenge2", leader.getClient(), npc, members);
|
||||||
|
} else {
|
||||||
|
sendOk(LinguaConstants.Linguas(leader).CPQInicioEscolhaEmEscolha);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
sendOk(LinguaConstants.Linguas(leader).CPQLiderNaoEncontrado);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void mapClock(int time) {
|
||||||
|
//getPlayer().getMap().broadcastMessage(MaplePacketCreator.serverNotice(type, message));
|
||||||
|
getPlayer().getMap().broadcastMessage(MaplePacketCreator.getClock(time));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void challengeParty(int field) {
|
||||||
|
MapleCharacter leader = null;
|
||||||
|
MapleMap map = c.getChannelServer().getMapFactory().getMap(980000100 + 100 * field);
|
||||||
|
if (map.getAllPlayer().size() != getPlayer().getParty().getMembers().size()) {
|
||||||
|
sendOk("erro");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for (MapleMapObject mmo : map.getAllPlayer()) {
|
||||||
|
MapleCharacter mc = (MapleCharacter) mmo;
|
||||||
|
if (mc.getParty() == null) {
|
||||||
|
sendOk(LinguaConstants.Linguas(mc).CPQEscolha);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (mc.getParty().getLeader().getId() == mc.getId()) {
|
||||||
|
leader = mc;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (leader != null) {
|
||||||
|
if (!leader.isChallenged()) {
|
||||||
|
List<MaplePartyCharacter> members = new LinkedList<>();
|
||||||
|
for (MaplePartyCharacter fucker : c.getPlayer().getParty().getMembers()) {
|
||||||
|
members.add(fucker);
|
||||||
|
}
|
||||||
|
NPCScriptManager.getInstance().start("cpqchallenge", leader.getClient(), npc, members);
|
||||||
|
} else {
|
||||||
|
sendOk(LinguaConstants.Linguas(leader).CPQInicioEscolhaEmEscolha);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
sendOk(LinguaConstants.Linguas(leader).CPQLiderNaoEncontrado);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public MapleCharacter getCharByName(String namee) {
|
||||||
|
try {
|
||||||
|
return getClient().getChannelServer().getPlayerStorage().getCharacterByName(namee);
|
||||||
|
} catch (Exception e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void enviarLista() {
|
||||||
|
EventInstanceManager eim = getEventInstance();
|
||||||
|
if(eim != null) {
|
||||||
|
String name = eim.getProperty("brideId");
|
||||||
|
MapleCharacter chr = getChrById(Integer.parseInt(name));
|
||||||
|
//MapleCharacter chr = getChrById(3);
|
||||||
|
if (chr != null) {
|
||||||
|
if (chr.getId() == getPlayer().getId()) {
|
||||||
|
getPlayer().announce(Wedding.OnWeddingGiftResult((byte) 0xA, chr.getItens(), chr.getItem()));
|
||||||
|
} else {
|
||||||
|
getPlayer().announce(Wedding.OnWeddingGiftResult((byte) 0x09, chr.getItens(), chr.getItem()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void criarLista() {
|
||||||
|
getClient().getSession().write(Wedding.sendWishList());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -26,10 +26,12 @@ import client.MapleClient;
|
|||||||
|
|
||||||
import java.lang.reflect.UndeclaredThrowableException;
|
import java.lang.reflect.UndeclaredThrowableException;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import javax.script.Invocable;
|
import javax.script.Invocable;
|
||||||
import javax.script.ScriptException;
|
import javax.script.ScriptException;
|
||||||
|
import net.server.world.MaplePartyCharacter;
|
||||||
|
|
||||||
import scripting.AbstractScriptManager;
|
import scripting.AbstractScriptManager;
|
||||||
import server.MapleItemInformationProvider.ScriptedItem;
|
import server.MapleItemInformationProvider.ScriptedItem;
|
||||||
@@ -80,6 +82,49 @@ public class NPCScriptManager extends AbstractScriptManager {
|
|||||||
return start(c, scriptItem.getNpc(), -1, scriptItem.getScript(), chr, true, "im");
|
return start(c, scriptItem.getNpc(), -1, scriptItem.getScript(), chr, true, "im");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void start(String filename, MapleClient c, int npc, List<MaplePartyCharacter> chrs) {
|
||||||
|
try {
|
||||||
|
NPCConversationManager cm = new NPCConversationManager(c, npc, chrs, true);
|
||||||
|
cm.dispose();
|
||||||
|
if (cms.containsKey(c)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
cms.put(c, cm);
|
||||||
|
Invocable iv = null;
|
||||||
|
iv = getInvocable("npc/" + filename + ".js", c);
|
||||||
|
NPCScriptManager npcsm = NPCScriptManager.getInstance();
|
||||||
|
|
||||||
|
if (iv == null || NPCScriptManager.getInstance() == null) {
|
||||||
|
c.getPlayer().dropMessage(1, npc + "");
|
||||||
|
cm.dispose();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (iv == null || npcsm == null) {
|
||||||
|
c.getPlayer().dropMessage(1, npc + "");
|
||||||
|
cm.dispose();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
engine.put("cm", cm);
|
||||||
|
scripts.put(c, iv);
|
||||||
|
try {
|
||||||
|
iv.invokeFunction("start", chrs);
|
||||||
|
} catch (final NoSuchMethodException nsme) {
|
||||||
|
try {
|
||||||
|
iv.invokeFunction("start", chrs);
|
||||||
|
} catch (final NoSuchMethodException nsma) {
|
||||||
|
nsma.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (final UndeclaredThrowableException ute) {
|
||||||
|
FilePrinter.printError(FilePrinter.NPC + npc + ".txt", ute);
|
||||||
|
dispose(c);
|
||||||
|
} catch (final Exception e) {
|
||||||
|
FilePrinter.printError(FilePrinter.NPC + npc + ".txt", e);
|
||||||
|
dispose(c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private boolean start(MapleClient c, int npc, int oid, String fileName, MapleCharacter chr, boolean itemScript, String engineName) {
|
private boolean start(MapleClient c, int npc, int oid, String fileName, MapleCharacter chr, boolean itemScript, String engineName) {
|
||||||
try {
|
try {
|
||||||
NPCConversationManager cm = new NPCConversationManager(c, npc, oid, fileName, itemScript);
|
NPCConversationManager cm = new NPCConversationManager(c, npc, oid, fileName, itemScript);
|
||||||
@@ -159,7 +204,7 @@ public class NPCScriptManager extends AbstractScriptManager {
|
|||||||
scripts.remove(c);
|
scripts.remove(c);
|
||||||
|
|
||||||
String scriptFolder = (cm.isItemScript() ? "item" : "npc");
|
String scriptFolder = (cm.isItemScript() ? "item" : "npc");
|
||||||
if(cm.getScriptName() != null) {
|
if (cm.getScriptName() != null) {
|
||||||
resetContext(scriptFolder + "/" + cm.getScriptName() + ".js", c);
|
resetContext(scriptFolder + "/" + cm.getScriptName() + ".js", c);
|
||||||
} else {
|
} else {
|
||||||
resetContext(scriptFolder + "/" + cm.getNpc() + ".js", c);
|
resetContext(scriptFolder + "/" + cm.getNpc() + ".js", c);
|
||||||
|
|||||||
@@ -47,6 +47,8 @@ import server.maps.MapMonitor;
|
|||||||
import server.maps.MapleMap;
|
import server.maps.MapleMap;
|
||||||
import server.maps.MapleReactor;
|
import server.maps.MapleReactor;
|
||||||
import server.maps.ReactorDropEntry;
|
import server.maps.ReactorDropEntry;
|
||||||
|
import server.partyquest.MapleCarnivalFactory;
|
||||||
|
import server.partyquest.MapleCarnivalFactory.MCSkill;
|
||||||
import tools.MaplePacketCreator;
|
import tools.MaplePacketCreator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -311,4 +313,20 @@ public class ReactorActionManager extends AbstractPlayerInteraction {
|
|||||||
}
|
}
|
||||||
}, timestamp);
|
}, timestamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void dispelAllMonsters(int num, int team) { //dispels all mobs, cpq
|
||||||
|
final MCSkill skil = MapleCarnivalFactory.getInstance().getGuardian(num);
|
||||||
|
if (skil != null) {
|
||||||
|
for (MapleMonster mons : getMap().getMonsters()) {
|
||||||
|
if(mons.getTeam() == team) {
|
||||||
|
mons.dispelSkill(skil.getSkill());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (team == 0) {
|
||||||
|
getPlayer().getMap().getRedTeamBuffs().remove(skil);
|
||||||
|
} else {
|
||||||
|
getPlayer().getMap().getBlueTeamBuffs().remove(skil);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+102
-36
@@ -50,7 +50,6 @@ import client.MapleCharacter;
|
|||||||
import client.MapleDisease;
|
import client.MapleDisease;
|
||||||
import client.MapleJob;
|
import client.MapleJob;
|
||||||
import client.MapleMount;
|
import client.MapleMount;
|
||||||
import client.MapleStat;
|
|
||||||
import client.Skill;
|
import client.Skill;
|
||||||
import client.SkillFactory;
|
import client.SkillFactory;
|
||||||
import client.inventory.Item;
|
import client.inventory.Item;
|
||||||
@@ -111,6 +110,10 @@ import constants.skills.SuperGM;
|
|||||||
import constants.skills.ThunderBreaker;
|
import constants.skills.ThunderBreaker;
|
||||||
import constants.skills.WhiteKnight;
|
import constants.skills.WhiteKnight;
|
||||||
import constants.skills.WindArcher;
|
import constants.skills.WindArcher;
|
||||||
|
import net.server.world.MapleParty;
|
||||||
|
import net.server.world.MaplePartyCharacter;
|
||||||
|
import server.partyquest.MapleCarnivalFactory;
|
||||||
|
import server.partyquest.MapleCarnivalFactory.MCSkill;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Matze
|
* @author Matze
|
||||||
@@ -129,6 +132,8 @@ public class MapleStatEffect {
|
|||||||
private boolean overTime, repeatEffect;
|
private boolean overTime, repeatEffect;
|
||||||
private int sourceid;
|
private int sourceid;
|
||||||
private int moveTo;
|
private int moveTo;
|
||||||
|
private int cp, nuffSkill;
|
||||||
|
private List<MapleDisease> cureDebuffs;
|
||||||
private boolean skill;
|
private boolean skill;
|
||||||
private List<Pair<MapleBuffStat, Integer>> statups;
|
private List<Pair<MapleBuffStat, Integer>> statups;
|
||||||
private Map<MonsterStatus, Integer> monsterStatus;
|
private Map<MonsterStatus, Integer> monsterStatus;
|
||||||
@@ -155,15 +160,13 @@ public class MapleStatEffect {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static byte mapProtection(int sourceid) {
|
private static byte mapProtection(int sourceid) {
|
||||||
if(sourceid == 2022001 || sourceid == 2022186) {
|
if (sourceid == 2022001 || sourceid == 2022186) {
|
||||||
return 1; //elnath cold
|
return 1; //elnath cold
|
||||||
}
|
} else if (sourceid == 2022040) {
|
||||||
|
|
||||||
else if(sourceid == 2022040) {
|
|
||||||
return 2; //aqua road underwater
|
return 2; //aqua road underwater
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
else return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static MapleStatEffect loadFromData(MapleData source, int sourceid, boolean skill, boolean overTime) {
|
private static MapleStatEffect loadFromData(MapleData source, int sourceid, boolean skill, boolean overTime) {
|
||||||
@@ -177,6 +180,27 @@ public class MapleStatEffect {
|
|||||||
ret.hpCon = (short) MapleDataTool.getInt("hpCon", source, 0);
|
ret.hpCon = (short) MapleDataTool.getInt("hpCon", source, 0);
|
||||||
int iprop = MapleDataTool.getInt("prop", source, 100);
|
int iprop = MapleDataTool.getInt("prop", source, 100);
|
||||||
ret.prop = iprop / 100.0;
|
ret.prop = iprop / 100.0;
|
||||||
|
|
||||||
|
ret.cp = MapleDataTool.getInt("cp", source, 0);
|
||||||
|
List<MapleDisease> cure = new ArrayList<MapleDisease>(5);
|
||||||
|
if (MapleDataTool.getInt("poison", source, 0) > 0) {
|
||||||
|
cure.add(MapleDisease.POISON);
|
||||||
|
}
|
||||||
|
if (MapleDataTool.getInt("seal", source, 0) > 0) {
|
||||||
|
cure.add(MapleDisease.SEAL);
|
||||||
|
}
|
||||||
|
if (MapleDataTool.getInt("darkness", source, 0) > 0) {
|
||||||
|
cure.add(MapleDisease.DARKNESS);
|
||||||
|
}
|
||||||
|
if (MapleDataTool.getInt("weakness", source, 0) > 0) {
|
||||||
|
cure.add(MapleDisease.WEAKEN);
|
||||||
|
}
|
||||||
|
if (MapleDataTool.getInt("curse", source, 0) > 0) {
|
||||||
|
cure.add(MapleDisease.CURSE);
|
||||||
|
}
|
||||||
|
ret.cureDebuffs = cure;
|
||||||
|
ret.nuffSkill = MapleDataTool.getInt("nuffSkill", source, 0);
|
||||||
|
|
||||||
ret.mobCount = MapleDataTool.getInt("mobCount", source, 1);
|
ret.mobCount = MapleDataTool.getInt("mobCount", source, 1);
|
||||||
ret.cooldown = MapleDataTool.getInt("cooltime", source, 0);
|
ret.cooldown = MapleDataTool.getInt("cooltime", source, 0);
|
||||||
ret.morphId = MapleDataTool.getInt("morph", source, 0);
|
ret.morphId = MapleDataTool.getInt("morph", source, 0);
|
||||||
@@ -208,15 +232,15 @@ public class MapleStatEffect {
|
|||||||
addBuffStatPairToListIfNotZero(statups, MapleBuffStat.MAP_PROTECTION, Integer.valueOf(ret.mapProtection));
|
addBuffStatPairToListIfNotZero(statups, MapleBuffStat.MAP_PROTECTION, Integer.valueOf(ret.mapProtection));
|
||||||
|
|
||||||
if (ret.overTime && ret.getSummonMovementType() == null) {
|
if (ret.overTime && ret.getSummonMovementType() == null) {
|
||||||
if(!skill) {
|
if (!skill) {
|
||||||
if(isPyramidBuff(sourceid)) {
|
if (isPyramidBuff(sourceid)) {
|
||||||
ret.berserk = MapleDataTool.getInt("berserk", source, 0);
|
ret.berserk = MapleDataTool.getInt("berserk", source, 0);
|
||||||
ret.booster = MapleDataTool.getInt("booster", source, 0);
|
ret.booster = MapleDataTool.getInt("booster", source, 0);
|
||||||
|
|
||||||
addBuffStatPairToListIfNotZero(statups, MapleBuffStat.BERSERK, Integer.valueOf(ret.berserk));
|
addBuffStatPairToListIfNotZero(statups, MapleBuffStat.BERSERK, Integer.valueOf(ret.berserk));
|
||||||
addBuffStatPairToListIfNotZero(statups, MapleBuffStat.BOOSTER, Integer.valueOf(ret.booster));
|
addBuffStatPairToListIfNotZero(statups, MapleBuffStat.BOOSTER, Integer.valueOf(ret.booster));
|
||||||
|
|
||||||
} else if(isDojoBuff(sourceid) || isHpMpRecovery(sourceid)) {
|
} else if (isDojoBuff(sourceid) || isHpMpRecovery(sourceid)) {
|
||||||
ret.mhpR = (byte) MapleDataTool.getInt("mhpR", source, 0);
|
ret.mhpR = (byte) MapleDataTool.getInt("mhpR", source, 0);
|
||||||
ret.mhpRRate = (short) (MapleDataTool.getInt("mhpRRate", source, 0) * 100);
|
ret.mhpRRate = (short) (MapleDataTool.getInt("mhpRRate", source, 0) * 100);
|
||||||
ret.mmpR = (byte) MapleDataTool.getInt("mmpR", source, 0);
|
ret.mmpR = (byte) MapleDataTool.getInt("mmpR", source, 0);
|
||||||
@@ -225,8 +249,8 @@ public class MapleStatEffect {
|
|||||||
addBuffStatPairToListIfNotZero(statups, MapleBuffStat.HPREC, Integer.valueOf(ret.mhpR));
|
addBuffStatPairToListIfNotZero(statups, MapleBuffStat.HPREC, Integer.valueOf(ret.mhpR));
|
||||||
addBuffStatPairToListIfNotZero(statups, MapleBuffStat.MPREC, Integer.valueOf(ret.mmpR));
|
addBuffStatPairToListIfNotZero(statups, MapleBuffStat.MPREC, Integer.valueOf(ret.mmpR));
|
||||||
|
|
||||||
} else if(isRateCoupon(sourceid)) {
|
} else if (isRateCoupon(sourceid)) {
|
||||||
switch(MapleDataTool.getInt("expR", source, 0)) {
|
switch (MapleDataTool.getInt("expR", source, 0)) {
|
||||||
case 1:
|
case 1:
|
||||||
addBuffStatPairToListIfNotZero(statups, MapleBuffStat.COUPON_EXP1, 1);
|
addBuffStatPairToListIfNotZero(statups, MapleBuffStat.COUPON_EXP1, 1);
|
||||||
break;
|
break;
|
||||||
@@ -244,7 +268,7 @@ public class MapleStatEffect {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(MapleDataTool.getInt("drpR", source, 0)) {
|
switch (MapleDataTool.getInt("drpR", source, 0)) {
|
||||||
case 1:
|
case 1:
|
||||||
addBuffStatPairToListIfNotZero(statups, MapleBuffStat.COUPON_DRP1, 1);
|
addBuffStatPairToListIfNotZero(statups, MapleBuffStat.COUPON_DRP1, 1);
|
||||||
break;
|
break;
|
||||||
@@ -257,14 +281,14 @@ public class MapleStatEffect {
|
|||||||
addBuffStatPairToListIfNotZero(statups, MapleBuffStat.COUPON_DRP3, 1);
|
addBuffStatPairToListIfNotZero(statups, MapleBuffStat.COUPON_DRP3, 1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else if(isExpIncrease(sourceid)) {
|
} else if (isExpIncrease(sourceid)) {
|
||||||
addBuffStatPairToListIfNotZero(statups, MapleBuffStat.EXP_INCREASE, MapleDataTool.getInt("expinc", source, 0));
|
addBuffStatPairToListIfNotZero(statups, MapleBuffStat.EXP_INCREASE, MapleDataTool.getInt("expinc", source, 0));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(isMapChair(sourceid)) {
|
if (isMapChair(sourceid)) {
|
||||||
addBuffStatPairToListIfNotZero(statups, MapleBuffStat.MAP_CHAIR, 1);
|
addBuffStatPairToListIfNotZero(statups, MapleBuffStat.MAP_CHAIR, 1);
|
||||||
} else if((sourceid == Beginner.NIMBLE_FEET || sourceid == Noblesse.NIMBLE_FEET || sourceid == Evan.NIMBLE_FEET || sourceid == Legend.AGILE_BODY) && ServerConstants.USE_ULTRA_NIMBLE_FEET == true) {
|
} else if ((sourceid == Beginner.NIMBLE_FEET || sourceid == Noblesse.NIMBLE_FEET || sourceid == Evan.NIMBLE_FEET || sourceid == Legend.AGILE_BODY) && ServerConstants.USE_ULTRA_NIMBLE_FEET == true) {
|
||||||
ret.jump = (short)(ret.speed * 4);
|
ret.jump = (short) (ret.speed * 4);
|
||||||
ret.speed *= 15;
|
ret.speed *= 15;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -284,7 +308,7 @@ public class MapleStatEffect {
|
|||||||
ret.lt = (Point) ltd.getData();
|
ret.lt = (Point) ltd.getData();
|
||||||
ret.rb = (Point) source.getChildByPath("rb").getData();
|
ret.rb = (Point) source.getChildByPath("rb").getData();
|
||||||
|
|
||||||
if(ServerConstants.USE_MAXRANGE_ECHO_OF_HERO && (sourceid == Beginner.ECHO_OF_HERO || sourceid == Noblesse.ECHO_OF_HERO || sourceid == Legend.ECHO_OF_HERO || sourceid == Evan.ECHO_OF_HERO)) {
|
if (ServerConstants.USE_MAXRANGE_ECHO_OF_HERO && (sourceid == Beginner.ECHO_OF_HERO || sourceid == Noblesse.ECHO_OF_HERO || sourceid == Legend.ECHO_OF_HERO || sourceid == Evan.ECHO_OF_HERO)) {
|
||||||
ret.lt = new Point(Integer.MIN_VALUE, Integer.MIN_VALUE);
|
ret.lt = new Point(Integer.MIN_VALUE, Integer.MIN_VALUE);
|
||||||
ret.rb = new Point(Integer.MAX_VALUE, Integer.MAX_VALUE);
|
ret.rb = new Point(Integer.MAX_VALUE, Integer.MAX_VALUE);
|
||||||
}
|
}
|
||||||
@@ -292,7 +316,7 @@ public class MapleStatEffect {
|
|||||||
|
|
||||||
int x = MapleDataTool.getInt("x", source, 0);
|
int x = MapleDataTool.getInt("x", source, 0);
|
||||||
|
|
||||||
if((sourceid == Beginner.RECOVERY || sourceid == Noblesse.RECOVERY || sourceid == Evan.RECOVERY || sourceid == Legend.RECOVERY) && ServerConstants.USE_ULTRA_RECOVERY == true) {
|
if ((sourceid == Beginner.RECOVERY || sourceid == Noblesse.RECOVERY || sourceid == Evan.RECOVERY || sourceid == Legend.RECOVERY) && ServerConstants.USE_ULTRA_RECOVERY == true) {
|
||||||
x *= 10;
|
x *= 10;
|
||||||
}
|
}
|
||||||
ret.x = x;
|
ret.x = x;
|
||||||
@@ -759,7 +783,7 @@ public class MapleStatEffect {
|
|||||||
int mpchange = calcMPChange(applyfrom, primary);
|
int mpchange = calcMPChange(applyfrom, primary);
|
||||||
if (primary) {
|
if (primary) {
|
||||||
if (itemConNo != 0) {
|
if (itemConNo != 0) {
|
||||||
if(!applyto.getClient().getAbstractPlayerInteraction().hasItem(itemCon, itemConNo)) {
|
if (!applyto.getClient().getAbstractPlayerInteraction().hasItem(itemCon, itemConNo)) {
|
||||||
applyto.announce(MaplePacketCreator.enableActions());
|
applyto.announce(MaplePacketCreator.enableActions());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -796,11 +820,13 @@ public class MapleStatEffect {
|
|||||||
MaplePortal pt;
|
MaplePortal pt;
|
||||||
|
|
||||||
if (moveTo == 999999999) {
|
if (moveTo == 999999999) {
|
||||||
if(sourceid != 2030100) {
|
if (sourceid != 2030100) {
|
||||||
target = applyto.getMap().getReturnMap();
|
target = applyto.getMap().getReturnMap();
|
||||||
pt = target.getRandomPlayerSpawnpoint();
|
pt = target.getRandomPlayerSpawnpoint();
|
||||||
} else {
|
} else {
|
||||||
if(!applyto.canRecoverLastBanish()) return false;
|
if (!applyto.canRecoverLastBanish()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
Pair<Integer, Integer> lastBanishInfo = applyto.getLastBanishData();
|
Pair<Integer, Integer> lastBanishInfo = applyto.getLastBanishData();
|
||||||
target = applyto.getWarpMap(lastBanishInfo.getLeft());
|
target = applyto.getWarpMap(lastBanishInfo.getLeft());
|
||||||
@@ -842,7 +868,7 @@ public class MapleStatEffect {
|
|||||||
SummonMovementType summonMovementType = getSummonMovementType();
|
SummonMovementType summonMovementType = getSummonMovementType();
|
||||||
if (overTime || isCygnusFA() || summonMovementType != null) {
|
if (overTime || isCygnusFA() || summonMovementType != null) {
|
||||||
if (summonMovementType != null && pos != null) {
|
if (summonMovementType != null && pos != null) {
|
||||||
if(summonMovementType.getValue() == summonMovementType.STATIONARY.getValue()) {
|
if (summonMovementType.getValue() == summonMovementType.STATIONARY.getValue()) {
|
||||||
applyto.cancelBuffStats(MapleBuffStat.PUPPET);
|
applyto.cancelBuffStats(MapleBuffStat.PUPPET);
|
||||||
} else {
|
} else {
|
||||||
applyto.cancelBuffStats(MapleBuffStat.SUMMON);
|
applyto.cancelBuffStats(MapleBuffStat.SUMMON);
|
||||||
@@ -885,7 +911,7 @@ public class MapleStatEffect {
|
|||||||
Point doorPosition = new Point(applyto.getPosition().x, y);
|
Point doorPosition = new Point(applyto.getPosition().x, y);
|
||||||
MapleDoor door = new MapleDoor(applyto, doorPosition);
|
MapleDoor door = new MapleDoor(applyto, doorPosition);
|
||||||
|
|
||||||
if(door.getOwnerId() >= 0) {
|
if (door.getOwnerId() >= 0) {
|
||||||
applyto.applyPartyDoor(door, false);
|
applyto.applyPartyDoor(door, false);
|
||||||
|
|
||||||
door.getTarget().spawnDoor(door.getAreaDoor());
|
door.getTarget().spawnDoor(door.getAreaDoor());
|
||||||
@@ -895,9 +921,13 @@ public class MapleStatEffect {
|
|||||||
} else {
|
} else {
|
||||||
MapleInventoryManipulator.addFromDrop(applyto.getClient(), new Item(4006000, (short) 0, (short) 1), false);
|
MapleInventoryManipulator.addFromDrop(applyto.getClient(), new Item(4006000, (short) 0, (short) 1), false);
|
||||||
|
|
||||||
if(door.getOwnerId() == -3) applyto.dropMessage(5, "Mystic Door cannot be cast far from a spawn point. Nearest one is at " + door.getDoorStatus().getRight() + "pts " + door.getDoorStatus().getLeft());
|
if (door.getOwnerId() == -3) {
|
||||||
else if(door.getOwnerId() == -2) applyto.dropMessage(5, "Mystic Door cannot be cast on a slope, try elsewhere.");
|
applyto.dropMessage(5, "Mystic Door cannot be cast far from a spawn point. Nearest one is at " + door.getDoorStatus().getRight() + "pts " + door.getDoorStatus().getLeft());
|
||||||
else applyto.dropMessage(5, "There are no door portals available for the town at this moment. Try again later.");
|
} else if (door.getOwnerId() == -2) {
|
||||||
|
applyto.dropMessage(5, "Mystic Door cannot be cast on a slope, try elsewhere.");
|
||||||
|
} else {
|
||||||
|
applyto.dropMessage(5, "There are no door portals available for the town at this moment. Try again later.");
|
||||||
|
}
|
||||||
|
|
||||||
applyto.cancelBuffStats(MapleBuffStat.SOULARROW); // cancel door buff
|
applyto.cancelBuffStats(MapleBuffStat.SOULARROW); // cancel door buff
|
||||||
}
|
}
|
||||||
@@ -907,6 +937,43 @@ public class MapleStatEffect {
|
|||||||
applyfrom.getMap().spawnMist(mist, getDuration(), mist.isPoisonMist(), false, mist.isRecoveryMist());
|
applyfrom.getMap().spawnMist(mist, getDuration(), mist.isPoisonMist(), false, mist.isRecoveryMist());
|
||||||
} else if (isTimeLeap()) {
|
} else if (isTimeLeap()) {
|
||||||
applyto.removeAllCooldownsExcept(Buccaneer.TIME_LEAP, true);
|
applyto.removeAllCooldownsExcept(Buccaneer.TIME_LEAP, true);
|
||||||
|
} else if (cp != 0 && applyto.getMonsterCarnival() != null) {
|
||||||
|
applyto.gainCP(cp);
|
||||||
|
} else if (nuffSkill != 0 && applyto.getParty() != null && applyto.getMap().isCPQMap()) {
|
||||||
|
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());
|
||||||
|
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());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (cureDebuffs.size() > 0) {
|
||||||
|
for (final MapleDisease debuff : cureDebuffs) {
|
||||||
|
if (applyfrom.getParty() != null) {
|
||||||
|
for (MaplePartyCharacter chrs : applyfrom.getParty().getPartyMembers()) {
|
||||||
|
chrs.getPlayer().dispelDebuff(debuff);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
applyfrom.dispelDebuff(debuff);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -1030,8 +1097,8 @@ public class MapleStatEffect {
|
|||||||
localDuration = alchemistModifyVal(target, localDuration, false);
|
localDuration = alchemistModifyVal(target, localDuration, false);
|
||||||
|
|
||||||
long leftDuration = (starttime + localDuration) - Server.getInstance().getCurrentTime();
|
long leftDuration = (starttime + localDuration) - Server.getInstance().getCurrentTime();
|
||||||
if(leftDuration > 0) {
|
if (leftDuration > 0) {
|
||||||
target.announce(MaplePacketCreator.giveBuff((skill ? sourceid : -sourceid), (int)leftDuration, activeStats));
|
target.announce(MaplePacketCreator.giveBuff((skill ? sourceid : -sourceid), (int) leftDuration, activeStats));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1089,8 +1156,8 @@ public class MapleStatEffect {
|
|||||||
localsourceid = ridingMountId;
|
localsourceid = ridingMountId;
|
||||||
localstatups = Collections.singletonList(new Pair<>(MapleBuffStat.MONSTER_RIDING, 0));
|
localstatups = Collections.singletonList(new Pair<>(MapleBuffStat.MONSTER_RIDING, 0));
|
||||||
} else if (isSkillMorph()) {
|
} else if (isSkillMorph()) {
|
||||||
for(int i = 0; i < localstatups.size(); i++) {
|
for (int i = 0; i < localstatups.size(); i++) {
|
||||||
if(localstatups.get(i).getLeft().equals(MapleBuffStat.MORPH)) {
|
if (localstatups.get(i).getLeft().equals(MapleBuffStat.MORPH)) {
|
||||||
localstatups.set(i, new Pair<>(MapleBuffStat.MORPH, getMorph(applyto)));
|
localstatups.set(i, new Pair<>(MapleBuffStat.MORPH, getMorph(applyto)));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1355,7 +1422,6 @@ public class MapleStatEffect {
|
|||||||
return sourceid == Beginner.MAP_CHAIR || sourceid == Noblesse.MAP_CHAIR || sourceid == Legend.MAP_CHAIR;
|
return sourceid == Beginner.MAP_CHAIR || sourceid == Noblesse.MAP_CHAIR || sourceid == Legend.MAP_CHAIR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public boolean isDojoBuff() {
|
public boolean isDojoBuff() {
|
||||||
return sourceid >= 2022359 && sourceid <= 2022421;
|
return sourceid >= 2022359 && sourceid <= 2022421;
|
||||||
}
|
}
|
||||||
@@ -1463,13 +1529,15 @@ public class MapleStatEffect {
|
|||||||
private boolean isCureAllAbnormalStatus() {
|
private boolean isCureAllAbnormalStatus() {
|
||||||
if (skill) {
|
if (skill) {
|
||||||
return isHerosWill(sourceid);
|
return isHerosWill(sourceid);
|
||||||
} else if (sourceid == 2022544) return true;
|
} else if (sourceid == 2022544) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isHerosWill(int skillid) {
|
public static boolean isHerosWill(int skillid) {
|
||||||
switch(skillid) {
|
switch (skillid) {
|
||||||
case Hero.HEROS_WILL:
|
case Hero.HEROS_WILL:
|
||||||
case Paladin.HEROS_WILL:
|
case Paladin.HEROS_WILL:
|
||||||
case DarkKnight.HEROS_WILL:
|
case DarkKnight.HEROS_WILL:
|
||||||
@@ -1561,7 +1629,6 @@ public class MapleStatEffect {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public boolean hasNoIcon() {
|
public boolean hasNoIcon() {
|
||||||
return (sourceid == 3111002 || sourceid == 3211002 || + // puppet, puppet
|
return (sourceid == 3111002 || sourceid == 3211002 || + // puppet, puppet
|
||||||
sourceid == 3211005 || + // golden eagle
|
sourceid == 3211005 || + // golden eagle
|
||||||
@@ -1610,7 +1677,6 @@ public class MapleStatEffect {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public short getHp() {
|
public short getHp() {
|
||||||
return hp;
|
return hp;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -75,6 +75,7 @@ import server.MapleStatEffect;
|
|||||||
import server.maps.MapleSummon;
|
import server.maps.MapleSummon;
|
||||||
|
|
||||||
public class MapleMonster extends AbstractLoadedMapleLife {
|
public class MapleMonster extends AbstractLoadedMapleLife {
|
||||||
|
|
||||||
private ChangeableStats ostats = null; //unused, v83 WZs offers no support for changeable stats.
|
private ChangeableStats ostats = null; //unused, v83 WZs offers no support for changeable stats.
|
||||||
private MapleMonsterStats stats;
|
private MapleMonsterStats stats;
|
||||||
private AtomicInteger hp = new AtomicInteger(1);
|
private AtomicInteger hp = new AtomicInteger(1);
|
||||||
@@ -161,7 +162,7 @@ public class MapleMonster extends AbstractLoadedMapleLife {
|
|||||||
|
|
||||||
public int countAvailableMobSummons(int limit, int skillLimit) { // limit prop for summons has another conotation, found thanks to MedicOP
|
public int countAvailableMobSummons(int limit, int skillLimit) { // limit prop for summons has another conotation, found thanks to MedicOP
|
||||||
Set<Integer> calledOids = this.calledMobOids;
|
Set<Integer> calledOids = this.calledMobOids;
|
||||||
if(calledOids != null) {
|
if (calledOids != null) {
|
||||||
limit -= calledOids.size();
|
limit -= calledOids.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -216,7 +217,9 @@ public class MapleMonster extends AbstractLoadedMapleLife {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public synchronized void addHp(int hp) {
|
public synchronized void addHp(int hp) {
|
||||||
if(this.hp.get() <= 0) return;
|
if (this.hp.get() <= 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.hp.addAndGet(hp);
|
this.hp.addAndGet(hp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -300,18 +303,20 @@ public class MapleMonster extends AbstractLoadedMapleLife {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean applyAnimationIfRoaming(int attackPos, MobSkill skill) { // roam: not casting attack or skill animations
|
private boolean applyAnimationIfRoaming(int attackPos, MobSkill skill) { // roam: not casting attack or skill animations
|
||||||
if(!animationLock.tryLock()) return false;
|
if (!animationLock.tryLock()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
long animationTime;
|
long animationTime;
|
||||||
|
|
||||||
if(skill == null) {
|
if (skill == null) {
|
||||||
animationTime = MapleMonsterInformationProvider.getInstance().getMobAttackAnimationTime(this.getId(), attackPos);
|
animationTime = MapleMonsterInformationProvider.getInstance().getMobAttackAnimationTime(this.getId(), attackPos);
|
||||||
} else {
|
} else {
|
||||||
animationTime = MapleMonsterInformationProvider.getInstance().getMobSkillAnimationTime(skill);
|
animationTime = MapleMonsterInformationProvider.getInstance().getMobSkillAnimationTime(skill);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(animationTime > 0) {
|
if (animationTime > 0) {
|
||||||
return map.getChannelServer().registerMobOnAnimationEffect(map.getId(), this.hashCode(), animationTime);
|
return map.getChannelServer().registerMobOnAnimationEffect(map.getId(), this.hashCode(), animationTime);
|
||||||
} else {
|
} else {
|
||||||
return true;
|
return true;
|
||||||
@@ -327,8 +332,10 @@ public class MapleMonster extends AbstractLoadedMapleLife {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(delta >= 0) {
|
if (delta >= 0) {
|
||||||
if(stayAlive) curHp--;
|
if (stayAlive) {
|
||||||
|
curHp--;
|
||||||
|
}
|
||||||
int trueDamage = Math.min(curHp, delta);
|
int trueDamage = Math.min(curHp, delta);
|
||||||
|
|
||||||
hp.addAndGet(-trueDamage);
|
hp.addAndGet(-trueDamage);
|
||||||
@@ -402,7 +409,6 @@ public class MapleMonster extends AbstractLoadedMapleLife {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (damage > 0) {
|
if (damage > 0) {
|
||||||
this.applyDamage(attacker, damage, stayAlive);
|
this.applyDamage(attacker, damage, stayAlive);
|
||||||
if (!this.isAlive()) { // monster just died
|
if (!this.isAlive()) { // monster just died
|
||||||
@@ -428,7 +434,9 @@ public class MapleMonster extends AbstractLoadedMapleLife {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(ServerConstants.USE_DEBUG) from.dropMessage(5, "Hitted MOB " + this.getId() + ", OID " + this.getObjectId());
|
if (ServerConstants.USE_DEBUG) {
|
||||||
|
from.dropMessage(5, "Hitted MOB " + this.getId() + ", OID " + this.getObjectId());
|
||||||
|
}
|
||||||
dispatchMonsterDamaged(from, trueDamage);
|
dispatchMonsterDamaged(from, trueDamage);
|
||||||
|
|
||||||
if (!takenDamage.containsKey(from.getId())) {
|
if (!takenDamage.containsKey(from.getId())) {
|
||||||
@@ -442,7 +450,9 @@ public class MapleMonster extends AbstractLoadedMapleLife {
|
|||||||
|
|
||||||
public void heal(int hp, int mp) {
|
public void heal(int hp, int mp) {
|
||||||
Integer hpHealed = applyAndGetHpDamage(-hp, false);
|
Integer hpHealed = applyAndGetHpDamage(-hp, false);
|
||||||
if(hpHealed == null) return;
|
if (hpHealed == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
int mp2Heal = getMp() + mp;
|
int mp2Heal = getMp() + mp;
|
||||||
int maxMp = getMaxMp();
|
int maxMp = getMaxMp();
|
||||||
@@ -451,7 +461,9 @@ public class MapleMonster extends AbstractLoadedMapleLife {
|
|||||||
}
|
}
|
||||||
setMp(mp2Heal);
|
setMp(mp2Heal);
|
||||||
|
|
||||||
if(hp > 0) getMap().broadcastMessage(MaplePacketCreator.healMonster(getObjectId(), hp, getHp(), getMaxHp()));
|
if (hp > 0) {
|
||||||
|
getMap().broadcastMessage(MaplePacketCreator.healMonster(getObjectId(), hp, getHp(), getMaxHp()));
|
||||||
|
}
|
||||||
|
|
||||||
maxHpPlusHeal.addAndGet(hpHealed);
|
maxHpPlusHeal.addAndGet(hpHealed);
|
||||||
dispatchMonsterHealed(hpHealed);
|
dispatchMonsterHealed(hpHealed);
|
||||||
@@ -464,13 +476,15 @@ public class MapleMonster extends AbstractLoadedMapleLife {
|
|||||||
private void distributeExperienceToParty(int pid, float exp, int killer, int killerLevel, Set<MapleCharacter> underleveled, int minThresholdLevel) {
|
private void distributeExperienceToParty(int pid, float exp, int killer, int killerLevel, Set<MapleCharacter> underleveled, int minThresholdLevel) {
|
||||||
List<MapleCharacter> members = new LinkedList<>();
|
List<MapleCharacter> members = new LinkedList<>();
|
||||||
MapleCharacter pchar = getMap().getAnyCharacterFromParty(pid);
|
MapleCharacter pchar = getMap().getAnyCharacterFromParty(pid);
|
||||||
if(pchar != null) {
|
if (pchar != null) {
|
||||||
for(MapleCharacter chr : pchar.getPartyMembersOnSameMap()) {
|
for (MapleCharacter chr : pchar.getPartyMembersOnSameMap()) {
|
||||||
members.add(chr);
|
members.add(chr);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
MapleCharacter chr = getMap().getCharacterById(killer);
|
MapleCharacter chr = getMap().getCharacterById(killer);
|
||||||
if(chr == null) return;
|
if (chr == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
members.add(chr);
|
members.add(chr);
|
||||||
}
|
}
|
||||||
@@ -505,7 +519,7 @@ public class MapleMonster extends AbstractLoadedMapleLife {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private int calcThresholdLevel(boolean isPqMob) {
|
private int calcThresholdLevel(boolean isPqMob) {
|
||||||
if(!ServerConstants.USE_ENFORCE_MOB_LEVEL_RANGE) {
|
if (!ServerConstants.USE_ENFORCE_MOB_LEVEL_RANGE) {
|
||||||
return 0;
|
return 0;
|
||||||
} else if (isPqMob) {
|
} else if (isPqMob) {
|
||||||
double thresholdLevel = getLevel();
|
double thresholdLevel = getLevel();
|
||||||
@@ -559,7 +573,7 @@ public class MapleMonster extends AbstractLoadedMapleLife {
|
|||||||
float pXP = xp + (partyExp.containsKey(pID) ? partyExp.get(pID) : 0);
|
float pXP = xp + (partyExp.containsKey(pID) ? partyExp.get(pID) : 0);
|
||||||
partyExp.put(pID, pXP);
|
partyExp.put(pID, pXP);
|
||||||
} else {
|
} else {
|
||||||
if(mc.getLevel() >= minThresholdLevel) {
|
if (mc.getLevel() >= minThresholdLevel) {
|
||||||
//NO EXP WILL BE GIVEN for those who are underleveled!
|
//NO EXP WILL BE GIVEN for those who are underleveled!
|
||||||
giveExpToCharacter(mc, xp, isKiller, 1);
|
giveExpToCharacter(mc, xp, isKiller, 1);
|
||||||
} else {
|
} else {
|
||||||
@@ -569,7 +583,7 @@ public class MapleMonster extends AbstractLoadedMapleLife {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!expDist.isEmpty()) { // locate on world server the partyid of the missing characters
|
if (!expDist.isEmpty()) { // locate on world server the partyid of the missing characters
|
||||||
World wserv = map.getWorldServer();
|
World wserv = map.getWorldServer();
|
||||||
|
|
||||||
for (Entry<Integer, Float> ed : expDist.entrySet()) {
|
for (Entry<Integer, Float> ed : expDist.entrySet()) {
|
||||||
@@ -591,7 +605,7 @@ public class MapleMonster extends AbstractLoadedMapleLife {
|
|||||||
distributeExperienceToParty(party.getKey(), party.getValue(), killerId, killerLevel, underleveled, minThresholdLevel);
|
distributeExperienceToParty(party.getKey(), party.getValue(), killerId, killerLevel, underleveled, minThresholdLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(MapleCharacter mc : underleveled) {
|
for (MapleCharacter mc : underleveled) {
|
||||||
mc.showUnderleveledInfo(this);
|
mc.showUnderleveledInfo(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -670,7 +684,7 @@ public class MapleMonster extends AbstractLoadedMapleLife {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(toSpawn.size() > 0) {
|
if (toSpawn.size() > 0) {
|
||||||
final EventInstanceManager eim = this.getMap().getEventInstance();
|
final EventInstanceManager eim = this.getMap().getEventInstance();
|
||||||
|
|
||||||
TimerManager.getInstance().schedule(new Runnable() {
|
TimerManager.getInstance().schedule(new Runnable() {
|
||||||
@@ -694,7 +708,7 @@ public class MapleMonster extends AbstractLoadedMapleLife {
|
|||||||
boolean htKilled = false;
|
boolean htKilled = false;
|
||||||
MapleMonster ht = reviveMap.getMonsterById(8810018);
|
MapleMonster ht = reviveMap.getMonsterById(8810018);
|
||||||
|
|
||||||
if(ht != null) {
|
if (ht != null) {
|
||||||
ht.lockMonster();
|
ht.lockMonster();
|
||||||
try {
|
try {
|
||||||
htKilled = ht.isAlive();
|
htKilled = ht.isAlive();
|
||||||
@@ -703,20 +717,20 @@ public class MapleMonster extends AbstractLoadedMapleLife {
|
|||||||
ht.unlockMonster();
|
ht.unlockMonster();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(htKilled) {
|
if (htKilled) {
|
||||||
reviveMap.killMonster(ht, killer, true);
|
reviveMap.killMonster(ht, killer, true);
|
||||||
ht.broadcastMobHpBar(killer);
|
ht.broadcastMobHpBar(killer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int i = 8810017; i >= 8810010; i--) {
|
for (int i = 8810017; i >= 8810010; i--) {
|
||||||
reviveMap.killMonster(reviveMap.getMonsterById(i), killer, true);
|
reviveMap.killMonster(reviveMap.getMonsterById(i), killer, true);
|
||||||
}
|
}
|
||||||
} else if (controller != null) {
|
} else if (controller != null) {
|
||||||
mob.aggroSwitchController(controller, aggro);
|
mob.aggroSwitchController(controller, aggro);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(eim != null) {
|
if (eim != null) {
|
||||||
eim.reviveMonster(mob);
|
eim.reviveMonster(mob);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -733,15 +747,15 @@ public class MapleMonster extends AbstractLoadedMapleLife {
|
|||||||
|
|
||||||
private void dispatchUpdateQuestMobCount() {
|
private void dispatchUpdateQuestMobCount() {
|
||||||
Set<Integer> attackerChrids = takenDamage.keySet();
|
Set<Integer> attackerChrids = takenDamage.keySet();
|
||||||
if(!attackerChrids.isEmpty()) {
|
if (!attackerChrids.isEmpty()) {
|
||||||
Map<Integer, MapleCharacter> mapChars = map.getMapPlayers();
|
Map<Integer, MapleCharacter> mapChars = map.getMapPlayers();
|
||||||
if(!mapChars.isEmpty()) {
|
if (!mapChars.isEmpty()) {
|
||||||
int mobid = getId();
|
int mobid = getId();
|
||||||
|
|
||||||
for (Integer chrid : attackerChrids) {
|
for (Integer chrid : attackerChrids) {
|
||||||
MapleCharacter chr = mapChars.get(chrid);
|
MapleCharacter chr = mapChars.get(chrid);
|
||||||
|
|
||||||
if(chr != null && chr.isLoggedinWorld()) {
|
if (chr != null && chr.isLoggedinWorld()) {
|
||||||
chr.updateQuestMobCount(mobid);
|
chr.updateQuestMobCount(mobid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -763,7 +777,7 @@ public class MapleMonster extends AbstractLoadedMapleLife {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private synchronized void processMonsterKilled(boolean hasKiller) {
|
private synchronized void processMonsterKilled(boolean hasKiller) {
|
||||||
if(!hasKiller) { // players won't gain EXP from a mob that has no killer, but a quest count they should
|
if (!hasKiller) { // players won't gain EXP from a mob that has no killer, but a quest count they should
|
||||||
dispatchUpdateQuestMobCount();
|
dispatchUpdateQuestMobCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -858,7 +872,9 @@ public class MapleMonster extends AbstractLoadedMapleLife {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void setControllerHasAggro(boolean controllerHasAggro) {
|
private void setControllerHasAggro(boolean controllerHasAggro) {
|
||||||
if (!fake) this.controllerHasAggro = controllerHasAggro;
|
if (!fake) {
|
||||||
|
this.controllerHasAggro = controllerHasAggro;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isControllerKnowsAboutAggro() {
|
public boolean isControllerKnowsAboutAggro() {
|
||||||
@@ -866,7 +882,9 @@ public class MapleMonster extends AbstractLoadedMapleLife {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void setControllerKnowsAboutAggro(boolean controllerKnowsAboutAggro) {
|
private void setControllerKnowsAboutAggro(boolean controllerKnowsAboutAggro) {
|
||||||
if (!fake) this.controllerKnowsAboutAggro = controllerKnowsAboutAggro;
|
if (!fake) {
|
||||||
|
this.controllerKnowsAboutAggro = controllerKnowsAboutAggro;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setControllerHasPuppet(boolean controllerHasPuppet) {
|
private void setControllerHasPuppet(boolean controllerHasPuppet) {
|
||||||
@@ -1020,7 +1038,7 @@ public class MapleMonster extends AbstractLoadedMapleLife {
|
|||||||
|
|
||||||
final Channel ch = map.getChannelServer();
|
final Channel ch = map.getChannelServer();
|
||||||
final int mapid = map.getId();
|
final int mapid = map.getId();
|
||||||
if(statis.size() > 0) {
|
if (statis.size() > 0) {
|
||||||
statiLock.lock();
|
statiLock.lock();
|
||||||
try {
|
try {
|
||||||
for (MonsterStatus stat : statis.keySet()) {
|
for (MonsterStatus stat : statis.keySet()) {
|
||||||
@@ -1138,6 +1156,19 @@ public class MapleMonster extends AbstractLoadedMapleLife {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public final void dispelSkill(final MobSkill skillId) {
|
||||||
|
List<MonsterStatus> toCancel = new ArrayList<MonsterStatus>();
|
||||||
|
for (Entry<MonsterStatus, MonsterStatusEffect> effects : stati.entrySet()) {
|
||||||
|
MonsterStatusEffect mse = effects.getValue();
|
||||||
|
if (mse.getMobSkill() != null && mse.getMobSkill().getSkillId() == skillId.getSkillId()) { //not checking for level.
|
||||||
|
toCancel.add(effects.getKey());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (MonsterStatus stat : toCancel) {
|
||||||
|
debuffMobStat(stat);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void applyMonsterBuff(final Map<MonsterStatus, Integer> stats, final int x, int skillId, long duration, MobSkill skill, final List<Integer> reflection) {
|
public void applyMonsterBuff(final Map<MonsterStatus, Integer> stats, final int x, int skillId, long duration, MobSkill skill, final List<Integer> reflection) {
|
||||||
final Runnable cancelTask = new Runnable() {
|
final Runnable cancelTask = new Runnable() {
|
||||||
|
|
||||||
@@ -1208,25 +1239,33 @@ public class MapleMonster extends AbstractLoadedMapleLife {
|
|||||||
MonsterStatus[] statups = {MonsterStatus.WEAPON_ATTACK_UP, MonsterStatus.WEAPON_DEFENSE_UP, MonsterStatus.MAGIC_ATTACK_UP, MonsterStatus.MAGIC_DEFENSE_UP};
|
MonsterStatus[] statups = {MonsterStatus.WEAPON_ATTACK_UP, MonsterStatus.WEAPON_DEFENSE_UP, MonsterStatus.MAGIC_ATTACK_UP, MonsterStatus.MAGIC_DEFENSE_UP};
|
||||||
statiLock.lock();
|
statiLock.lock();
|
||||||
try {
|
try {
|
||||||
if(skillid == Hermit.SHADOW_MESO) {
|
if (skillid == Hermit.SHADOW_MESO) {
|
||||||
debuffMobStat(statups[1]);
|
debuffMobStat(statups[1]);
|
||||||
debuffMobStat(statups[3]);
|
debuffMobStat(statups[3]);
|
||||||
} else if(skillid == Priest.DISPEL) {
|
} else if (skillid == Priest.DISPEL) {
|
||||||
for(MonsterStatus ms : statups) {
|
for (MonsterStatus ms : statups) {
|
||||||
debuffMobStat(ms);
|
debuffMobStat(ms);
|
||||||
}
|
}
|
||||||
} else { // is a crash skill
|
} else { // is a crash skill
|
||||||
int i = (skillid == Crusader.ARMOR_CRASH ? 1 : (skillid == WhiteKnight.MAGIC_CRASH ? 2 : 0));
|
int i = (skillid == Crusader.ARMOR_CRASH ? 1 : (skillid == WhiteKnight.MAGIC_CRASH ? 2 : 0));
|
||||||
debuffMobStat(statups[i]);
|
debuffMobStat(statups[i]);
|
||||||
|
|
||||||
if(ServerConstants.USE_ANTI_IMMUNITY_CRASH) {
|
if (ServerConstants.USE_ANTI_IMMUNITY_CRASH) {
|
||||||
if (skillid == Crusader.ARMOR_CRASH) {
|
if (skillid == Crusader.ARMOR_CRASH) {
|
||||||
if(!isBuffed(MonsterStatus.WEAPON_REFLECT)) debuffMobStat(MonsterStatus.WEAPON_IMMUNITY);
|
if (!isBuffed(MonsterStatus.WEAPON_REFLECT)) {
|
||||||
if(!isBuffed(MonsterStatus.MAGIC_REFLECT)) debuffMobStat(MonsterStatus.MAGIC_IMMUNITY);
|
debuffMobStat(MonsterStatus.WEAPON_IMMUNITY);
|
||||||
|
}
|
||||||
|
if (!isBuffed(MonsterStatus.MAGIC_REFLECT)) {
|
||||||
|
debuffMobStat(MonsterStatus.MAGIC_IMMUNITY);
|
||||||
|
}
|
||||||
} else if (skillid == WhiteKnight.MAGIC_CRASH) {
|
} else if (skillid == WhiteKnight.MAGIC_CRASH) {
|
||||||
if(!isBuffed(MonsterStatus.MAGIC_REFLECT)) debuffMobStat(MonsterStatus.MAGIC_IMMUNITY);
|
if (!isBuffed(MonsterStatus.MAGIC_REFLECT)) {
|
||||||
|
debuffMobStat(MonsterStatus.MAGIC_IMMUNITY);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if(!isBuffed(MonsterStatus.WEAPON_REFLECT)) debuffMobStat(MonsterStatus.WEAPON_IMMUNITY);
|
if (!isBuffed(MonsterStatus.WEAPON_REFLECT)) {
|
||||||
|
debuffMobStat(MonsterStatus.WEAPON_IMMUNITY);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1323,7 +1362,6 @@ public class MapleMonster extends AbstractLoadedMapleLife {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
this.usedSkill(toUse);
|
this.usedSkill(toUse);
|
||||||
} finally {
|
} finally {
|
||||||
monsterLock.unlock();
|
monsterLock.unlock();
|
||||||
@@ -1407,7 +1445,6 @@ public class MapleMonster extends AbstractLoadedMapleLife {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
usedAttack(attackPos, mpCon, attackInfo.getRight());
|
usedAttack(attackPos, mpCon, attackInfo.getRight());
|
||||||
return 1;
|
return 1;
|
||||||
} finally {
|
} finally {
|
||||||
@@ -1476,7 +1513,7 @@ public class MapleMonster extends AbstractLoadedMapleLife {
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
int curHp = hp.get();
|
int curHp = hp.get();
|
||||||
if(curHp <= 1) {
|
if (curHp <= 1) {
|
||||||
map.getChannelServer().interruptMobStatus(map.getId(), status);
|
map.getChannelServer().interruptMobStatus(map.getId(), status);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1499,7 +1536,7 @@ public class MapleMonster extends AbstractLoadedMapleLife {
|
|||||||
if (type == 1) {
|
if (type == 1) {
|
||||||
map.broadcastMessage(MaplePacketCreator.damageMonster(getObjectId(), damage), getPosition());
|
map.broadcastMessage(MaplePacketCreator.damageMonster(getObjectId(), damage), getPosition());
|
||||||
} else if (type == 2) {
|
} else if (type == 2) {
|
||||||
if(damage < dealDamage) { // ninja ambush (type 2) is already displaying DOT to the caster
|
if (damage < dealDamage) { // ninja ambush (type 2) is already displaying DOT to the caster
|
||||||
map.broadcastMessage(MaplePacketCreator.damageMonster(getObjectId(), damage), getPosition());
|
map.broadcastMessage(MaplePacketCreator.damageMonster(getObjectId(), damage), getPosition());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1592,7 +1629,6 @@ public class MapleMonster extends AbstractLoadedMapleLife {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ---- one can always have fun trying these pieces of codes below in-game rofl ----
|
// ---- one can always have fun trying these pieces of codes below in-game rofl ----
|
||||||
|
|
||||||
public final ChangeableStats getChangedStats() {
|
public final ChangeableStats getChangedStats() {
|
||||||
return ostats;
|
return ostats;
|
||||||
}
|
}
|
||||||
@@ -1624,19 +1660,24 @@ public class MapleMonster extends AbstractLoadedMapleLife {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private float getDifficultyRate(final int difficulty) {
|
private float getDifficultyRate(final int difficulty) {
|
||||||
switch(difficulty) {
|
switch (difficulty) {
|
||||||
case 6: return(7.7f);
|
case 6:
|
||||||
case 5: return(5.6f);
|
return (7.7f);
|
||||||
case 4: return(3.2f);
|
case 5:
|
||||||
case 3: return(2.1f);
|
return (5.6f);
|
||||||
case 2: return(1.4f);
|
case 4:
|
||||||
|
return (3.2f);
|
||||||
|
case 3:
|
||||||
|
return (2.1f);
|
||||||
|
case 2:
|
||||||
|
return (1.4f);
|
||||||
}
|
}
|
||||||
|
|
||||||
return(1.0f);
|
return (1.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void changeLevelByDifficulty(final int difficulty, boolean pqMob) {
|
private void changeLevelByDifficulty(final int difficulty, boolean pqMob) {
|
||||||
changeLevel((int)(this.getLevel() * getDifficultyRate(difficulty)), pqMob);
|
changeLevel((int) (this.getLevel() * getDifficultyRate(difficulty)), pqMob);
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void changeDifficulty(final int difficulty, boolean pqMob) {
|
public final void changeDifficulty(final int difficulty, boolean pqMob) {
|
||||||
@@ -1818,8 +1859,8 @@ public class MapleMonster extends AbstractLoadedMapleLife {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Finds a new controller for the given monster from the chars with deployed puppet
|
* Finds a new controller for the given monster from the chars with deployed
|
||||||
* nearby on the map it is from...
|
* puppet nearby on the map it is from...
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private void aggroUpdatePuppetController(MapleCharacter newController) {
|
private void aggroUpdatePuppetController(MapleCharacter newController) {
|
||||||
@@ -1916,8 +1957,8 @@ public class MapleMonster extends AbstractLoadedMapleLife {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Applied damage input for this mob, enough damage taken implies
|
* Applied damage input for this mob, enough damage taken implies an aggro
|
||||||
* an aggro target update for the attacker shortly.
|
* target update for the attacker shortly.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public void aggroMonsterDamage(MapleCharacter attacker, int damage) {
|
public void aggroMonsterDamage(MapleCharacter attacker, int damage) {
|
||||||
@@ -1970,7 +2011,9 @@ public class MapleMonster extends AbstractLoadedMapleLife {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void aggroUpdatePuppetVisibility() {
|
public void aggroUpdatePuppetVisibility() {
|
||||||
if (!availablePuppetUpdate) return;
|
if (!availablePuppetUpdate) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
availablePuppetUpdate = false;
|
availablePuppetUpdate = false;
|
||||||
Runnable r = new Runnable() {
|
Runnable r = new Runnable() {
|
||||||
@@ -1978,7 +2021,9 @@ public class MapleMonster extends AbstractLoadedMapleLife {
|
|||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
MapleCharacter chrController = MapleMonster.this.getActiveController();
|
MapleCharacter chrController = MapleMonster.this.getActiveController();
|
||||||
if (chrController == null) return;
|
if (chrController == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
MapleStatEffect puppetEffect = chrController.getBuffEffect(MapleBuffStat.PUPPET);
|
MapleStatEffect puppetEffect = chrController.getBuffEffect(MapleBuffStat.PUPPET);
|
||||||
if (puppetEffect != null) {
|
if (puppetEffect != null) {
|
||||||
@@ -2008,7 +2053,8 @@ public class MapleMonster extends AbstractLoadedMapleLife {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clears all applied damage input for this mob, doesn't refresh target aggro.
|
* Clears all applied damage input for this mob, doesn't refresh target
|
||||||
|
* aggro.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public void aggroClearDamages() {
|
public void aggroClearDamages() {
|
||||||
@@ -2049,4 +2095,8 @@ public class MapleMonster extends AbstractLoadedMapleLife {
|
|||||||
statiLock = statiLock.dispose();
|
statiLock = statiLock.dispose();
|
||||||
animationLock = animationLock.dispose();
|
animationLock = animationLock.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public final int getRemoveAfter() {
|
||||||
|
return stats.removeAfter();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -143,26 +143,29 @@ public class MapleMonsterInformationProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
List<MonsterDropEntry> multiDrops = extraMultiEquipDrops.get(monsterId), extra = new LinkedList<>();
|
List<MonsterDropEntry> multiDrops = extraMultiEquipDrops.get(monsterId), extra = new LinkedList<>();
|
||||||
if(multiDrops == null) {
|
if (multiDrops == null) {
|
||||||
multiDrops = new LinkedList<>();
|
multiDrops = new LinkedList<>();
|
||||||
|
|
||||||
for(MonsterDropEntry mde : list) {
|
for (MonsterDropEntry mde : list) {
|
||||||
if(ItemConstants.isEquipment(mde.itemId) && mde.Maximum > 1) {
|
if (ItemConstants.isEquipment(mde.itemId) && mde.Maximum > 1) {
|
||||||
multiDrops.add(mde);
|
multiDrops.add(mde);
|
||||||
|
|
||||||
int rnd = Randomizer.rand(mde.Minimum, mde.Maximum);
|
int rnd = Randomizer.rand(mde.Minimum, mde.Maximum);
|
||||||
for(int i = 0; i < rnd - 1; i++) {
|
for (int i = 0; i < rnd - 1; i++) {
|
||||||
extra.add(mde); // this passes copies of the equips' MDE with min/max quantity > 1, but idc it'll be unused anyways
|
extra.add(mde); // this passes copies of the equips' MDE with min/max quantity > 1, but idc it'll be unused anyways
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!multiDrops.isEmpty()) extraMultiEquipDrops.put(monsterId, multiDrops);
|
if (!multiDrops.isEmpty()) {
|
||||||
else hasNoMultiEquipDrops.add(monsterId);
|
extraMultiEquipDrops.put(monsterId, multiDrops);
|
||||||
} else {
|
} else {
|
||||||
for(MonsterDropEntry mde : multiDrops) {
|
hasNoMultiEquipDrops.add(monsterId);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (MonsterDropEntry mde : multiDrops) {
|
||||||
int rnd = Randomizer.rand(mde.Minimum, mde.Maximum);
|
int rnd = Randomizer.rand(mde.Minimum, mde.Maximum);
|
||||||
for(int i = 0; i < rnd - 1; i++) {
|
for (int i = 0; i < rnd - 1; i++) {
|
||||||
extra.add(mde);
|
extra.add(mde);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -180,6 +183,12 @@ public class MapleMonsterInformationProvider {
|
|||||||
}
|
}
|
||||||
final List<MonsterDropEntry> ret = new LinkedList<>();
|
final List<MonsterDropEntry> ret = new LinkedList<>();
|
||||||
|
|
||||||
|
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));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
PreparedStatement ps = null;
|
PreparedStatement ps = null;
|
||||||
ResultSet rs = null;
|
ResultSet rs = null;
|
||||||
Connection con = null;
|
Connection con = null;
|
||||||
@@ -190,13 +199,7 @@ public class MapleMonsterInformationProvider {
|
|||||||
rs = ps.executeQuery();
|
rs = ps.executeQuery();
|
||||||
|
|
||||||
while (rs.next()) {
|
while (rs.next()) {
|
||||||
ret.add(
|
ret.add(new MonsterDropEntry(rs.getInt("itemid"), rs.getInt("chance"), rs.getInt("minimum_quantity"), rs.getInt("maximum_quantity"), rs.getShort("questid")));
|
||||||
new MonsterDropEntry(
|
|
||||||
rs.getInt("itemid"),
|
|
||||||
rs.getInt("chance"),
|
|
||||||
rs.getInt("minimum_quantity"),
|
|
||||||
rs.getInt("maximum_quantity"),
|
|
||||||
rs.getShort("questid")));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
con.close();
|
con.close();
|
||||||
@@ -219,6 +222,7 @@ public class MapleMonsterInformationProvider {
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
drops.put(monsterId, ret);
|
drops.put(monsterId, ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -234,16 +238,17 @@ public class MapleMonsterInformationProvider {
|
|||||||
List<Integer> ret = new ArrayList<>();
|
List<Integer> ret = new ArrayList<>();
|
||||||
|
|
||||||
int accProp = 0;
|
int accProp = 0;
|
||||||
for(MonsterDropEntry mde : dropList) {
|
for (MonsterDropEntry mde : dropList) {
|
||||||
if(!ii.isQuestItem(mde.itemId) && !ii.isPartyQuestItem(mde.itemId)) {
|
if (!ii.isQuestItem(mde.itemId) && !ii.isPartyQuestItem(mde.itemId)) {
|
||||||
accProp += mde.chance;
|
accProp += mde.chance;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret.add(accProp);
|
ret.add(accProp);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(accProp == 0) ret.clear(); // don't accept mobs dropping no relevant items
|
if (accProp == 0) {
|
||||||
|
ret.clear(); // don't accept mobs dropping no relevant items
|
||||||
|
}
|
||||||
dropsChancePool.put(monsterId, ret);
|
dropsChancePool.put(monsterId, ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -271,7 +276,9 @@ public class MapleMonsterInformationProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public final Pair<Integer, Integer> getMobAttackInfo(int monsterId, int attackPos) {
|
public final Pair<Integer, Integer> getMobAttackInfo(int monsterId, int attackPos) {
|
||||||
if (attackPos < 0 || attackPos > 7) return null;
|
if (attackPos < 0 || attackPos > 7) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
return mobAttackInfo.get((monsterId << 3) + attackPos);
|
return mobAttackInfo.get((monsterId << 3) + attackPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -316,16 +323,11 @@ public class MapleMonsterInformationProvider {
|
|||||||
public String getMobNameFromId(int id) {
|
public String getMobNameFromId(int id) {
|
||||||
String mobName = mobNameCache.get(id);
|
String mobName = mobNameCache.get(id);
|
||||||
if (mobName == null) {
|
if (mobName == null) {
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
mobName = MapleLifeFactory.getMonster(id).getName();
|
mobName = MapleLifeFactory.getMonster(id).getName();
|
||||||
}
|
} catch (NullPointerException npe) {
|
||||||
catch (NullPointerException npe)
|
|
||||||
{
|
|
||||||
mobName = ""; //nonexistant mob
|
mobName = ""; //nonexistant mob
|
||||||
}
|
} catch (Exception e) {
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
System.err.println("Nonexistant mob id " + id);
|
System.err.println("Nonexistant mob id " + id);
|
||||||
mobName = ""; //nonexistant mob
|
mobName = ""; //nonexistant mob
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
You should have received a copy of the GNU Affero General Public License
|
You should have received a copy of the GNU Affero General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package server.life;
|
package server.life;
|
||||||
|
|
||||||
import java.awt.Point;
|
import java.awt.Point;
|
||||||
@@ -44,6 +44,7 @@ import tools.ArrayMap;
|
|||||||
* @author Danny (Leifde)
|
* @author Danny (Leifde)
|
||||||
*/
|
*/
|
||||||
public class MobSkill {
|
public class MobSkill {
|
||||||
|
|
||||||
private int skillId, skillLevel, mpCon;
|
private int skillId, skillLevel, mpCon;
|
||||||
private List<Integer> toSummon = new ArrayList<Integer>();
|
private List<Integer> toSummon = new ArrayList<Integer>();
|
||||||
private int spawnEffect, hp, x, y;
|
private int spawnEffect, hp, x, y;
|
||||||
@@ -108,7 +109,7 @@ public class MobSkill {
|
|||||||
Runnable toRun = new Runnable() {
|
Runnable toRun = new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if(monster.isAlive()) {
|
if (monster.isAlive()) {
|
||||||
applyEffect(player, monster, skill, null);
|
applyEffect(player, monster, skill, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -231,9 +232,14 @@ public class MobSkill {
|
|||||||
stats.put(MonsterStatus.MAGIC_IMMUNITY, 10);
|
stats.put(MonsterStatus.MAGIC_IMMUNITY, 10);
|
||||||
reflection.add(x);
|
reflection.add(x);
|
||||||
break;
|
break;
|
||||||
case 154: // accuracy up
|
case 154:
|
||||||
case 155: // avoid up
|
stats.put(MonsterStatus.ACC, Integer.valueOf(x));
|
||||||
case 156: // speed up
|
break;
|
||||||
|
case 155:
|
||||||
|
stats.put(MonsterStatus.AVOID, Integer.valueOf(x));
|
||||||
|
break;
|
||||||
|
case 156:
|
||||||
|
stats.put(MonsterStatus.SPEED, Integer.valueOf(x));
|
||||||
break;
|
break;
|
||||||
case 200: // summon
|
case 200: // summon
|
||||||
int skillLimit = this.getLimit();
|
int skillLimit = this.getLimit();
|
||||||
@@ -252,9 +258,10 @@ public class MobSkill {
|
|||||||
|
|
||||||
for (Integer mobId : summons.subList(0, summonLimit)) {
|
for (Integer mobId : summons.subList(0, summonLimit)) {
|
||||||
MapleMonster toSpawn = MapleLifeFactory.getMonster(mobId);
|
MapleMonster toSpawn = MapleLifeFactory.getMonster(mobId);
|
||||||
if(toSpawn != null) {
|
if (toSpawn != null) {
|
||||||
if(bossRushMap) toSpawn.disableDrops(); // no littering on BRPQ pls
|
if (bossRushMap) {
|
||||||
|
toSpawn.disableDrops(); // no littering on BRPQ pls
|
||||||
|
}
|
||||||
toSpawn.setPosition(monster.getPosition());
|
toSpawn.setPosition(monster.getPosition());
|
||||||
int ypos, xpos;
|
int ypos, xpos;
|
||||||
xpos = (int) monster.getPosition().getX();
|
xpos = (int) monster.getPosition().getX();
|
||||||
|
|||||||
+474
-153
File diff suppressed because it is too large.
Load diff
@@ -48,10 +48,12 @@ import server.life.MapleMonster;
|
|||||||
import server.life.MaplePlayerNPC;
|
import server.life.MaplePlayerNPC;
|
||||||
import server.life.MaplePlayerNPCFactory;
|
import server.life.MaplePlayerNPCFactory;
|
||||||
import scripting.event.EventInstanceManager;
|
import scripting.event.EventInstanceManager;
|
||||||
|
import server.partyquest.GuardianSpawnPoint;
|
||||||
import tools.DatabaseConnection;
|
import tools.DatabaseConnection;
|
||||||
import tools.StringUtil;
|
import tools.StringUtil;
|
||||||
|
|
||||||
public class MapleMapFactory {
|
public class MapleMapFactory {
|
||||||
|
|
||||||
private static Map<Integer, Float> mapRecoveryRate = new HashMap<>();
|
private static Map<Integer, Float> mapRecoveryRate = new HashMap<>();
|
||||||
|
|
||||||
private MapleDataProvider source;
|
private MapleDataProvider source;
|
||||||
@@ -87,8 +89,17 @@ public class MapleMapFactory {
|
|||||||
|
|
||||||
private void loadLifeFromWz(MapleMap map, MapleData mapData) {
|
private void loadLifeFromWz(MapleMap map, MapleData mapData) {
|
||||||
for (MapleData life : mapData.getChildByPath("life")) {
|
for (MapleData life : mapData.getChildByPath("life")) {
|
||||||
|
life.getName();
|
||||||
String id = MapleDataTool.getString(life.getChildByPath("id"));
|
String id = MapleDataTool.getString(life.getChildByPath("id"));
|
||||||
String type = MapleDataTool.getString(life.getChildByPath("type"));
|
String type = MapleDataTool.getString(life.getChildByPath("type"));
|
||||||
|
int team = MapleDataTool.getInt("team", life, -1);
|
||||||
|
if (map.isCPQMap2() && type.equals("m")) {
|
||||||
|
if((Integer.parseInt(life.getName()) % 2) == 0) {
|
||||||
|
team = 0;
|
||||||
|
} else {
|
||||||
|
team = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
int cy = MapleDataTool.getInt(life.getChildByPath("cy"));
|
int cy = MapleDataTool.getInt(life.getChildByPath("cy"));
|
||||||
MapleData dF = life.getChildByPath("f");
|
MapleData dF = life.getChildByPath("f");
|
||||||
int f = (dF != null) ? MapleDataTool.getInt(dF) : 0;
|
int f = (dF != null) ? MapleDataTool.getInt(dF) : 0;
|
||||||
@@ -99,7 +110,6 @@ public class MapleMapFactory {
|
|||||||
int y = MapleDataTool.getInt(life.getChildByPath("y"));
|
int y = MapleDataTool.getInt(life.getChildByPath("y"));
|
||||||
int hide = MapleDataTool.getInt("hide", life, 0);
|
int hide = MapleDataTool.getInt("hide", life, 0);
|
||||||
int mobTime = MapleDataTool.getInt("mobTime", life, 0);
|
int mobTime = MapleDataTool.getInt("mobTime", life, 0);
|
||||||
int team = MapleDataTool.getInt("team", life, -1);
|
|
||||||
|
|
||||||
loadLifeRaw(map, Integer.parseInt(id), type, cy, f, fh, rx0, rx1, x, y, hide, mobTime, team);
|
loadLifeRaw(map, Integer.parseInt(id), type, cy, f, fh, rx0, rx1, x, y, hide, mobTime, team);
|
||||||
}
|
}
|
||||||
@@ -113,7 +123,7 @@ public class MapleMapFactory {
|
|||||||
ps.setInt(2, map.getWorld());
|
ps.setInt(2, map.getWorld());
|
||||||
|
|
||||||
ResultSet rs = ps.executeQuery();
|
ResultSet rs = ps.executeQuery();
|
||||||
while(rs.next()) {
|
while (rs.next()) {
|
||||||
int id = rs.getInt("life");
|
int id = rs.getInt("life");
|
||||||
String type = rs.getString("type");
|
String type = rs.getString("type");
|
||||||
int cy = rs.getInt("cy");
|
int cy = rs.getInt("cy");
|
||||||
@@ -209,9 +219,9 @@ public class MapleMapFactory {
|
|||||||
bounds[0] = MapleDataTool.getInt(infoData.getChildByPath("VRTop"));
|
bounds[0] = MapleDataTool.getInt(infoData.getChildByPath("VRTop"));
|
||||||
bounds[1] = MapleDataTool.getInt(infoData.getChildByPath("VRBottom"));
|
bounds[1] = MapleDataTool.getInt(infoData.getChildByPath("VRBottom"));
|
||||||
|
|
||||||
if(bounds[0] == bounds[1]) { // old-style baked map
|
if (bounds[0] == bounds[1]) { // old-style baked map
|
||||||
MapleData minimapData = mapData.getChildByPath("miniMap");
|
MapleData minimapData = mapData.getChildByPath("miniMap");
|
||||||
if(minimapData != null) {
|
if (minimapData != null) {
|
||||||
bounds[0] = MapleDataTool.getInt(minimapData.getChildByPath("centerX")) * -1;
|
bounds[0] = MapleDataTool.getInt(minimapData.getChildByPath("centerX")) * -1;
|
||||||
bounds[1] = MapleDataTool.getInt(minimapData.getChildByPath("centerY")) * -1;
|
bounds[1] = MapleDataTool.getInt(minimapData.getChildByPath("centerY")) * -1;
|
||||||
bounds[2] = MapleDataTool.getInt(minimapData.getChildByPath("height"));
|
bounds[2] = MapleDataTool.getInt(minimapData.getChildByPath("height"));
|
||||||
@@ -272,7 +282,7 @@ public class MapleMapFactory {
|
|||||||
map.addMapleArea(new Rectangle(x1, y1, (x2 - x1), (y2 - y1)));
|
map.addMapleArea(new Rectangle(x1, y1, (x2 - x1), (y2 - y1)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(event == null) {
|
if (event == null) {
|
||||||
try {
|
try {
|
||||||
Connection con = DatabaseConnection.getConnection();
|
Connection con = DatabaseConnection.getConnection();
|
||||||
try (PreparedStatement ps = con.prepareStatement("SELECT * FROM playernpcs WHERE map = ? AND world = ?")) {
|
try (PreparedStatement ps = con.prepareStatement("SELECT * FROM playernpcs WHERE map = ? AND world = ?")) {
|
||||||
@@ -290,8 +300,8 @@ public class MapleMapFactory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
List<MaplePlayerNPC> dnpcs = MaplePlayerNPCFactory.getDeveloperNpcsFromMapid(mapid);
|
List<MaplePlayerNPC> dnpcs = MaplePlayerNPCFactory.getDeveloperNpcsFromMapid(mapid);
|
||||||
if(dnpcs != null) {
|
if (dnpcs != null) {
|
||||||
for(MaplePlayerNPC dnpc : dnpcs) {
|
for (MaplePlayerNPC dnpc : dnpcs) {
|
||||||
map.addPlayerNPCMapObject(dnpc);
|
map.addPlayerNPCMapObject(dnpc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -300,11 +310,35 @@ public class MapleMapFactory {
|
|||||||
loadLifeFromWz(map, mapData);
|
loadLifeFromWz(map, mapData);
|
||||||
loadLifeFromDb(map);
|
loadLifeFromDb(map);
|
||||||
|
|
||||||
|
if (map.isCPQMap()) {
|
||||||
|
MapleData mcData = mapData.getChildByPath("monsterCarnival");
|
||||||
|
if (mcData != null) {
|
||||||
|
MapleData guardianGenData = mcData.getChildByPath("guardianGenPos");
|
||||||
|
for (MapleData node : guardianGenData.getChildren()) {
|
||||||
|
GuardianSpawnPoint pt = new GuardianSpawnPoint(new Point(MapleDataTool.getIntConvert("x", node), MapleDataTool.getIntConvert("y", node)));
|
||||||
|
pt.setTeam(MapleDataTool.getIntConvert("team", node, -1));
|
||||||
|
pt.setTaken(false);
|
||||||
|
map.addGuardianSpawnPoint(pt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (mcData.getChildByPath("skill") != null) {
|
||||||
|
for (MapleData area : mcData.getChildByPath("skill")) {
|
||||||
|
map.addSkillId(MapleDataTool.getInt(area));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mcData.getChildByPath("mob") != null) {
|
||||||
|
for (MapleData area : mcData.getChildByPath("mob")) {
|
||||||
|
map.addMobSpawn(MapleDataTool.getInt(area.getChildByPath("id")), MapleDataTool.getInt(area.getChildByPath("spendCP")));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (mapData.getChildByPath("reactor") != null) {
|
if (mapData.getChildByPath("reactor") != null) {
|
||||||
for (MapleData reactor : mapData.getChildByPath("reactor")) {
|
for (MapleData reactor : mapData.getChildByPath("reactor")) {
|
||||||
String id = MapleDataTool.getString(reactor.getChildByPath("id"));
|
String id = MapleDataTool.getString(reactor.getChildByPath("id"));
|
||||||
if (id != null) {
|
if (id != null) {
|
||||||
MapleReactor newReactor = loadReactor(reactor, id);
|
MapleReactor newReactor = loadReactor(reactor, id, (byte) MapleDataTool.getInt(reactor.getChildByPath("f"), 0));
|
||||||
map.spawnReactor(newReactor);
|
map.spawnReactor(newReactor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -313,7 +347,7 @@ public class MapleMapFactory {
|
|||||||
map.setMapName(MapleDataTool.getString("mapName", nameData.getChildByPath(getMapStringName(omapid)), ""));
|
map.setMapName(MapleDataTool.getString("mapName", nameData.getChildByPath(getMapStringName(omapid)), ""));
|
||||||
map.setStreetName(MapleDataTool.getString("streetName", nameData.getChildByPath(getMapStringName(omapid)), ""));
|
map.setStreetName(MapleDataTool.getString("streetName", nameData.getChildByPath(getMapStringName(omapid)), ""));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
if(omapid / 1000 != 1020) { // explorer job introducion scenes
|
if (omapid / 1000 != 1020) { // explorer job introducion scenes
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
System.err.println("Not found mapid " + omapid);
|
System.err.println("Not found mapid " + omapid);
|
||||||
}
|
}
|
||||||
@@ -334,7 +368,7 @@ public class MapleMapFactory {
|
|||||||
map.setMobCapacity(MapleDataTool.getIntConvert("fixedMobCapacity", infoData, 500));//Is there a map that contains more than 500 mobs?
|
map.setMobCapacity(MapleDataTool.getIntConvert("fixedMobCapacity", infoData, 500));//Is there a map that contains more than 500 mobs?
|
||||||
|
|
||||||
MapleData recData = infoData.getChildByPath("recovery");
|
MapleData recData = infoData.getChildByPath("recovery");
|
||||||
if(recData != null) {
|
if (recData != null) {
|
||||||
float recoveryRate = MapleDataTool.getFloat(recData);
|
float recoveryRate = MapleDataTool.getFloat(recData);
|
||||||
mapRecoveryRate.put(mapid, recoveryRate);
|
mapRecoveryRate.put(mapid, recoveryRate);
|
||||||
}
|
}
|
||||||
@@ -402,10 +436,11 @@ public class MapleMapFactory {
|
|||||||
return myLife;
|
return myLife;
|
||||||
}
|
}
|
||||||
|
|
||||||
private MapleReactor loadReactor(MapleData reactor, String id) {
|
private MapleReactor loadReactor(MapleData reactor, String id, final byte FacingDirection) {
|
||||||
MapleReactor myReactor = new MapleReactor(MapleReactorFactory.getReactor(Integer.parseInt(id)), Integer.parseInt(id));
|
MapleReactor myReactor = new MapleReactor(MapleReactorFactory.getReactor(Integer.parseInt(id)), Integer.parseInt(id));
|
||||||
int x = MapleDataTool.getInt(reactor.getChildByPath("x"));
|
int x = MapleDataTool.getInt(reactor.getChildByPath("x"));
|
||||||
int y = MapleDataTool.getInt(reactor.getChildByPath("y"));
|
int y = MapleDataTool.getInt(reactor.getChildByPath("y"));
|
||||||
|
myReactor.setFacingDirection(FacingDirection);
|
||||||
myReactor.setPosition(new Point(x, y));
|
myReactor.setPosition(new Point(x, y));
|
||||||
myReactor.setDelay(MapleDataTool.getInt(reactor.getChildByPath("reactorTime")) * 1000);
|
myReactor.setDelay(MapleDataTool.getInt(reactor.getChildByPath("reactorTime")) * 1000);
|
||||||
myReactor.setName(MapleDataTool.getString(reactor.getChildByPath("name"), ""));
|
myReactor.setName(MapleDataTool.getString(reactor.getChildByPath("name"), ""));
|
||||||
@@ -442,7 +477,7 @@ public class MapleMapFactory {
|
|||||||
} else if (mapid >= 677000000 && mapid < 677100000) {
|
} else if (mapid >= 677000000 && mapid < 677100000) {
|
||||||
builder.append("Episode1GL");
|
builder.append("Episode1GL");
|
||||||
} else if (mapid >= 670000000 && mapid < 682000000) {
|
} else if (mapid >= 670000000 && mapid < 682000000) {
|
||||||
if((mapid >= 674030000 && mapid < 674040000) || (mapid >= 680100000 && mapid < 680200000)) {
|
if ((mapid >= 674030000 && mapid < 674040000) || (mapid >= 680100000 && mapid < 680200000)) {
|
||||||
builder.append("etc");
|
builder.append("etc");
|
||||||
} else {
|
} else {
|
||||||
builder.append("weddingGL");
|
builder.append("weddingGL");
|
||||||
@@ -452,7 +487,7 @@ public class MapleMapFactory {
|
|||||||
} else if (mapid >= 683000000 && mapid < 684000000) {
|
} else if (mapid >= 683000000 && mapid < 684000000) {
|
||||||
builder.append("event");
|
builder.append("event");
|
||||||
} else if (mapid >= 800000000 && mapid < 900000000) {
|
} else if (mapid >= 800000000 && mapid < 900000000) {
|
||||||
if((mapid >= 889100000 && mapid < 889200000)) {
|
if ((mapid >= 889100000 && mapid < 889200000)) {
|
||||||
builder.append("etc");
|
builder.append("etc");
|
||||||
} else {
|
} else {
|
||||||
builder.append("jp");
|
builder.append("jp");
|
||||||
@@ -484,7 +519,7 @@ public class MapleMapFactory {
|
|||||||
public void dispose() {
|
public void dispose() {
|
||||||
Collection<MapleMap> mapValues = getMaps().values();
|
Collection<MapleMap> mapValues = getMaps().values();
|
||||||
|
|
||||||
for(MapleMap map: mapValues) {
|
for (MapleMap map : mapValues) {
|
||||||
map.dispose();
|
map.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,10 +18,11 @@
|
|||||||
|
|
||||||
You should have received a copy of the GNU Affero General Public License
|
You should have received a copy of the GNU Affero General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package server.maps;
|
package server.maps;
|
||||||
|
|
||||||
import client.MapleClient;
|
import client.MapleClient;
|
||||||
|
import client.status.MonsterStatus;
|
||||||
import constants.ServerConstants;
|
import constants.ServerConstants;
|
||||||
|
|
||||||
import java.awt.Rectangle;
|
import java.awt.Rectangle;
|
||||||
@@ -36,6 +37,7 @@ import server.TimerManager;
|
|||||||
import tools.MaplePacketCreator;
|
import tools.MaplePacketCreator;
|
||||||
import tools.Pair;
|
import tools.Pair;
|
||||||
import net.server.audit.locks.MonitoredLockType;
|
import net.server.audit.locks.MonitoredLockType;
|
||||||
|
import server.partyquest.GuardianSpawnPoint;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -43,6 +45,7 @@ import net.server.audit.locks.MonitoredLockType;
|
|||||||
* @author Ronan
|
* @author Ronan
|
||||||
*/
|
*/
|
||||||
public class MapleReactor extends AbstractMapleMapObject {
|
public class MapleReactor extends AbstractMapleMapObject {
|
||||||
|
|
||||||
private int rid;
|
private int rid;
|
||||||
private MapleReactorStats stats;
|
private MapleReactorStats stats;
|
||||||
private byte state;
|
private byte state;
|
||||||
@@ -54,11 +57,13 @@ public class MapleReactor extends AbstractMapleMapObject {
|
|||||||
private boolean shouldCollect;
|
private boolean shouldCollect;
|
||||||
private boolean attackHit;
|
private boolean attackHit;
|
||||||
private ScheduledFuture<?> timeoutTask = null;
|
private ScheduledFuture<?> timeoutTask = null;
|
||||||
|
private GuardianSpawnPoint guardian = null;
|
||||||
|
private byte facingDirection = 0;
|
||||||
private Lock reactorLock = MonitoredReentrantLockFactory.createLock(MonitoredLockType.REACTOR, true);
|
private Lock reactorLock = MonitoredReentrantLockFactory.createLock(MonitoredLockType.REACTOR, true);
|
||||||
private Lock hitLock = MonitoredReentrantLockFactory.createLock(MonitoredLockType.REACTOR_HIT, true);
|
private Lock hitLock = MonitoredReentrantLockFactory.createLock(MonitoredLockType.REACTOR_HIT, true);
|
||||||
|
|
||||||
public MapleReactor(MapleReactorStats stats, int rid) {
|
public MapleReactor(MapleReactorStats stats, int rid) {
|
||||||
this.evstate = (byte)0;
|
this.evstate = (byte) 0;
|
||||||
this.stats = stats;
|
this.stats = stats;
|
||||||
this.rid = rid;
|
this.rid = rid;
|
||||||
this.alive = true;
|
this.alive = true;
|
||||||
@@ -173,7 +178,9 @@ public class MapleReactor extends AbstractMapleMapObject {
|
|||||||
setShouldCollect(true);
|
setShouldCollect(true);
|
||||||
refreshReactorTimeout();
|
refreshReactorTimeout();
|
||||||
|
|
||||||
if(map != null) map.searchItemReactors(this);
|
if (map != null) {
|
||||||
|
map.searchItemReactors(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void forceHitReactor(final byte newState) {
|
public void forceHitReactor(final byte newState) {
|
||||||
@@ -187,7 +194,9 @@ public class MapleReactor extends AbstractMapleMapObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void tryForceHitReactor(final byte newState) { // weak hit state signal, if already changed reactor state before timeout then drop this
|
private void tryForceHitReactor(final byte newState) { // weak hit state signal, if already changed reactor state before timeout then drop this
|
||||||
if(!this.reactorLock.tryLock()) return;
|
if (!this.reactorLock.tryLock()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
this.resetReactorActions(newState);
|
this.resetReactorActions(newState);
|
||||||
@@ -206,7 +215,7 @@ public class MapleReactor extends AbstractMapleMapObject {
|
|||||||
|
|
||||||
private void refreshReactorTimeout() {
|
private void refreshReactorTimeout() {
|
||||||
int timeOut = stats.getTimeout(state);
|
int timeOut = stats.getTimeout(state);
|
||||||
if(timeOut > -1) {
|
if (timeOut > -1) {
|
||||||
final byte nextState = stats.getTimeoutState(state);
|
final byte nextState = stats.getTimeoutState(state);
|
||||||
|
|
||||||
timeoutTask = TimerManager.getInstance().schedule(new Runnable() {
|
timeoutTask = TimerManager.getInstance().schedule(new Runnable() {
|
||||||
@@ -234,17 +243,19 @@ public class MapleReactor extends AbstractMapleMapObject {
|
|||||||
|
|
||||||
public void hitReactor(boolean wHit, int charPos, short stance, int skillid, MapleClient c) {
|
public void hitReactor(boolean wHit, int charPos, short stance, int skillid, MapleClient c) {
|
||||||
try {
|
try {
|
||||||
if(!this.isActive()) {
|
if (!this.isActive()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(hitLock.tryLock()) {
|
if (hitLock.tryLock()) {
|
||||||
this.lockReactor();
|
this.lockReactor();
|
||||||
try {
|
try {
|
||||||
cancelReactorTimeout();
|
cancelReactorTimeout();
|
||||||
attackHit = wHit;
|
attackHit = wHit;
|
||||||
|
|
||||||
if(ServerConstants.USE_DEBUG == true) c.getPlayer().dropMessage(5, "Hitted REACTOR " + this.getId() + " with POS " + charPos + " , STANCE " + stance + " , SkillID " + skillid + " , STATE " + stats.getType(state) + " STATESIZE " + stats.getStateSize(state));
|
if (ServerConstants.USE_DEBUG == true) {
|
||||||
|
c.getPlayer().dropMessage(5, "Hitted REACTOR " + this.getId() + " with POS " + charPos + " , STANCE " + stance + " , SkillID " + skillid + " , STATE " + stats.getType(state) + " STATESIZE " + stats.getStateSize(state));
|
||||||
|
}
|
||||||
ReactorScriptManager.getInstance().onHit(c, this);
|
ReactorScriptManager.getInstance().onHit(c, this);
|
||||||
|
|
||||||
int reactorType = stats.getType(state);
|
int reactorType = stats.getType(state);
|
||||||
@@ -253,7 +264,9 @@ public class MapleReactor extends AbstractMapleMapObject {
|
|||||||
for (byte b = 0; b < stats.getStateSize(state); b++) {//YAY?
|
for (byte b = 0; b < stats.getStateSize(state); b++) {//YAY?
|
||||||
List<Integer> activeSkills = stats.getActiveSkills(state, b);
|
List<Integer> activeSkills = stats.getActiveSkills(state, b);
|
||||||
if (activeSkills != null) {
|
if (activeSkills != null) {
|
||||||
if (!activeSkills.contains(skillid)) continue;
|
if (!activeSkills.contains(skillid)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
state = stats.getNextState(state, b);
|
state = stats.getNextState(state, b);
|
||||||
if (stats.getNextState(state, b) == -1) {//end of reactor
|
if (stats.getNextState(state, b) == -1) {//end of reactor
|
||||||
@@ -276,7 +289,7 @@ public class MapleReactor extends AbstractMapleMapObject {
|
|||||||
|
|
||||||
setShouldCollect(true); // refresh collectability on item drop-based reactors
|
setShouldCollect(true); // refresh collectability on item drop-based reactors
|
||||||
refreshReactorTimeout();
|
refreshReactorTimeout();
|
||||||
if(stats.getType(state) == 100) {
|
if (stats.getType(state) == 100) {
|
||||||
map.searchItemReactors(this);
|
map.searchItemReactors(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -286,11 +299,13 @@ public class MapleReactor extends AbstractMapleMapObject {
|
|||||||
} else {
|
} else {
|
||||||
state++;
|
state++;
|
||||||
map.broadcastMessage(MaplePacketCreator.triggerReactor(this, stance));
|
map.broadcastMessage(MaplePacketCreator.triggerReactor(this, stance));
|
||||||
|
if (this.getId() != 9980000 && this.getId() != 9980001) {
|
||||||
ReactorScriptManager.getInstance().act(c, this);
|
ReactorScriptManager.getInstance().act(c, this);
|
||||||
|
}
|
||||||
|
|
||||||
setShouldCollect(true);
|
setShouldCollect(true);
|
||||||
refreshReactorTimeout();
|
refreshReactorTimeout();
|
||||||
if(stats.getType(state) == 100) {
|
if (stats.getType(state) == 100) {
|
||||||
map.searchItemReactors(this);
|
map.searchItemReactors(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -300,7 +315,7 @@ public class MapleReactor extends AbstractMapleMapObject {
|
|||||||
|
|
||||||
hitLock.unlock();
|
hitLock.unlock();
|
||||||
}
|
}
|
||||||
} catch(Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -316,4 +331,20 @@ public class MapleReactor extends AbstractMapleMapObject {
|
|||||||
public void setName(String name) {
|
public void setName(String name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public GuardianSpawnPoint getGuardian() {
|
||||||
|
return guardian;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGuardian(GuardianSpawnPoint guardian) {
|
||||||
|
this.guardian = guardian;
|
||||||
|
}
|
||||||
|
|
||||||
|
public final void setFacingDirection(final byte facingDirection) {
|
||||||
|
this.facingDirection = facingDirection;
|
||||||
|
}
|
||||||
|
|
||||||
|
public final byte getFacingDirection() {
|
||||||
|
return facingDirection;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -38,6 +38,61 @@ public class MapleReactorFactory {
|
|||||||
private static MapleDataProvider data = MapleDataProviderFactory.getDataProvider(new File(System.getProperty("wzpath") + "/Reactor.wz"));
|
private static MapleDataProvider data = MapleDataProviderFactory.getDataProvider(new File(System.getProperty("wzpath") + "/Reactor.wz"));
|
||||||
private static Map<Integer, MapleReactorStats> reactorStats = new HashMap<Integer, MapleReactorStats>();
|
private static Map<Integer, MapleReactorStats> reactorStats = new HashMap<Integer, MapleReactorStats>();
|
||||||
|
|
||||||
|
|
||||||
|
public static final MapleReactorStats getReactorS(int rid) {
|
||||||
|
MapleReactorStats stats = reactorStats.get(Integer.valueOf(rid));
|
||||||
|
if (stats == null) {
|
||||||
|
int infoId = rid;
|
||||||
|
MapleData reactorData = data.getData(StringUtil.getLeftPaddedStr(Integer.toString(infoId) + ".img", '0', 11));
|
||||||
|
MapleData link = reactorData.getChildByPath("info/link");
|
||||||
|
if (link != null) {
|
||||||
|
infoId = MapleDataTool.getIntConvert("info/link", reactorData);
|
||||||
|
stats = reactorStats.get(Integer.valueOf(infoId));
|
||||||
|
}
|
||||||
|
if (stats == null) {
|
||||||
|
stats = new MapleReactorStats();
|
||||||
|
reactorData = data.getData(StringUtil.getLeftPaddedStr(Integer.toString(infoId) + ".img", '0', 11));
|
||||||
|
if (reactorData == null) {
|
||||||
|
return stats;
|
||||||
|
}
|
||||||
|
boolean canTouch = MapleDataTool.getInt("info/activateByTouch", reactorData, 0) > 0;
|
||||||
|
boolean areaSet = false;
|
||||||
|
boolean foundState = false;
|
||||||
|
for (byte i = 0; true; i++) {
|
||||||
|
MapleData reactorD = reactorData.getChildByPath(String.valueOf(i));
|
||||||
|
if (reactorD == null) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
MapleData reactorInfoData_ = reactorD.getChildByPath("event");
|
||||||
|
if (reactorInfoData_ != null && reactorInfoData_.getChildByPath("0") != null) {
|
||||||
|
MapleData reactorInfoData = reactorInfoData_.getChildByPath("0");
|
||||||
|
Pair<Integer, Integer> reactItem = null;
|
||||||
|
int type = MapleDataTool.getIntConvert("type", reactorInfoData);
|
||||||
|
if (type == 100) { //reactor waits for item
|
||||||
|
reactItem = new Pair<Integer, Integer>(MapleDataTool.getIntConvert("0", reactorInfoData), MapleDataTool.getIntConvert("1", reactorInfoData, 1));
|
||||||
|
if (!areaSet) { //only set area of effect for item-triggered reactors once
|
||||||
|
stats.setTL(MapleDataTool.getPoint("lt", reactorInfoData));
|
||||||
|
stats.setBR(MapleDataTool.getPoint("rb", reactorInfoData));
|
||||||
|
areaSet = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
foundState = true;
|
||||||
|
stats.addState(i, type, reactItem, (byte) MapleDataTool.getIntConvert("state", reactorInfoData), MapleDataTool.getIntConvert("timeOut", reactorInfoData_, -1), (byte) (canTouch ? 2 : (MapleDataTool.getIntConvert("2", reactorInfoData, 0) > 0 || reactorInfoData.getChildByPath("clickArea") != null || type == 9 ? 1 : 0)));
|
||||||
|
} else {
|
||||||
|
stats.addState(i, 999, null, (byte) (foundState ? -1 : (i + 1)), 0, (byte) 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
reactorStats.put(Integer.valueOf(infoId), stats);
|
||||||
|
if (rid != infoId) {
|
||||||
|
reactorStats.put(Integer.valueOf(rid), stats);
|
||||||
|
}
|
||||||
|
} else { // stats exist at infoId but not rid; add to map
|
||||||
|
reactorStats.put(Integer.valueOf(rid), stats);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return stats;
|
||||||
|
}
|
||||||
|
|
||||||
public static MapleReactorStats getReactor(int rid) {
|
public static MapleReactorStats getReactor(int rid) {
|
||||||
MapleReactorStats stats = reactorStats.get(Integer.valueOf(rid));
|
MapleReactorStats stats = reactorStats.get(Integer.valueOf(rid));
|
||||||
if (stats == null) {
|
if (stats == null) {
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
package server.maps;
|
package server.maps;
|
||||||
|
|
||||||
import java.awt.Point;
|
import java.awt.Point;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -58,6 +59,12 @@ public class MapleReactorStats {
|
|||||||
if(timeOut > -1) timeoutInfo.put(state, timeOut);
|
if(timeOut > -1) timeoutInfo.put(state, timeOut);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void addState(byte state, int type, Pair<Integer, Integer> reactItem, byte nextState, int timeOut, byte canTouch) {
|
||||||
|
List<StateData> data = new ArrayList<>();
|
||||||
|
data.add(new StateData(type, reactItem, null, nextState));
|
||||||
|
stateInfo.put(state, data);
|
||||||
|
}
|
||||||
|
|
||||||
public int getTimeout(byte state) {
|
public int getTimeout(byte state) {
|
||||||
Integer i = timeoutInfo.get(state);
|
Integer i = timeoutInfo.get(state);
|
||||||
return (i == null) ? -1 : i;
|
return (i == null) ? -1 : i;
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ public enum SavedLocationType {
|
|||||||
EVENT,
|
EVENT,
|
||||||
BOSSPQ,
|
BOSSPQ,
|
||||||
HAPPYVILLE,
|
HAPPYVILLE,
|
||||||
|
MONSTER_CARNIVAL,
|
||||||
DEVELOPER;
|
DEVELOPER;
|
||||||
|
|
||||||
public static SavedLocationType fromString(String Str) {
|
public static SavedLocationType fromString(String Str) {
|
||||||
|
|||||||
@@ -0,0 +1,43 @@
|
|||||||
|
package server.partyquest;
|
||||||
|
|
||||||
|
import java.awt.Point;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author David
|
||||||
|
*/
|
||||||
|
public class GuardianSpawnPoint {
|
||||||
|
|
||||||
|
private Point position;
|
||||||
|
private boolean taken;
|
||||||
|
private int team = -1;
|
||||||
|
|
||||||
|
public GuardianSpawnPoint(Point a) {
|
||||||
|
this.position = a;
|
||||||
|
this.taken = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Point getPosition() {
|
||||||
|
return position;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPosition(Point position) {
|
||||||
|
this.position = position;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isTaken() {
|
||||||
|
return taken;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTaken(boolean taken) {
|
||||||
|
this.taken = taken;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getTeam() {
|
||||||
|
return team;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTeam(int team) {
|
||||||
|
this.team = team;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,76 @@
|
|||||||
|
package server.partyquest;
|
||||||
|
|
||||||
|
import client.MapleDisease;
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import server.life.MobSkillFactory;
|
||||||
|
import provider.MapleDataProvider;
|
||||||
|
import provider.MapleDataProviderFactory;
|
||||||
|
import provider.MapleData;
|
||||||
|
import provider.MapleDataTool;
|
||||||
|
import server.life.MobSkill;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*@author Drago/Dragohe4rt
|
||||||
|
*/
|
||||||
|
public class MapleCarnivalFactory {
|
||||||
|
|
||||||
|
private final static MapleCarnivalFactory instance = new MapleCarnivalFactory();
|
||||||
|
private final Map<Integer, MCSkill> skills = new HashMap<Integer, MCSkill>();
|
||||||
|
private final Map<Integer, MCSkill> guardians = new HashMap<Integer, MCSkill>();
|
||||||
|
private final MapleDataProvider dataRoot = MapleDataProviderFactory.getDataProvider(new File(System.getProperty("wzpath") + "/Skill.wz"));
|
||||||
|
|
||||||
|
public MapleCarnivalFactory() {
|
||||||
|
//whoosh
|
||||||
|
initialize();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final MapleCarnivalFactory getInstance() {
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initialize() {
|
||||||
|
if (skills.size() != 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for (MapleData z : dataRoot.getData("MCSkill.img")) {
|
||||||
|
skills.put(Integer.parseInt(z.getName()), new MCSkill(MapleDataTool.getInt("spendCP", z, 0), MapleDataTool.getInt("mobSkillID", z, 0), MapleDataTool.getInt("level", z, 0), MapleDataTool.getInt("target", z, 1) > 1));
|
||||||
|
}
|
||||||
|
for (MapleData z : dataRoot.getData("MCGuardian.img")) {
|
||||||
|
guardians.put(Integer.parseInt(z.getName()), new MCSkill(MapleDataTool.getInt("spendCP", z, 0), MapleDataTool.getInt("mobSkillID", z, 0), MapleDataTool.getInt("level", z, 0), true));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public MCSkill getSkill(final int id) {
|
||||||
|
return skills.get(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public MCSkill getGuardian(final int id) {
|
||||||
|
return guardians.get(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class MCSkill {
|
||||||
|
|
||||||
|
public int cpLoss, skillid, level;
|
||||||
|
public boolean targetsAll;
|
||||||
|
|
||||||
|
public MCSkill(int _cpLoss, int _skillid, int _level, boolean _targetsAll) {
|
||||||
|
cpLoss = _cpLoss;
|
||||||
|
skillid = _skillid;
|
||||||
|
level = _level;
|
||||||
|
targetsAll = _targetsAll;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MobSkill getSkill() {
|
||||||
|
return MobSkillFactory.getMobSkill(skillid, 1); //level?
|
||||||
|
}
|
||||||
|
|
||||||
|
public MapleDisease getDisease() {
|
||||||
|
if (skillid <= 0) {
|
||||||
|
return MapleDisease.getRandom();
|
||||||
|
}
|
||||||
|
return MapleDisease.getBySkill(skillid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,174 +1,489 @@
|
|||||||
/*
|
|
||||||
This file is part of the OdinMS Maple Story Server
|
|
||||||
Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc>
|
|
||||||
Matthias Butz <matze@odinms.de>
|
|
||||||
Jan Christian Meyer <vimes@odinms.de>
|
|
||||||
|
|
||||||
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 <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package server.partyquest;
|
package server.partyquest;
|
||||||
|
|
||||||
import client.MapleCharacter;
|
|
||||||
import java.sql.Connection;
|
|
||||||
import java.sql.PreparedStatement;
|
|
||||||
import java.sql.SQLException;
|
|
||||||
import java.util.concurrent.ScheduledFuture;
|
import java.util.concurrent.ScheduledFuture;
|
||||||
|
import client.MapleCharacter;
|
||||||
|
import constants.LinguaConstants;
|
||||||
|
import net.server.Server;
|
||||||
|
import net.server.channel.Channel;
|
||||||
|
import net.server.world.MapleParty;
|
||||||
|
import net.server.world.MaplePartyCharacter;
|
||||||
import server.TimerManager;
|
import server.TimerManager;
|
||||||
import server.maps.MapleMap;
|
import server.maps.MapleMap;
|
||||||
import tools.DatabaseConnection;
|
|
||||||
import tools.MaplePacketCreator;
|
import tools.MaplePacketCreator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* @author Drago/Dragohe4rt
|
||||||
* @author kevintjuh93 - LOST MOTIVATION >=(
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class MonsterCarnival {
|
public class MonsterCarnival {
|
||||||
private MonsterCarnivalParty red, blue;
|
|
||||||
|
public static int D = 3;
|
||||||
|
public static int C = 2;
|
||||||
|
public static int B = 1;
|
||||||
|
public static int A = 0;
|
||||||
|
|
||||||
|
private MapleParty p1, p2;
|
||||||
private MapleMap map;
|
private MapleMap map;
|
||||||
private int room;
|
private ScheduledFuture<?> timer, effectTimer;
|
||||||
private long time = 0;
|
private long startTime = 0;
|
||||||
private long timeStarted = 0;
|
private int summons = 8, summonss = 8;
|
||||||
private ScheduledFuture<?> schedule = null;
|
private MapleCharacter leader1, leader2, Grupo1, Grupo2;
|
||||||
|
private int redCP, blueCP, redTotalCP, blueTotalCP;
|
||||||
|
private boolean cpq1;
|
||||||
|
|
||||||
public MonsterCarnival(int room, byte channel, MonsterCarnivalParty red1, MonsterCarnivalParty blue1) {
|
public MonsterCarnival(MapleParty p1, MapleParty p2, int mapid, boolean cpq1) {
|
||||||
//this.map = Channel.getInstance(channel).getMapFactory().getMap(980000001 + (room * 100));
|
try {
|
||||||
this.room = room;
|
this.cpq1 = cpq1;
|
||||||
this.red = red1;
|
this.p1 = p1;
|
||||||
this.blue = blue1;
|
this.p2 = p2;
|
||||||
this.timeStarted = System.currentTimeMillis();
|
Channel cs = Server.getInstance().getWorld(p2.getLeader().getWorld()).getChannel(p2.getLeader().getChannel());
|
||||||
this.time = 600000;
|
p1.setEnemy(p2);
|
||||||
map.broadcastMessage(MaplePacketCreator.getClock((int) (time / 1000)));
|
p2.setEnemy(p1);
|
||||||
|
map = cs.getMapFactory().resetMap(mapid);
|
||||||
for (MapleCharacter chr : red.getMembers())
|
int redPortal = 0;
|
||||||
chr.setCarnival(this);
|
int bluePortal = 0;
|
||||||
for (MapleCharacter chr : blue.getMembers())
|
if (map.isPurpleCPQMap()) {
|
||||||
chr.setCarnival(this);
|
redPortal = 2;
|
||||||
|
bluePortal = 1;
|
||||||
this.schedule = TimerManager.getInstance().schedule(new Runnable() {
|
}
|
||||||
|
for (MaplePartyCharacter mpc : p1.getMembers()) {
|
||||||
|
MapleCharacter mc = cs.getPlayerStorage().getCharacterByName(mpc.getName());
|
||||||
|
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);
|
||||||
|
if (p1.getLeader().getId() == mc.getId()) {
|
||||||
|
leader1 = mc;
|
||||||
|
}
|
||||||
|
Grupo1 = mc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (MaplePartyCharacter mpc : p2.getMembers()) {
|
||||||
|
MapleCharacter mc = cs.getPlayerStorage().getCharacterByName(mpc.getName());
|
||||||
|
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);
|
||||||
|
if (p2.getLeader().getId() == mc.getId()) {
|
||||||
|
leader2 = mc;
|
||||||
|
}
|
||||||
|
Grupo2 = mc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (Grupo1 == null || Grupo2 == null) {
|
||||||
|
for (MaplePartyCharacter mpc : p2.getMembers()) {
|
||||||
|
mpc.getPlayer().dropMessage(5, LinguaConstants.Linguas(mpc.getPlayer()).CPQErro);
|
||||||
|
}
|
||||||
|
for (MaplePartyCharacter mpc : p2.getMembers()) {
|
||||||
|
mpc.getPlayer().dropMessage(5, LinguaConstants.Linguas(mpc.getPlayer()).CPQErro);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Grupo1.getClient().announce(MaplePacketCreator.startMonsterCarnival(Grupo1, 0, 1));
|
||||||
|
Grupo2.getClient().announce(MaplePacketCreator.startMonsterCarnival(Grupo2, 1, 0));
|
||||||
|
startTime = System.currentTimeMillis() + 60 * 10000;
|
||||||
|
timer = TimerManager.getInstance().schedule(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (red.getTotalCP() > blue.getTotalCP()) {
|
timeUp();
|
||||||
red.setWinner(true);
|
}
|
||||||
blue.setWinner(false);
|
}, 10 * 60 * 1000);
|
||||||
red.displayMatchResult();
|
effectTimer = TimerManager.getInstance().schedule(new Runnable() {
|
||||||
blue.displayMatchResult();
|
@Override
|
||||||
} else if (blue.getTotalCP() > red.getTotalCP()) {
|
public void run() {
|
||||||
red.setWinner(false);
|
complete();
|
||||||
blue.setWinner(true);
|
}
|
||||||
red.displayMatchResult();
|
}, 10 * 60 * 1000 - 10 * 1000);
|
||||||
blue.displayMatchResult();
|
TimerManager.getInstance().schedule(new Runnable() {
|
||||||
} else {
|
@Override
|
||||||
red.setWinner(false);
|
public void run() {
|
||||||
blue.setWinner(false);
|
map.addClock(60 * 10);
|
||||||
red.displayMatchResult();
|
}
|
||||||
blue.displayMatchResult();
|
}, 2000);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
saveResults();
|
|
||||||
warpOut();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}, time);
|
public void playerDisconnected(int charid) {
|
||||||
/* if (room == 0) {
|
int team = -1;
|
||||||
MapleData data = MapleDataProviderFactory.getDataProvider(new File(System.getProperty("wzpath") + "/Map.wz")).getData("Map/Map9" + (980000001 + (room * 100)) + ".img").getChildByPath("monsterCarnival");
|
for (MaplePartyCharacter mpc : leader1.getParty().getMembers()) {
|
||||||
if (data != null) {
|
if (mpc.getId() == charid) {
|
||||||
for (MapleData p : data.getChildByPath("mobGenPos").getChildren()) {
|
team = 0;
|
||||||
MapleData team = p.getChildByPath("team");
|
|
||||||
if (team != null) {
|
|
||||||
if (team.getData().equals(0))
|
|
||||||
redmonsterpoints.add(new Point(MapleDataTool.getInt(p.getChildByPath("x")), MapleDataTool.getInt(p.getChildByPath("y"))));
|
|
||||||
else
|
|
||||||
bluemonsterpoints.add(new Point(MapleDataTool.getInt(p.getChildByPath("x")), MapleDataTool.getInt(p.getChildByPath("y"))));
|
|
||||||
} else
|
|
||||||
monsterpoints.add(new Point(MapleDataTool.getInt(p.getChildByPath("x")), MapleDataTool.getInt(p.getChildByPath("y"))));
|
|
||||||
}
|
|
||||||
for (MapleData p : data.getChildByPath("guardianGenPos").getChildren()) {
|
|
||||||
MapleData team = p.getChildByPath("team");
|
|
||||||
if (team != null) {
|
|
||||||
if (team.getData().equals(0))
|
|
||||||
redreactorpoints.add(new Point(MapleDataTool.getInt(p.getChildByPath("x")), MapleDataTool.getInt(p.getChildByPath("y"))));
|
|
||||||
else
|
|
||||||
bluereactorpoints.add(new Point(MapleDataTool.getInt(p.getChildByPath("x")), MapleDataTool.getInt(p.getChildByPath("y"))));
|
|
||||||
} else
|
|
||||||
reactorpoints.add(new Point(MapleDataTool.getInt(p.getChildByPath("x")), MapleDataTool.getInt(p.getChildByPath("y"))));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} */
|
for (MaplePartyCharacter mpc : leader2.getParty().getMembers()) {
|
||||||
|
if (mpc.getId() == charid) {
|
||||||
|
team = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (MapleCharacter chrMap : map.getAllPlayers()) {
|
||||||
|
if (team == -1) {
|
||||||
|
team = 1;
|
||||||
|
}
|
||||||
|
String teamS = "";
|
||||||
|
switch (team) {
|
||||||
|
case 0:
|
||||||
|
teamS = LinguaConstants.Linguas(chrMap).CPQVermelho;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
teamS = LinguaConstants.Linguas(chrMap).CPQAzul;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
chrMap.dropMessage(5, teamS + LinguaConstants.Linguas(chrMap).CPQPlayerExit);
|
||||||
|
}
|
||||||
|
earlyFinish();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void earlyFinish() {
|
||||||
|
dispose(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void leftParty(int charid) {
|
||||||
|
playerDisconnected(charid);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void dispose() {
|
||||||
|
dispose(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void summon() {
|
||||||
|
this.summons--;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean canSummon() {
|
||||||
|
return this.summons > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void summons() {
|
||||||
|
this.summonss--;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean canSummons() {
|
||||||
|
return this.summonss > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void dispose(boolean warpout) {
|
||||||
|
Channel cs = Server.getInstance().getWorld(p1.getLeader().getWorld()).getChannel(p1.getLeader().getChannel());
|
||||||
|
MapleMap out;
|
||||||
|
if (!cpq1) { // cpq2
|
||||||
|
out = cs.getMapFactory().getMap(980030000);
|
||||||
|
} else {
|
||||||
|
out = cs.getMapFactory().getMap(980000000);
|
||||||
|
}
|
||||||
|
for (MaplePartyCharacter mpc : leader1.getParty().getMembers()) {
|
||||||
|
MapleCharacter mc = cs.getPlayerStorage().getCharacterByName(mpc.getName());
|
||||||
|
if (mc != null) {
|
||||||
|
mc.resetCP();
|
||||||
|
mc.setTeam(-1);
|
||||||
|
mc.setMonsterCarnival(null);
|
||||||
|
if (warpout) {
|
||||||
|
mc.changeMap(out, out.getPortal(0));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (MaplePartyCharacter mpc : leader2.getParty().getMembers()) {
|
||||||
|
MapleCharacter mc = cs.getPlayerStorage().getCharacterByName(mpc.getName());
|
||||||
|
if (mc != null) {
|
||||||
|
mc.resetCP();
|
||||||
|
mc.setTeam(-1);
|
||||||
|
mc.setMonsterCarnival(null);
|
||||||
|
if (warpout) {
|
||||||
|
mc.changeMap(out, out.getPortal(0));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (this.timer != null) {
|
||||||
|
this.timer.cancel(true);
|
||||||
|
this.timer = null;
|
||||||
|
}
|
||||||
|
if (this.effectTimer != null) {
|
||||||
|
this.effectTimer.cancel(true);
|
||||||
|
this.effectTimer = null;
|
||||||
|
}
|
||||||
|
redTotalCP = 0;
|
||||||
|
blueTotalCP = 0;
|
||||||
|
leader1.getParty().setEnemy(null);
|
||||||
|
leader2.getParty().setEnemy(null);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void exit() {
|
||||||
|
dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
public ScheduledFuture<?> getTimer() {
|
||||||
|
return this.timer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void finish(int winningTeam) {
|
||||||
|
try {
|
||||||
|
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());
|
||||||
|
if (mc != null) {
|
||||||
|
mc.gainFestivalPoints(this.redTotalCP);
|
||||||
|
mc.setMonsterCarnival(null);
|
||||||
|
if (cpq1) {
|
||||||
|
mc.changeMap(cs.getMapFactory().getMap(map.getId() + 2), cs.getMapFactory().getMap(map.getId() + 2).getPortal(0));
|
||||||
|
} else {
|
||||||
|
mc.changeMap(cs.getMapFactory().getMap(map.getId() + 200), cs.getMapFactory().getMap(map.getId() + 200).getPortal(0));
|
||||||
|
}
|
||||||
|
mc.setTeam(-1);
|
||||||
|
mc.dispelDebuffs();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (MaplePartyCharacter mpc : leader2.getParty().getMembers()) {
|
||||||
|
MapleCharacter mc = cs.getPlayerStorage().getCharacterByName(mpc.getName());
|
||||||
|
if (mc != null) {
|
||||||
|
mc.gainFestivalPoints(this.blueTotalCP);
|
||||||
|
mc.setMonsterCarnival(null);
|
||||||
|
if (cpq1) {
|
||||||
|
mc.changeMap(cs.getMapFactory().getMap(map.getId() + 3), cs.getMapFactory().getMap(map.getId() + 3).getPortal(0));
|
||||||
|
} else {
|
||||||
|
mc.changeMap(cs.getMapFactory().getMap(map.getId() + 300), cs.getMapFactory().getMap(map.getId() + 300).getPortal(0));
|
||||||
|
}
|
||||||
|
mc.setTeam(-1);
|
||||||
|
mc.dispelDebuffs();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (winningTeam == 1) {
|
||||||
|
for (MaplePartyCharacter mpc : leader2.getParty().getMembers()) {
|
||||||
|
MapleCharacter mc = cs.getPlayerStorage().getCharacterByName(mpc.getName());
|
||||||
|
if (mc != null) {
|
||||||
|
mc.gainFestivalPoints(this.blueTotalCP);
|
||||||
|
mc.setMonsterCarnival(null);
|
||||||
|
if (cpq1) {
|
||||||
|
mc.changeMap(cs.getMapFactory().getMap(map.getId() + 2), cs.getMapFactory().getMap(map.getId() + 2).getPortal(0));
|
||||||
|
} else {
|
||||||
|
mc.changeMap(cs.getMapFactory().getMap(map.getId() + 200), cs.getMapFactory().getMap(map.getId() + 200).getPortal(0));
|
||||||
|
}
|
||||||
|
mc.setTeam(-1);
|
||||||
|
mc.dispelDebuffs();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (MaplePartyCharacter mpc : leader1.getParty().getMembers()) {
|
||||||
|
MapleCharacter mc = cs.getPlayerStorage().getCharacterByName(mpc.getName());
|
||||||
|
if (mc != null) {
|
||||||
|
mc.gainFestivalPoints(this.redTotalCP);
|
||||||
|
mc.setMonsterCarnival(null);
|
||||||
|
if (cpq1) {
|
||||||
|
mc.changeMap(cs.getMapFactory().getMap(map.getId() + 3), cs.getMapFactory().getMap(map.getId() + 3).getPortal(0));
|
||||||
|
} else {
|
||||||
|
mc.changeMap(cs.getMapFactory().getMap(map.getId() + 300), cs.getMapFactory().getMap(map.getId() + 300).getPortal(0));
|
||||||
|
}
|
||||||
|
mc.setTeam(-1);
|
||||||
|
mc.dispelDebuffs();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dispose();
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void timeUp() {
|
||||||
|
int cp1 = this.redTotalCP;
|
||||||
|
int cp2 = this.blueTotalCP;
|
||||||
|
if (cp1 == cp2) {
|
||||||
|
extendTime();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (cp1 > cp2) {
|
||||||
|
finish(0);
|
||||||
|
} else {
|
||||||
|
finish(1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getTimeLeft() {
|
public long getTimeLeft() {
|
||||||
return time - (System.currentTimeMillis() - timeStarted);
|
return (startTime - System.currentTimeMillis());
|
||||||
}
|
}
|
||||||
|
|
||||||
public MonsterCarnivalParty getPartyRed() {
|
public int getTimeLeftSeconds() {
|
||||||
return red;
|
return (int) (getTimeLeft() / 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
public MonsterCarnivalParty getPartyBlue() {
|
public void extendTime() {
|
||||||
return blue;
|
for (MapleCharacter chrMap : map.getAllPlayers()) {
|
||||||
|
chrMap.dropMessage(5, LinguaConstants.Linguas(chrMap).CPQTempoExtendido);
|
||||||
}
|
}
|
||||||
|
startTime = System.currentTimeMillis() + 3 * 1000;
|
||||||
public MonsterCarnivalParty oppositeTeam(MonsterCarnivalParty team) {
|
map.addClock(3 * 60);
|
||||||
if (team == red)
|
timer = TimerManager.getInstance().schedule(new Runnable() {
|
||||||
return blue;
|
|
||||||
else
|
|
||||||
return red;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void playerLeft(MapleCharacter chr) {
|
|
||||||
map.broadcastMessage(chr, MaplePacketCreator.leaveCPQ(chr));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void warpOut() {
|
|
||||||
this.schedule = TimerManager.getInstance().schedule(new Runnable() {
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
red.warpOut();
|
timeUp();
|
||||||
blue.warpOut();
|
|
||||||
}
|
}
|
||||||
}, 12000);
|
}, 3 * 60 * 1000);
|
||||||
|
effectTimer = TimerManager.getInstance().schedule(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
complete();
|
||||||
|
}
|
||||||
|
}, 3 * 60 * 1000 - 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getRoom() {
|
public void complete() {
|
||||||
return room;
|
int cp1 = this.redTotalCP;
|
||||||
|
int cp2 = this.blueTotalCP;
|
||||||
|
if (cp1 == cp2) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
boolean redWin = cp1 > cp2;
|
||||||
|
int chnl = leader1.getClient().getChannel();
|
||||||
|
int chnl1 = leader2.getClient().getChannel();
|
||||||
|
if (chnl != chnl1) {
|
||||||
|
throw new RuntimeException("Os líderes estão em canais diferentes.");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void saveResults() {
|
Channel cs = Server.getInstance().getWorld(p1.getLeader().getWorld()).getChannel(p1.getLeader().getChannel());
|
||||||
Connection con = null;
|
map.killAllMonsters();
|
||||||
try {
|
for (MaplePartyCharacter mpc : leader1.getParty().getMembers()) {
|
||||||
con = DatabaseConnection.getConnection();
|
MapleCharacter mc;
|
||||||
PreparedStatement ps = con.prepareStatement("INSERT INTO carnivalresults VALUES (?,?,?,?)");
|
mc = cs.getPlayerStorage().getCharacterByName(mpc.getName());
|
||||||
for (MapleCharacter chr : red.getMembers()) {
|
if (mc != null) {
|
||||||
ps.setInt(1, chr.getId());
|
if (redWin) {
|
||||||
ps.setInt(2, chr.getCP());
|
mc.getClient().announce(MaplePacketCreator.showEffect("quest/carnival/win"));
|
||||||
ps.setInt(3, red.getTotalCP());
|
mc.getClient().announce(MaplePacketCreator.playSound("MobCarnival/Win"));
|
||||||
ps.setInt(4, red.isWinner() ? 1 : 0);
|
mc.dispelDebuffs();
|
||||||
ps.execute();
|
} else {
|
||||||
|
mc.getClient().announce(MaplePacketCreator.showEffect("quest/carnival/lose"));
|
||||||
|
mc.getClient().announce(MaplePacketCreator.playSound("MobCarnival/Lose"));
|
||||||
|
mc.dispelDebuffs();
|
||||||
}
|
}
|
||||||
for (MapleCharacter chr : blue.getMembers()) {
|
|
||||||
ps.setInt(1, chr.getId());
|
|
||||||
ps.setInt(2, chr.getCP());
|
|
||||||
ps.setInt(3, blue.getTotalCP());
|
|
||||||
ps.setInt(4, blue.isWinner() ? 1 : 0);
|
|
||||||
ps.execute();
|
|
||||||
}
|
}
|
||||||
ps.close();
|
}
|
||||||
con.close();
|
for (MaplePartyCharacter mpc : leader2.getParty().getMembers()) {
|
||||||
} catch (SQLException ex) {
|
MapleCharacter mc;
|
||||||
ex.printStackTrace();
|
mc = cs.getPlayerStorage().getCharacterByName(mpc.getName());
|
||||||
|
if (mc != null) {
|
||||||
|
if (!redWin) {
|
||||||
|
mc.getClient().announce(MaplePacketCreator.showEffect("quest/carnival/win"));
|
||||||
|
mc.getClient().announce(MaplePacketCreator.playSound("MobCarnival/Win"));
|
||||||
|
mc.dispelDebuffs();
|
||||||
|
} else {
|
||||||
|
mc.getClient().announce(MaplePacketCreator.showEffect("quest/carnival/lose"));
|
||||||
|
mc.getClient().announce(MaplePacketCreator.playSound("MobCarnival/Lose"));
|
||||||
|
mc.dispelDebuffs();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public MapleParty getRed() {
|
||||||
|
return p1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRed(MapleParty p1) {
|
||||||
|
this.p1 = p1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MapleParty getBlue() {
|
||||||
|
return p2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBlue(MapleParty p2) {
|
||||||
|
this.p2 = p2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MapleCharacter getLeader1() {
|
||||||
|
return leader1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLeader1(MapleCharacter leader1) {
|
||||||
|
this.leader1 = leader1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MapleCharacter getLeader2() {
|
||||||
|
return leader2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLeader2(MapleCharacter leader2) {
|
||||||
|
this.leader2 = leader2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MapleCharacter getEnemyLeader(int team) {
|
||||||
|
switch (team) {
|
||||||
|
case 0:
|
||||||
|
return leader2;
|
||||||
|
case 1:
|
||||||
|
return leader1;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getBlueCP() {
|
||||||
|
return blueCP;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBlueCP(int blueCP) {
|
||||||
|
this.blueCP = blueCP;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getBlueTotalCP() {
|
||||||
|
return blueTotalCP;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBlueTotalCP(int blueTotalCP) {
|
||||||
|
this.blueTotalCP = blueTotalCP;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getRedCP() {
|
||||||
|
return redCP;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRedCP(int redCP) {
|
||||||
|
this.redCP = redCP;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getRedTotalCP() {
|
||||||
|
return redTotalCP;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRedTotalCP(int redTotalCP) {
|
||||||
|
this.redTotalCP = redTotalCP;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getTotalCP(int team) {
|
||||||
|
if (team == 0) {
|
||||||
|
return redTotalCP;
|
||||||
|
} else if (team == 1) {
|
||||||
|
return blueTotalCP;
|
||||||
|
} else {
|
||||||
|
throw new RuntimeException("Equipe desconhecida");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTotalCP(int totalCP, int team) {
|
||||||
|
if (team == 0) {
|
||||||
|
this.redTotalCP = totalCP;
|
||||||
|
} else if (team == 1) {
|
||||||
|
this.blueTotalCP = totalCP;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCP(int team) {
|
||||||
|
if (team == 0) {
|
||||||
|
return redCP;
|
||||||
|
} else if (team == 1) {
|
||||||
|
return blueCP;
|
||||||
|
} else {
|
||||||
|
throw new RuntimeException("Equipe desconhecida" + team);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCP(int CP, int team) {
|
||||||
|
if (team == 0) {
|
||||||
|
this.redCP = CP;
|
||||||
|
} else if (team == 1) {
|
||||||
|
this.blueCP = CP;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+156
-140
@@ -75,7 +75,6 @@ import server.maps.MapleReactor;
|
|||||||
import server.maps.MapleSummon;
|
import server.maps.MapleSummon;
|
||||||
import server.life.MaplePlayerNPC;
|
import server.life.MaplePlayerNPC;
|
||||||
import server.movement.LifeMovementFragment;
|
import server.movement.LifeMovementFragment;
|
||||||
import server.partyquest.MonsterCarnivalParty;
|
|
||||||
import tools.data.output.LittleEndianWriter;
|
import tools.data.output.LittleEndianWriter;
|
||||||
import tools.data.output.MaplePacketLittleEndianWriter;
|
import tools.data.output.MaplePacketLittleEndianWriter;
|
||||||
import client.BuddylistEntry;
|
import client.BuddylistEntry;
|
||||||
@@ -244,7 +243,7 @@ public class MaplePacketCreator {
|
|||||||
Set<NewYearCardRecord> received = chr.getReceivedNewYearRecords();
|
Set<NewYearCardRecord> received = chr.getReceivedNewYearRecords();
|
||||||
|
|
||||||
mplew.writeShort(received.size());
|
mplew.writeShort(received.size());
|
||||||
for(NewYearCardRecord nyc : received) {
|
for (NewYearCardRecord nyc : received) {
|
||||||
encodeNewYearCard(nyc, mplew);
|
encodeNewYearCard(nyc, mplew);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -407,6 +406,7 @@ public class MaplePacketCreator {
|
|||||||
mplew.write(pet.getFullness());
|
mplew.write(pet.getFullness());
|
||||||
addExpirationTime(mplew, item.getExpiration());
|
addExpirationTime(mplew, item.getExpiration());
|
||||||
mplew.writeInt(pet.getPetFlag()); /* pet flags found by -- Irenex & Spoon */
|
mplew.writeInt(pet.getPetFlag()); /* pet flags found by -- Irenex & Spoon */
|
||||||
|
|
||||||
mplew.write(new byte[]{(byte) 0x50, (byte) 0x46}); //wonder what this is
|
mplew.write(new byte[]{(byte) 0x50, (byte) 0x46}); //wonder what this is
|
||||||
mplew.writeInt(0);
|
mplew.writeInt(0);
|
||||||
return;
|
return;
|
||||||
@@ -1501,29 +1501,16 @@ public class MaplePacketCreator {
|
|||||||
mplew.writeShort(0); //Origin FH //life.getStartFh()
|
mplew.writeShort(0); //Origin FH //life.getStartFh()
|
||||||
mplew.writeShort(life.getFh());
|
mplew.writeShort(life.getFh());
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* -4: Fake
|
* -4: Fake -3: Appear after linked mob is dead -2: Fade in 1: Smoke 3:
|
||||||
* -3: Appear after linked mob is dead
|
* King Slime spawn 4: Summoning rock thing, used for 3rd job? 6:
|
||||||
* -2: Fade in
|
* Magical shit 7: Smoke shit 8: 'The Boss' 9/10: Grim phantom shit?
|
||||||
* 1: Smoke
|
* 11/12: Nothing? 13: Frankenstein 14: Angry ^ 15: Orb animation thing,
|
||||||
* 3: King Slime spawn
|
* ?? 16: ?? 19: Mushroom castle boss thing
|
||||||
* 4: Summoning rock thing, used for 3rd job?
|
|
||||||
* 6: Magical shit
|
|
||||||
* 7: Smoke shit
|
|
||||||
* 8: 'The Boss'
|
|
||||||
* 9/10: Grim phantom shit?
|
|
||||||
* 11/12: Nothing?
|
|
||||||
* 13: Frankenstein
|
|
||||||
* 14: Angry ^
|
|
||||||
* 15: Orb animation thing, ??
|
|
||||||
* 16: ??
|
|
||||||
* 19: Mushroom castle boss thing
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (life.getParentMobOid() != 0) {
|
if (life.getParentMobOid() != 0) {
|
||||||
MapleMonster parentMob = life.getMap().getMonsterByOid(life.getParentMobOid());
|
MapleMonster parentMob = life.getMap().getMonsterByOid(life.getParentMobOid());
|
||||||
if(parentMob != null && parentMob.isAlive()) {
|
if (parentMob != null && parentMob.isAlive()) {
|
||||||
mplew.write(effect != 0 ? effect : -3);
|
mplew.write(effect != 0 ? effect : -3);
|
||||||
mplew.writeInt(life.getParentMobOid());
|
mplew.writeInt(life.getParentMobOid());
|
||||||
} else {
|
} else {
|
||||||
@@ -1632,7 +1619,6 @@ public class MaplePacketCreator {
|
|||||||
* @param skillLevel The level of the skill to use.
|
* @param skillLevel The level of the skill to use.
|
||||||
* @return The move response packet.
|
* @return The move response packet.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public static byte[] moveMonsterResponse(int objectid, short moveid, int currentMp, boolean useSkills, int skillId, int skillLevel) {
|
public static byte[] moveMonsterResponse(int objectid, short moveid, int currentMp, boolean useSkills, int skillId, int skillLevel) {
|
||||||
final MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter(13);
|
final MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter(13);
|
||||||
mplew.writeShort(SendOpcode.MOVE_MONSTER_RESPONSE.getValue());
|
mplew.writeShort(SendOpcode.MOVE_MONSTER_RESPONSE.getValue());
|
||||||
@@ -1847,7 +1833,7 @@ public class MaplePacketCreator {
|
|||||||
*
|
*
|
||||||
* @param guildName The Guild name, blank for nothing.
|
* @param guildName The Guild name, blank for nothing.
|
||||||
*/
|
*/
|
||||||
public static byte[] guildNameChanged(int chrid, String guildName){
|
public static byte[] guildNameChanged(int chrid, String guildName) {
|
||||||
MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
|
MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
|
||||||
mplew.writeShort(SendOpcode.GUILD_NAME_CHANGED.getValue());
|
mplew.writeShort(SendOpcode.GUILD_NAME_CHANGED.getValue());
|
||||||
mplew.writeInt(chrid);
|
mplew.writeInt(chrid);
|
||||||
@@ -1855,7 +1841,7 @@ public class MaplePacketCreator {
|
|||||||
return mplew.getPacket();
|
return mplew.getPacket();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static byte[] guildMarkChanged(int chrid, MapleGuild guild){
|
public static byte[] guildMarkChanged(int chrid, MapleGuild guild) {
|
||||||
MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
|
MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
|
||||||
mplew.writeShort(SendOpcode.GUILD_MARK_CHANGED.getValue());
|
mplew.writeShort(SendOpcode.GUILD_MARK_CHANGED.getValue());
|
||||||
mplew.writeInt(chrid);
|
mplew.writeInt(chrid);
|
||||||
@@ -1871,7 +1857,8 @@ public class MaplePacketCreator {
|
|||||||
*
|
*
|
||||||
* @param target The client receiving this packet.
|
* @param target The client receiving this packet.
|
||||||
* @param chr The character to spawn to other clients.
|
* @param chr The character to spawn to other clients.
|
||||||
* @param enteringField Whether the character to spawn is not yet present in the map or already is.
|
* @param enteringField Whether the character to spawn is not yet present in
|
||||||
|
* the map or already is.
|
||||||
* @return The spawn player packet.
|
* @return The spawn player packet.
|
||||||
*/
|
*/
|
||||||
public static byte[] spawnPlayerMapObject(MapleClient target, MapleCharacter chr, boolean enteringField) {
|
public static byte[] spawnPlayerMapObject(MapleClient target, MapleCharacter chr, boolean enteringField) {
|
||||||
@@ -1948,12 +1935,12 @@ public class MaplePacketCreator {
|
|||||||
|
|
||||||
Integer bv = chr.getBuffedValue(MapleBuffStat.MONSTER_RIDING);
|
Integer bv = chr.getBuffedValue(MapleBuffStat.MONSTER_RIDING);
|
||||||
if (bv != null) {
|
if (bv != null) {
|
||||||
if(bv.equals(Corsair.BATTLE_SHIP)) {
|
if (bv.equals(Corsair.BATTLE_SHIP)) {
|
||||||
mplew.writeInt(1932000);
|
mplew.writeInt(1932000);
|
||||||
mplew.writeInt(Corsair.BATTLE_SHIP);
|
mplew.writeInt(Corsair.BATTLE_SHIP);
|
||||||
} else {
|
} else {
|
||||||
final Item mount = chr.getInventory(MapleInventoryType.EQUIPPED).getItem((short) -18);
|
final Item mount = chr.getInventory(MapleInventoryType.EQUIPPED).getItem((short) -18);
|
||||||
if(mount != null) {
|
if (mount != null) {
|
||||||
mplew.writeInt(mount.getItemId());
|
mplew.writeInt(mount.getItemId());
|
||||||
mplew.writeInt(1004);
|
mplew.writeInt(1004);
|
||||||
} else {
|
} else {
|
||||||
@@ -1984,13 +1971,12 @@ public class MaplePacketCreator {
|
|||||||
} else {
|
} else {
|
||||||
mplew.writeShort(412);
|
mplew.writeShort(412);
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
addCharLook(mplew, chr, false);
|
addCharLook(mplew, chr, false);
|
||||||
mplew.writeInt(chr.getInventory(MapleInventoryType.CASH).countById(5110000));
|
mplew.writeInt(chr.getInventory(MapleInventoryType.CASH).countById(5110000));
|
||||||
mplew.writeInt(chr.getItemEffect());
|
mplew.writeInt(chr.getItemEffect());
|
||||||
mplew.writeInt(ItemConstants.getInventoryType(chr.getChair()) == MapleInventoryType.SETUP ? chr.getChair() : 0);
|
mplew.writeInt(ItemConstants.getInventoryType(chr.getChair()) == MapleInventoryType.SETUP ? chr.getChair() : 0);
|
||||||
|
|
||||||
if(enteringField) {
|
if (enteringField) {
|
||||||
Point spawnPos = new Point(chr.getPosition());
|
Point spawnPos = new Point(chr.getPosition());
|
||||||
spawnPos.y -= 42;
|
spawnPos.y -= 42;
|
||||||
mplew.writePos(spawnPos);
|
mplew.writePos(spawnPos);
|
||||||
@@ -2055,11 +2041,11 @@ public class MaplePacketCreator {
|
|||||||
|
|
||||||
private static void encodeNewYearCardInfo(MaplePacketLittleEndianWriter mplew, MapleCharacter chr) {
|
private static void encodeNewYearCardInfo(MaplePacketLittleEndianWriter mplew, MapleCharacter chr) {
|
||||||
Set<NewYearCardRecord> newyears = chr.getReceivedNewYearRecords();
|
Set<NewYearCardRecord> newyears = chr.getReceivedNewYearRecords();
|
||||||
if(!newyears.isEmpty()) {
|
if (!newyears.isEmpty()) {
|
||||||
mplew.write(1);
|
mplew.write(1);
|
||||||
|
|
||||||
mplew.writeInt(newyears.size());
|
mplew.writeInt(newyears.size());
|
||||||
for(NewYearCardRecord nyc : newyears) {
|
for (NewYearCardRecord nyc : newyears) {
|
||||||
mplew.writeInt(nyc.getId());
|
mplew.writeInt(nyc.getId());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -2354,7 +2340,6 @@ public class MaplePacketCreator {
|
|||||||
return mplew.getPacket();
|
return mplew.getPacket();
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public static byte[] closeRangeAttack(MapleCharacter chr, int skill, int skilllevel, int stance, int numAttackedAndDamage, Map<Integer, List<Integer>> damage, int speed, int direction, int display) {
|
public static byte[] closeRangeAttack(MapleCharacter chr, int skill, int skilllevel, int stance, int numAttackedAndDamage, Map<Integer, List<Integer>> damage, int speed, int direction, int display) {
|
||||||
final MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
|
final MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
|
||||||
mplew.writeShort(SendOpcode.CLOSE_RANGE_ATTACK.getValue());
|
mplew.writeShort(SendOpcode.CLOSE_RANGE_ATTACK.getValue());
|
||||||
@@ -2610,7 +2595,7 @@ public class MaplePacketCreator {
|
|||||||
mplew.writeInt(cid);
|
mplew.writeInt(cid);
|
||||||
mplew.write(skill);
|
mplew.write(skill);
|
||||||
mplew.writeInt(damage);
|
mplew.writeInt(damage);
|
||||||
if(skill != -4) {
|
if (skill != -4) {
|
||||||
mplew.writeInt(monsteridfrom);
|
mplew.writeInt(monsteridfrom);
|
||||||
mplew.write(direction);
|
mplew.write(direction);
|
||||||
if (pgmr) {
|
if (pgmr) {
|
||||||
@@ -2904,7 +2889,6 @@ public class MaplePacketCreator {
|
|||||||
* @param progress
|
* @param progress
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public static byte[] updateQuestInfo(short quest, int npc) {
|
public static byte[] updateQuestInfo(short quest, int npc) {
|
||||||
final MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
|
final MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
|
||||||
mplew.writeShort(SendOpcode.UPDATE_QUEST_INFO.getValue());
|
mplew.writeShort(SendOpcode.UPDATE_QUEST_INFO.getValue());
|
||||||
@@ -2988,7 +2972,9 @@ public class MaplePacketCreator {
|
|||||||
mplew.writeInt(cid);
|
mplew.writeInt(cid);
|
||||||
writeLongMaskD(mplew, statups);
|
writeLongMaskD(mplew, statups);
|
||||||
for (Pair<MapleDisease, Integer> statup : statups) {
|
for (Pair<MapleDisease, Integer> statup : statups) {
|
||||||
if(statup.getLeft() == MapleDisease.POISON) mplew.writeShort(statup.getRight().shortValue());
|
if (statup.getLeft() == MapleDisease.POISON) {
|
||||||
|
mplew.writeShort(statup.getRight().shortValue());
|
||||||
|
}
|
||||||
mplew.writeShort(skill.getSkillId());
|
mplew.writeShort(skill.getSkillId());
|
||||||
mplew.writeShort(skill.getSkillLevel());
|
mplew.writeShort(skill.getSkillLevel());
|
||||||
}
|
}
|
||||||
@@ -3084,7 +3070,9 @@ public class MaplePacketCreator {
|
|||||||
mplew.writeInt(cid);
|
mplew.writeInt(cid);
|
||||||
writeLongMaskSlowD(mplew);
|
writeLongMaskSlowD(mplew);
|
||||||
for (Pair<MapleDisease, Integer> statup : statups) {
|
for (Pair<MapleDisease, Integer> statup : statups) {
|
||||||
if(statup.getLeft() == MapleDisease.POISON) mplew.writeShort(statup.getRight().shortValue());
|
if (statup.getLeft() == MapleDisease.POISON) {
|
||||||
|
mplew.writeShort(statup.getRight().shortValue());
|
||||||
|
}
|
||||||
mplew.writeShort(skill.getSkillId());
|
mplew.writeShort(skill.getSkillId());
|
||||||
mplew.writeShort(skill.getSkillLevel());
|
mplew.writeShort(skill.getSkillLevel());
|
||||||
}
|
}
|
||||||
@@ -3121,7 +3109,9 @@ public class MaplePacketCreator {
|
|||||||
mplew.writeShort(0);
|
mplew.writeShort(0);
|
||||||
mplew.writeShort(900);
|
mplew.writeShort(900);
|
||||||
|
|
||||||
for(int i = 0; i < 7; i++) mplew.write(0);
|
for (int i = 0; i < 7; i++) {
|
||||||
|
mplew.write(0);
|
||||||
|
}
|
||||||
|
|
||||||
return mplew.getPacket();
|
return mplew.getPacket();
|
||||||
}
|
}
|
||||||
@@ -3261,8 +3251,8 @@ public class MaplePacketCreator {
|
|||||||
mplew.writeMapleAsciiString(shop.getOwner().getName());
|
mplew.writeMapleAsciiString(shop.getOwner().getName());
|
||||||
|
|
||||||
MapleCharacter visitors[] = shop.getVisitors();
|
MapleCharacter visitors[] = shop.getVisitors();
|
||||||
for(int i = 0; i < 3; i++) {
|
for (int i = 0; i < 3; i++) {
|
||||||
if(visitors[i] != null) {
|
if (visitors[i] != null) {
|
||||||
mplew.write(i + 1);
|
mplew.write(i + 1);
|
||||||
addCharLook(mplew, visitors[i], false);
|
addCharLook(mplew, visitors[i], false);
|
||||||
mplew.writeMapleAsciiString(visitors[i].getName());
|
mplew.writeMapleAsciiString(visitors[i].getName());
|
||||||
@@ -3633,7 +3623,9 @@ public class MaplePacketCreator {
|
|||||||
mplew.write(0xF);
|
mplew.write(0xF);
|
||||||
mplew.write(slots);
|
mplew.write(slots);
|
||||||
mplew.write(124);
|
mplew.write(124);
|
||||||
for(byte i = 0; i < 10; i++) mplew.write(0);
|
for (byte i = 0; i < 10; i++) {
|
||||||
|
mplew.write(0);
|
||||||
|
}
|
||||||
mplew.write(items.size());
|
mplew.write(items.size());
|
||||||
for (Item item : items) {
|
for (Item item : items) {
|
||||||
addItemInfo(mplew, item, true);
|
addItemInfo(mplew, item, true);
|
||||||
@@ -3671,7 +3663,7 @@ public class MaplePacketCreator {
|
|||||||
private static Pair<Integer, Integer> normalizedCustomMaxHP(long currHP, long maxHP) {
|
private static Pair<Integer, Integer> normalizedCustomMaxHP(long currHP, long maxHP) {
|
||||||
int sendHP, sendMaxHP;
|
int sendHP, sendMaxHP;
|
||||||
|
|
||||||
if(maxHP <= Integer.MAX_VALUE) {
|
if (maxHP <= Integer.MAX_VALUE) {
|
||||||
sendHP = (int) currHP;
|
sendHP = (int) currHP;
|
||||||
sendMaxHP = (int) maxHP;
|
sendMaxHP = (int) maxHP;
|
||||||
} else {
|
} else {
|
||||||
@@ -3746,7 +3738,7 @@ public class MaplePacketCreator {
|
|||||||
if (partyDoors.size() > 0) {
|
if (partyDoors.size() > 0) {
|
||||||
MapleDoor door = partyDoors.get(partycharid);
|
MapleDoor door = partyDoors.get(partycharid);
|
||||||
|
|
||||||
if(door != null) {
|
if (door != null) {
|
||||||
MapleDoorObject mdo = door.getAreaDoor();
|
MapleDoorObject mdo = door.getAreaDoor();
|
||||||
mplew.writeInt(mdo.getTo().getId());
|
mplew.writeInt(mdo.getTo().getId());
|
||||||
mplew.writeInt(mdo.getFrom().getId());
|
mplew.writeInt(mdo.getFrom().getId());
|
||||||
@@ -3780,14 +3772,13 @@ public class MaplePacketCreator {
|
|||||||
/**
|
/**
|
||||||
* 10: A beginner can't create a party. 1/5/6/11/14/19: Your request for a
|
* 10: A beginner can't create a party. 1/5/6/11/14/19: Your request for a
|
||||||
* party didn't work due to an unexpected error. 12: Quit as leader of the
|
* party didn't work due to an unexpected error. 12: Quit as leader of the
|
||||||
* party. 13: You have yet to join a party.
|
* party. 13: You have yet to join a party. 16: Already have joined a party.
|
||||||
* 16: Already have joined a party. 17: The party you're trying to join is
|
* 17: The party you're trying to join is already in full capacity. 19:
|
||||||
* already in full capacity. 19: Unable to find the requested character in
|
* Unable to find the requested character in this channel. 21: Player is
|
||||||
* this channel. 21: Player is blocking any party invitations. 22: Player
|
* blocking any party invitations. 22: Player is taking care of another
|
||||||
* is taking care of another invitation. 23: Player denied request.
|
* invitation. 23: Player denied request. 25: Cannot kick another user in
|
||||||
* 25: Cannot kick another user in this map. 28/29: Leadership can only be
|
* this map. 28/29: Leadership can only be given to a party member in the
|
||||||
* given to a party member in the vicinity. 30: Change leadership only on
|
* vicinity. 30: Change leadership only on same channel.
|
||||||
* same channel.
|
|
||||||
*
|
*
|
||||||
* @param message
|
* @param message
|
||||||
* @return
|
* @return
|
||||||
@@ -3852,7 +3843,7 @@ public class MaplePacketCreator {
|
|||||||
if (partychar.getChannel() == forchannel && !leaving) {
|
if (partychar.getChannel() == forchannel && !leaving) {
|
||||||
if (partyDoors.size() > 0) {
|
if (partyDoors.size() > 0) {
|
||||||
MapleDoor door = partyDoors.get(partychar.getId());
|
MapleDoor door = partyDoors.get(partychar.getId());
|
||||||
if(door != null) {
|
if (door != null) {
|
||||||
MapleDoorObject mdo = door.getTownDoor();
|
MapleDoorObject mdo = door.getTownDoor();
|
||||||
lew.writeInt(mdo.getTown().getId());
|
lew.writeInt(mdo.getTown().getId());
|
||||||
lew.writeInt(mdo.getArea().getId());
|
lew.writeInt(mdo.getArea().getId());
|
||||||
@@ -3974,6 +3965,30 @@ public class MaplePacketCreator {
|
|||||||
mplew.writeInt(secondmask);
|
mplew.writeInt(secondmask);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static byte[] applyMonsterStatus(int oid, Map<MonsterStatus, Integer> stats, int skill, boolean monsterSkill, int delay, MobSkill mobskill) {
|
||||||
|
MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
|
||||||
|
mplew.writeShort(SendOpcode.APPLY_MONSTER_STATUS.getValue());
|
||||||
|
mplew.writeInt(oid);
|
||||||
|
int mask = 0;
|
||||||
|
for (MonsterStatus stat : stats.keySet()) {
|
||||||
|
mask |= stat.getValue();
|
||||||
|
}
|
||||||
|
mplew.writeInt(mask);
|
||||||
|
for (Integer val : stats.values()) {
|
||||||
|
mplew.writeShort(val);
|
||||||
|
if (monsterSkill) {
|
||||||
|
mplew.writeShort(mobskill.getSkillId());
|
||||||
|
mplew.writeShort(mobskill.getSkillLevel());
|
||||||
|
} else {
|
||||||
|
mplew.writeInt(skill);
|
||||||
|
}
|
||||||
|
mplew.writeShort(0); // as this looks similar to giveBuff this
|
||||||
|
}
|
||||||
|
mplew.writeShort(delay); // delay in ms
|
||||||
|
mplew.write(1); // ?
|
||||||
|
return mplew.getPacket();
|
||||||
|
}
|
||||||
|
|
||||||
public static byte[] applyMonsterStatus(final int oid, final MonsterStatusEffect mse, final List<Integer> reflection) {
|
public static byte[] applyMonsterStatus(final int oid, final MonsterStatusEffect mse, final List<Integer> reflection) {
|
||||||
Map<MonsterStatus, Integer> stati = mse.getStati();
|
Map<MonsterStatus, Integer> stati = mse.getStati();
|
||||||
final MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
|
final MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
|
||||||
@@ -4196,7 +4211,7 @@ public class MaplePacketCreator {
|
|||||||
mplew.write(reactor.getState());
|
mplew.write(reactor.getState());
|
||||||
mplew.writePos(pos);
|
mplew.writePos(pos);
|
||||||
mplew.writeShort(0);
|
mplew.writeShort(0);
|
||||||
mplew.write(0);
|
mplew.write(reactor.getFacingDirection()); // stance
|
||||||
return mplew.getPacket();
|
return mplew.getPacket();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4259,7 +4274,7 @@ public class MaplePacketCreator {
|
|||||||
mplew.writeShort(SendOpcode.FIELD_OBSTACLE_ONOFF_LIST.getValue());
|
mplew.writeShort(SendOpcode.FIELD_OBSTACLE_ONOFF_LIST.getValue());
|
||||||
mplew.writeInt(envList.size());
|
mplew.writeInt(envList.size());
|
||||||
|
|
||||||
for(Entry<String, Integer> envMove : envList) {
|
for (Entry<String, Integer> envMove : envList) {
|
||||||
mplew.writeMapleAsciiString(envMove.getKey());
|
mplew.writeMapleAsciiString(envMove.getKey());
|
||||||
mplew.writeInt(envMove.getValue());
|
mplew.writeInt(envMove.getValue());
|
||||||
}
|
}
|
||||||
@@ -4705,7 +4720,6 @@ public class MaplePacketCreator {
|
|||||||
return mplew.getPacket();
|
return mplew.getPacket();
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public static byte[] OnCoupleMessage(String fiance, String text, boolean spouse) {
|
public static byte[] OnCoupleMessage(String fiance, String text, boolean spouse) {
|
||||||
MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
|
MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
|
||||||
mplew.writeShort(SendOpcode.SPOUSE_CHAT.getValue());
|
mplew.writeShort(SendOpcode.SPOUSE_CHAT.getValue());
|
||||||
@@ -5125,13 +5139,15 @@ public class MaplePacketCreator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 1 = Room already closed 2 = Can't enter due full cappacity 3 = Other requests at this minute
|
* 1 = Room already closed 2 = Can't enter due full cappacity 3 = Other
|
||||||
* 4 = Can't do while dead 5 = Can't do while middle event 6 = This character unable to do it
|
* requests at this minute 4 = Can't do while dead 5 = Can't do while middle
|
||||||
* 7, 20 = Not allowed to trade anymore 9 = Can only trade on same map 10 = May not open store near portal
|
* event 6 = This character unable to do it 7, 20 = Not allowed to trade
|
||||||
* 11, 14 = Can't start game here 12 = Can't open store at this channel 13 = Can't estabilish miniroom
|
* anymore 9 = Can only trade on same map 10 = May not open store near
|
||||||
* 15 = Stores only an the free market 16 = Lists the rooms at FM (?) 17 = You may not enter this store
|
* portal 11, 14 = Can't start game here 12 = Can't open store at this
|
||||||
* 18 = Owner undergoing store maintenance 19 = Unable to enter tournament room 21 = Not enough mesos to enter
|
* channel 13 = Can't estabilish miniroom 15 = Stores only an the free
|
||||||
* 22 = Incorrect password
|
* market 16 = Lists the rooms at FM (?) 17 = You may not enter this store
|
||||||
|
* 18 = Owner undergoing store maintenance 19 = Unable to enter tournament
|
||||||
|
* room 21 = Not enough mesos to enter 22 = Incorrect password
|
||||||
*
|
*
|
||||||
* @param status
|
* @param status
|
||||||
* @return
|
* @return
|
||||||
@@ -5251,6 +5267,7 @@ public class MaplePacketCreator {
|
|||||||
mplew.write(PlayerInteractionHandler.Action.EXIT.getCode());
|
mplew.write(PlayerInteractionHandler.Action.EXIT.getCode());
|
||||||
mplew.write(1);
|
mplew.write(1);
|
||||||
mplew.write(type); /* 2 : CRASH 3 : The room has been closed 4 : You have left the room 5 : You have been expelled */
|
mplew.write(type); /* 2 : CRASH 3 : The room has been closed 4 : You have left the room 5 : You have been expelled */
|
||||||
|
|
||||||
return mplew.getPacket();
|
return mplew.getPacket();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5477,7 +5494,7 @@ public class MaplePacketCreator {
|
|||||||
MaplePlayerShopItem item = hme.getLeft();
|
MaplePlayerShopItem item = hme.getLeft();
|
||||||
AbstractMapleMapObject mo = hme.getRight();
|
AbstractMapleMapObject mo = hme.getRight();
|
||||||
|
|
||||||
if(mo instanceof MaplePlayerShop) {
|
if (mo instanceof MaplePlayerShop) {
|
||||||
MaplePlayerShop ps = (MaplePlayerShop) mo;
|
MaplePlayerShop ps = (MaplePlayerShop) mo;
|
||||||
MapleCharacter owner = ps.getOwner();
|
MapleCharacter owner = ps.getOwner();
|
||||||
|
|
||||||
@@ -5740,37 +5757,37 @@ public class MaplePacketCreator {
|
|||||||
Map<Short, Integer> equip = npc.getEquips();
|
Map<Short, Integer> equip = npc.getEquips();
|
||||||
Map<Short, Integer> myEquip = new LinkedHashMap<>();
|
Map<Short, Integer> myEquip = new LinkedHashMap<>();
|
||||||
Map<Short, Integer> maskedEquip = new LinkedHashMap<>();
|
Map<Short, Integer> maskedEquip = new LinkedHashMap<>();
|
||||||
for(short position : equip.keySet()) {
|
for (short position : equip.keySet()) {
|
||||||
short pos = (byte) (position * -1);
|
short pos = (byte) (position * -1);
|
||||||
if(pos < 100 && myEquip.get(pos) == null) {
|
if (pos < 100 && myEquip.get(pos) == null) {
|
||||||
myEquip.put(pos, equip.get(position));
|
myEquip.put(pos, equip.get(position));
|
||||||
} else if((pos > 100 && pos != 111) || pos == -128) { // don't ask. o.o
|
} else if ((pos > 100 && pos != 111) || pos == -128) { // don't ask. o.o
|
||||||
pos -= 100;
|
pos -= 100;
|
||||||
if(myEquip.get(pos) != null) {
|
if (myEquip.get(pos) != null) {
|
||||||
maskedEquip.put(pos, myEquip.get(pos));
|
maskedEquip.put(pos, myEquip.get(pos));
|
||||||
}
|
}
|
||||||
myEquip.put(pos, equip.get(position));
|
myEquip.put(pos, equip.get(position));
|
||||||
} else if(myEquip.get(pos) != null) {
|
} else if (myEquip.get(pos) != null) {
|
||||||
maskedEquip.put(pos, equip.get(position));
|
maskedEquip.put(pos, equip.get(position));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for(Entry<Short, Integer> entry : myEquip.entrySet()) {
|
for (Entry<Short, Integer> entry : myEquip.entrySet()) {
|
||||||
mplew.write(entry.getKey());
|
mplew.write(entry.getKey());
|
||||||
mplew.writeInt(entry.getValue());
|
mplew.writeInt(entry.getValue());
|
||||||
}
|
}
|
||||||
mplew.write(0xFF);
|
mplew.write(0xFF);
|
||||||
for(Entry<Short, Integer> entry : maskedEquip.entrySet()) {
|
for (Entry<Short, Integer> entry : maskedEquip.entrySet()) {
|
||||||
mplew.write(entry.getKey());
|
mplew.write(entry.getKey());
|
||||||
mplew.writeInt(entry.getValue());
|
mplew.writeInt(entry.getValue());
|
||||||
}
|
}
|
||||||
mplew.write(0xFF);
|
mplew.write(0xFF);
|
||||||
Integer cWeapon = equip.get((byte) -111);
|
Integer cWeapon = equip.get((byte) -111);
|
||||||
if(cWeapon != null) {
|
if (cWeapon != null) {
|
||||||
mplew.writeInt(cWeapon);
|
mplew.writeInt(cWeapon);
|
||||||
} else {
|
} else {
|
||||||
mplew.writeInt(0);
|
mplew.writeInt(0);
|
||||||
}
|
}
|
||||||
for(int i = 0; i < 3; i++) {
|
for (int i = 0; i < 3; i++) {
|
||||||
mplew.writeInt(0);
|
mplew.writeInt(0);
|
||||||
}
|
}
|
||||||
return mplew.getPacket();
|
return mplew.getPacket();
|
||||||
@@ -6489,9 +6506,11 @@ public class MaplePacketCreator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 0 = Levelup 6 = Exp did not drop (Safety Charms) 7 = Enter portal sound 8 = Job
|
* 0 = Levelup 6 = Exp did not drop (Safety Charms) 7 = Enter portal sound 8
|
||||||
* change 9 = Quest complete 10 = Recovery 11 = Buff effect 14 = Monster book pickup 15 =
|
* = Job change 9 = Quest complete 10 = Recovery 11 = Buff effect 14 =
|
||||||
* Equipment levelup 16 = Maker Skill Success 17 = Buff effect w/ sfx 19 = Exp card [500, 200, 50] 21 = Wheel of destiny 26 = Spirit Stone
|
* Monster book pickup 15 = Equipment levelup 16 = Maker Skill Success 17 =
|
||||||
|
* Buff effect w/ sfx 19 = Exp card [500, 200, 50] 21 = Wheel of destiny 26
|
||||||
|
* = Spirit Stone
|
||||||
*
|
*
|
||||||
* @param effect
|
* @param effect
|
||||||
* @return
|
* @return
|
||||||
@@ -7159,7 +7178,7 @@ public class MaplePacketCreator {
|
|||||||
|
|
||||||
mob.applyAndGetHpDamage(damage, false);
|
mob.applyAndGetHpDamage(damage, false);
|
||||||
int remainingHp = mob.getHp();
|
int remainingHp = mob.getHp();
|
||||||
if(remainingHp <= 0) {
|
if (remainingHp <= 0) {
|
||||||
remainingHp = 0;
|
remainingHp = 0;
|
||||||
mob.getMap().removeMapObject(mob);
|
mob.getMap().removeMapObject(mob);
|
||||||
}
|
}
|
||||||
@@ -7199,7 +7218,7 @@ public class MaplePacketCreator {
|
|||||||
mplew.writeInt(ring.getItemId());
|
mplew.writeInt(ring.getItemId());
|
||||||
}
|
}
|
||||||
|
|
||||||
if(chr.getPartnerId() > 0) {
|
if (chr.getPartnerId() > 0) {
|
||||||
MapleRing marriageRing = chr.getMarriageRing();
|
MapleRing marriageRing = chr.getMarriageRing();
|
||||||
|
|
||||||
mplew.writeShort(1);
|
mplew.writeShort(1);
|
||||||
@@ -7664,80 +7683,77 @@ public class MaplePacketCreator {
|
|||||||
return mplew.getPacket();
|
return mplew.getPacket();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static byte[] startCPQ(MapleCharacter chr, MonsterCarnivalParty enemy) {
|
public static byte[] CPUpdate(boolean party, int curCP, int totalCP,
|
||||||
final MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter(25);
|
int team) { // CPQ
|
||||||
mplew.writeShort(SendOpcode.MONSTER_CARNIVAL_START.getValue());
|
MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
|
||||||
mplew.write(chr.getTeam()); //team
|
if (!party) {
|
||||||
mplew.writeShort(chr.getCP()); //Obtained CP - Used CP
|
|
||||||
mplew.writeShort(chr.getObtainedCP()); //Total Obtained CP
|
|
||||||
mplew.writeShort(chr.getCarnivalParty().getAvailableCP()); //Obtained CP - Used CP of the team
|
|
||||||
mplew.writeShort(chr.getCarnivalParty().getTotalCP()); //Total Obtained CP of the team
|
|
||||||
mplew.writeShort(enemy.getAvailableCP()); //Obtained CP - Used CP of the team
|
|
||||||
mplew.writeShort(enemy.getTotalCP()); //Total Obtained CP of the team
|
|
||||||
mplew.writeShort(0); //Probably useless nexon shit
|
|
||||||
mplew.writeLong(0); //Probably useless nexon shit
|
|
||||||
return mplew.getPacket();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static byte[] updateCP(int cp, int tcp) {
|
|
||||||
final MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter(6);
|
|
||||||
mplew.writeShort(SendOpcode.MONSTER_CARNIVAL_OBTAINED_CP.getValue());
|
mplew.writeShort(SendOpcode.MONSTER_CARNIVAL_OBTAINED_CP.getValue());
|
||||||
mplew.writeShort(cp); //Obtained CP - Used CP
|
} else {
|
||||||
mplew.writeShort(tcp); //Total Obtained CP
|
|
||||||
return mplew.getPacket();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static byte[] updatePartyCP(MonsterCarnivalParty party) {
|
|
||||||
final MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter(7);
|
|
||||||
mplew.writeShort(SendOpcode.MONSTER_CARNIVAL_PARTY_CP.getValue());
|
mplew.writeShort(SendOpcode.MONSTER_CARNIVAL_PARTY_CP.getValue());
|
||||||
mplew.write(party.getTeam()); //Team where the points are given to.
|
mplew.write(team); // team?
|
||||||
mplew.writeShort(party.getAvailableCP()); //Obtained CP - Used CP
|
}
|
||||||
mplew.writeShort(party.getTotalCP()); //Total Obtained CP
|
mplew.writeShort(curCP);
|
||||||
|
mplew.writeShort(totalCP);
|
||||||
return mplew.getPacket();
|
return mplew.getPacket();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static byte[] CPQSummon(int tab, int number, String name) {
|
|
||||||
final MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
|
|
||||||
mplew.writeShort(SendOpcode.MONSTER_CARNIVAL_SUMMON.getValue());
|
|
||||||
mplew.write(tab); //Tab
|
|
||||||
mplew.writeShort(number); //Number of summon inside the tab
|
|
||||||
mplew.writeMapleAsciiString(name); //Name of the player that summons
|
|
||||||
return mplew.getPacket();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static byte[] CPQDied(MapleCharacter chr) {
|
|
||||||
final MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
|
|
||||||
mplew.writeShort(SendOpcode.MONSTER_CARNIVAL_DIED.getValue());
|
|
||||||
mplew.write(chr.getTeam()); //Team
|
|
||||||
mplew.writeMapleAsciiString(chr.getName()); //Name of the player that died
|
|
||||||
mplew.write(chr.getAndRemoveCP()); //Lost CP
|
|
||||||
return mplew.getPacket();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sends a CPQ Message<br>
|
|
||||||
*
|
|
||||||
* Possible values for <code>message</code>:<br> 1: You don't have enough CP
|
|
||||||
* to continue.<br> 2: You can no longer summon the Monster.<br> 3: You can
|
|
||||||
* no longer summon the being.<br> 4: This being is already summoned.<br> 5:
|
|
||||||
* This request has failed due to an unknown error.<br>
|
|
||||||
*
|
|
||||||
* @param message Displays a message inside Carnival PQ
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public static byte[] CPQMessage(byte message) {
|
public static byte[] CPQMessage(byte message) {
|
||||||
final MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter(3);
|
final MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter(
|
||||||
|
3);
|
||||||
mplew.writeShort(SendOpcode.MONSTER_CARNIVAL_MESSAGE.getValue());
|
mplew.writeShort(SendOpcode.MONSTER_CARNIVAL_MESSAGE.getValue());
|
||||||
mplew.write(message); //Message
|
mplew.write(message); // Message
|
||||||
return mplew.getPacket();
|
return mplew.getPacket();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static byte[] leaveCPQ(MapleCharacter chr) {
|
public static byte[] playerSummoned(String name, int tab, int number) {
|
||||||
final MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
|
MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
|
||||||
mplew.writeShort(SendOpcode.MONSTER_CARNIVAL_LEAVE.getValue());
|
mplew.writeShort(SendOpcode.MONSTER_CARNIVAL_SUMMON.getValue());
|
||||||
mplew.write(0); //Something
|
mplew.write(tab);
|
||||||
mplew.write(chr.getTeam()); //Team
|
mplew.write(number);
|
||||||
mplew.writeMapleAsciiString(chr.getName()); //Player name
|
mplew.writeMapleAsciiString(name);
|
||||||
|
return mplew.getPacket();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static byte[] playerDiedMessage(String name, int lostCP, int team) { // CPQ
|
||||||
|
MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
|
||||||
|
|
||||||
|
mplew.writeShort(SendOpcode.MONSTER_CARNIVAL_DIED.getValue());
|
||||||
|
mplew.write(team); // team
|
||||||
|
mplew.writeMapleAsciiString(name);
|
||||||
|
mplew.write(lostCP);
|
||||||
|
return mplew.getPacket();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static byte[] startMonsterCarnival(MapleCharacter chr, int team,
|
||||||
|
int oposition) {
|
||||||
|
final MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter(
|
||||||
|
25);
|
||||||
|
mplew.writeShort(SendOpcode.MONSTER_CARNIVAL_START.getValue());
|
||||||
|
mplew.write(team); // team
|
||||||
|
mplew.writeShort(chr.getCP()); // Obtained CP - Used CP
|
||||||
|
mplew.writeShort(chr.getTotalCP()); // Total Obtained CP
|
||||||
|
mplew.writeShort(chr.getMonsterCarnival().getCP(team)); // Obtained CP -
|
||||||
|
// Used CP of
|
||||||
|
// the team
|
||||||
|
mplew.writeShort(chr.getMonsterCarnival().getTotalCP(team)); // Total
|
||||||
|
// Obtained
|
||||||
|
// CP of
|
||||||
|
// the
|
||||||
|
// team
|
||||||
|
mplew.writeShort(chr.getMonsterCarnival().getCP(oposition)); // Obtained
|
||||||
|
// CP -
|
||||||
|
// Used
|
||||||
|
// CP of
|
||||||
|
// the
|
||||||
|
// team
|
||||||
|
mplew.writeShort(chr.getMonsterCarnival().getTotalCP(oposition)); // Total
|
||||||
|
// Obtained
|
||||||
|
// CP
|
||||||
|
// of
|
||||||
|
// the
|
||||||
|
// team
|
||||||
|
mplew.writeShort(0); // Probably useless nexon shit
|
||||||
|
mplew.writeLong(0); // Probably useless nexon shit
|
||||||
return mplew.getPacket();
|
return mplew.getPacket();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ import constants.CharsetConstants.MapleLanguageType;
|
|||||||
* @since Revision 323
|
* @since Revision 323
|
||||||
*/
|
*/
|
||||||
public class GenericLittleEndianWriter implements LittleEndianWriter {
|
public class GenericLittleEndianWriter implements LittleEndianWriter {
|
||||||
private static Charset ASCII = Charset.forName(MapleLanguageType.LANGUAGE_US.getAscii());
|
private static Charset ASCII = Charset.forName(MapleLanguageType.LANGUAGE_PT_BR.getAscii());
|
||||||
private ByteOutputStream bos;
|
private ByteOutputStream bos;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import tools.data.output.MaplePacketLittleEndianWriter;
|
|||||||
/**
|
/**
|
||||||
* CField_Wedding, CField_WeddingPhoto, CWeddingMan, OnMarriageResult, and all Wedding/Marriage enum/structs.
|
* CField_Wedding, CField_WeddingPhoto, CWeddingMan, OnMarriageResult, and all Wedding/Marriage enum/structs.
|
||||||
*
|
*
|
||||||
* @author Eric
|
* @author Eric edited by Drago/Dragohe4rt on Wishlist
|
||||||
*/
|
*/
|
||||||
public class Wedding extends MaplePacketCreator {
|
public class Wedding extends MaplePacketCreator {
|
||||||
private static final short MARRIAGE_REQUEST = 0x48;
|
private static final short MARRIAGE_REQUEST = 0x48;
|
||||||
@@ -392,17 +392,16 @@ public class Wedding extends MaplePacketCreator {
|
|||||||
MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
|
MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
|
||||||
mplew.writeShort(WEDDING_GIFT_RESULT);
|
mplew.writeShort(WEDDING_GIFT_RESULT);
|
||||||
mplew.write(mode);
|
mplew.write(mode);
|
||||||
switch(mode) {
|
switch (mode) {
|
||||||
case 0x09: { // Load Wedding Registry
|
case 0x09: { // Load Wedding Registry
|
||||||
mplew.write(itemnames.size());
|
mplew.write(itemnames.size());
|
||||||
for (String names : itemnames) {
|
for (String names : itemnames) {
|
||||||
mplew.writeMapleAsciiString(names);
|
mplew.writeMapleAsciiString(names);
|
||||||
}
|
}
|
||||||
mplew.write(itemnames.size());
|
mplew.write(items.size());
|
||||||
for (String names : itemnames) {
|
for (Item item : items) {
|
||||||
mplew.writeMapleAsciiString(names);
|
addItemInfo(mplew, item, true);
|
||||||
}
|
}
|
||||||
// need to load items somehow
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 0xA: // Load Bride's Wishlist
|
case 0xA: // Load Bride's Wishlist
|
||||||
@@ -415,6 +414,7 @@ public class Wedding extends MaplePacketCreator {
|
|||||||
mplew.writeMapleAsciiString(names);
|
mplew.writeMapleAsciiString(names);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (items.size() >= 1) {
|
||||||
switch (items.get((items.size() - 1)).getInventoryType()) {
|
switch (items.get((items.size() - 1)).getInventoryType()) {
|
||||||
case EQUIP:
|
case EQUIP:
|
||||||
mplew.writeLong(4);
|
mplew.writeLong(4);
|
||||||
@@ -433,12 +433,12 @@ public class Wedding extends MaplePacketCreator {
|
|||||||
mplew.writeLong(0);
|
mplew.writeLong(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (mode == 0xA) { // random unknown bytes involved within Bride's Wishlist
|
} else {
|
||||||
mplew.writeInt(0);
|
mplew.writeLong(0);
|
||||||
}
|
}
|
||||||
mplew.write(items.size());
|
mplew.write(items.size());
|
||||||
for (Item item : items) {
|
for (Item item : items) {
|
||||||
MaplePacketCreator.addItemInfo(mplew, item, true);
|
addItemInfo(mplew, item, true);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user