diff --git a/config.yaml b/config.yaml
index 588ef50ca3e..f46841921b3 100644
--- a/config.yaml
+++ b/config.yaml
@@ -283,10 +283,6 @@ server:
USE_MAKER_PERMISSIVE_ATKUP: false #Allows players to use attack-based strengthening gems on non-weapon items.
USE_MAKER_FEE_HEURISTICS: true #Apply compiled values for stimulants and reagents into the Maker fee calculations (max error revolves around 50k mesos). Set false to use basic constant values instead (results are never higher than requested by the client-side).
- #Custom Configuration
- USE_ENABLE_CUSTOM_NPC_SCRIPT: false #Enables usage of custom HeavenMS NPC scripts (Agent E, Coco, etc). Will not disable Abdula (it's actually useful for the gameplay) or quests.
- USE_STARTER_MERGE: false #Allows any players to use the Equipment Merge custom mechanic (as opposed to the high-level, Maker lv3 requisites).
-
#Commands Configuration
BLOCK_GENERATE_CASH_ITEM: false #Prevents creation of cash items with the item/drop command.
USE_WHOLE_SERVER_RANKING: false #Enables a ranking pool made from every character registered on the server for the "ranks" command, instead of separated by worlds.
diff --git a/scripts/npc/2042000.js b/scripts/npc/2042000.js
index 0cffaa8bb29..b092f69f543 100644
--- a/scripts/npc/2042000.js
+++ b/scripts/npc/2042000.js
@@ -21,25 +21,13 @@ var cpqMaxLvl = 50;
var cpqMinAmt = 2;
var cpqMaxAmt = 6;
-// Ronan's custom ore refiner NPC
-var refineRocks = true; // enables moon rock, star rock
-var refineCrystals = true; // enables common crystals
-var refineSpecials = true; // enables lithium, special crystals
-var feeMultiplier = 7.0;
-
function start() {
status = -1;
const YamlConfig = Java.type('config.YamlConfig');
if (!YamlConfig.config.server.USE_CPQ) {
- if (YamlConfig.config.server.USE_ENABLE_CUSTOM_NPC_SCRIPT) {
- status = 0;
- action(1, 0, 4);
- } else {
- cm.sendOk("The Monster Carnival is currently unavailable.");
- cm.dispose();
- }
-
+ cm.sendOk("The Monster Carnival is currently unavailable.");
+ cm.dispose();
return;
}
@@ -239,9 +227,6 @@ function action(mode, type, selection) {
} else {
if (status == 0) {
var talk = "What would you like to do? If you have never participate in the Monster Carnival, you will need to know a few things before participating! \r\n#b#L0# Go to the Monster Carnival 1.#l \r\n#L3# Go to the Monster Carnival 2.#l \r\n#L1# Learn about the Monster Carnival.#l\r\n#L2# Trade #t4001129#.#l";
- if (YamlConfig.config.server.USE_ENABLE_CUSTOM_NPC_SCRIPT) {
- talk += "\r\n#L4# ... Can I just refine my ores?#l";
- }
cm.sendSimple(talk);
} else if (status == 1) {
if (selection == 0) {
@@ -269,24 +254,6 @@ function action(mode, type, selection) {
cm.warp(980030000, 0);
cm.dispose();
- } else if (selection == 4) {
- var selStr = "Very well, instead I offer a steadfast #bore refining#k service for you, taxing #r" + ((feeMultiplier * 100) | 0) + "%#k over the usual fee to synthetize them. What will you do?#b";
-
- var options = ["Refine mineral ores", "Refine jewel ores"];
- if (refineCrystals) {
- options.push("Refine crystal ores");
- }
- if (refineRocks) {
- options.push("Refine plates/jewels");
- }
-
- for (var i = 0; i < options.length; i++) {
- selStr += "\r\n#L" + i + "# " + options[i] + "#l";
- }
-
- cm.sendSimple(selStr);
-
- status = 76;
}
} else if (status == 2) {
select = selection;
@@ -445,170 +412,7 @@ function action(mode, type, selection) {
} else if (status == 66) {
cm.sendNext("Lastly, while in the Monster Carnival, #byou can not use items / recovery potions that you carry around with you. #kMeanwhile, the monsters let these items fall for good. when, and when you #bget them, the item will immediately activate#k. That's why it's important to know when to get these items.");
cm.dispose();
- } else if (status == 77) {
- var allDone;
-
- if (selection == 0) {
- allDone = refineItems(0); // minerals
- } else if (selection == 1) {
- allDone = refineItems(1); // jewels
- } else if (selection == 2 && refineCrystals) {
- allDone = refineItems(2); // crystals
- } else if (selection == 2 && !refineCrystals || selection == 3) {
- allDone = refineRockItems(); // moon/star rock
- }
-
- if (allDone) {
- cm.sendOk("Done. Thanks for showing up~.");
- } else {
- cm.sendOk("Done. Be aware some of the items #rcould not be synthetized#k because either you have a lack of space on your ETC inventory or there's not enough mesos to cover the fee.");
- }
- cm.dispose();
- }
- }
- }
-}
-
-function getRefineFee(fee) {
- return ((feeMultiplier * fee) | 0);
-}
-
-function isRefineTarget(refineType, refineItemid) {
- if (refineType == 0) { //mineral refine
- return refineItemid >= 4010000 && refineItemid <= 4010007 && !(refineItemid == 4010007 && !refineSpecials);
- } else if (refineType == 1) { //jewel refine
- return refineItemid >= 4020000 && refineItemid <= 4020008 && !(refineItemid == 4020008 && !refineSpecials);
- } else if (refineType == 2) { //crystal refine
- return refineItemid >= 4004000 && refineItemid <= 4004004 && !(refineItemid == 4004004 && !refineSpecials);
- }
-
- return false;
-}
-
-function getRockRefineTarget(refineItemid) {
- if (refineItemid >= 4011000 && refineItemid <= 4011006) {
- return 0;
- } else if (refineItemid >= 4021000 && refineItemid <= 4021008) {
- return 1;
- }
-
- return -1;
-}
-
-function refineItems(refineType) {
- var allDone = true;
-
- var refineFees = [[300, 300, 300, 500, 500, 500, 800, 270], [500, 500, 500, 500, 500, 500, 500, 1000, 3000], [5000, 5000, 5000, 5000, 1000000]];
- var itemCount = {};
-
- const InventoryType = Java.type('client.inventory.InventoryType');
- var iter = cm.getPlayer().getInventory(InventoryType.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];
-
- const InventoryType = Java.type('client.inventory.InventoryType');
- var iter = cm.getPlayer().getInventory(InventoryType.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;
-}
+}
\ No newline at end of file
diff --git a/scripts/npc/2042001.js b/scripts/npc/2042001.js
index b0933ee1e26..b092f69f543 100644
--- a/scripts/npc/2042001.js
+++ b/scripts/npc/2042001.js
@@ -3,6 +3,7 @@
1.0 - First Version by Drago (MapleStorySA)
2.0 - Second Version by Ronan (HeavenMS)
3.0 - Third Version by Jayd - translated CPQ contents to English and added Pirate items
+ Special thanks to 頼晏 (ryantpayton) for also stepping in to translate CPQ scripts.
---------------------------------------------------------------------------------------------------
**/
@@ -20,25 +21,13 @@ var cpqMaxLvl = 50;
var cpqMinAmt = 2;
var cpqMaxAmt = 6;
-// Ronan's custom ore refiner NPC
-var refineRocks = true; // enables moon rock, star rock
-var refineCrystals = true; // enables common crystals
-var refineSpecials = true; // enables lithium, special crystals
-var feeMultiplier = 7.0;
-
function start() {
status = -1;
const YamlConfig = Java.type('config.YamlConfig');
if (!YamlConfig.config.server.USE_CPQ) {
- if (YamlConfig.config.server.USE_ENABLE_CUSTOM_NPC_SCRIPT) {
- status = 0;
- action(1, 0, 4);
- } else {
- cm.sendOk("The Monster Carnival is currently unavailable.");
- cm.dispose();
- }
-
+ cm.sendOk("The Monster Carnival is currently unavailable.");
+ cm.dispose();
return;
}
@@ -238,9 +227,6 @@ function action(mode, type, selection) {
} else {
if (status == 0) {
var talk = "What would you like to do? If you have never participate in the Monster Carnival, you will need to know a few things before participating! \r\n#b#L0# Go to the Monster Carnival 1.#l \r\n#L3# Go to the Monster Carnival 2.#l \r\n#L1# Learn about the Monster Carnival.#l\r\n#L2# Trade #t4001129#.#l";
- if (YamlConfig.config.server.USE_ENABLE_CUSTOM_NPC_SCRIPT) {
- talk += "\r\n#L4# ... Can I just refine my ores?#l";
- }
cm.sendSimple(talk);
} else if (status == 1) {
if (selection == 0) {
@@ -268,24 +254,6 @@ function action(mode, type, selection) {
cm.warp(980030000, 0);
cm.dispose();
- } else if (selection == 4) {
- var selStr = "Very well, instead I offer a steadfast #bore refining#k service for you, taxing #r" + ((feeMultiplier * 100) | 0) + "%#k over the usual fee to synthetize them. What will you do?#b";
-
- var options = ["Refine mineral ores", "Refine jewel ores"];
- if (refineCrystals) {
- options.push("Refine crystal ores");
- }
- if (refineRocks) {
- options.push("Refine plates/jewels");
- }
-
- for (var i = 0; i < options.length; i++) {
- selStr += "\r\n#L" + i + "# " + options[i] + "#l";
- }
-
- cm.sendSimple(selStr);
-
- status = 76;
}
} else if (status == 2) {
select = selection;
@@ -439,175 +407,12 @@ function action(mode, type, selection) {
cm.sendNext("Oh, and do not worry about turning into a ghost. In the Monster Carnival, #byou will not lose EXP after death#k. So it's really an experience like no other!");
cm.dispose();
} else if (select == 2) {
- cm.sendNext("#bProtetor#k basically an invoked item that drastically increases the abilities of the monsters invoked by your group. Protector works until it is demolished by the opposing group, so I'm hoping you'll summon several monsters first, and then bring the Protector.");
+ cm.sendNext("#bProtector#k is basically an invoked item that drastically increases the abilities of the monsters invoked by your group. Protector works until it is demolished by the opposing group, so I'm hoping you'll summon several monsters first, and then bring the Protector.");
}
} else if (status == 66) {
cm.sendNext("Lastly, while in the Monster Carnival, #byou can not use items / recovery potions that you carry around with you. #kMeanwhile, the monsters let these items fall for good. when, and when you #bget them, the item will immediately activate#k. That's why it's important to know when to get these items.");
cm.dispose();
- } else if (status == 77) {
- var allDone;
-
- if (selection == 0) {
- allDone = refineItems(0); // minerals
- } else if (selection == 1) {
- allDone = refineItems(1); // jewels
- } else if (selection == 2 && refineCrystals) {
- allDone = refineItems(2); // crystals
- } else if (selection == 2 && !refineCrystals || selection == 3) {
- allDone = refineRockItems(); // moon/star rock
- }
-
- if (allDone) {
- cm.sendOk("Done. Thanks for showing up~.");
- } else {
- cm.sendOk("Done. Be aware some of the items #rcould not be synthetized#k because either you have a lack of space on your ETC inventory or there's not enough mesos to cover the fee.");
- }
- cm.dispose();
- }
- }
- }
-}
-
-function getRefineFee(fee) {
- return ((feeMultiplier * fee) | 0);
-}
-
-function isRefineTarget(refineType, refineItemid) {
- if (refineType == 0) { //mineral refine
- return refineItemid >= 4010000 && refineItemid <= 4010007 && !(refineItemid == 4010007 && !refineSpecials);
- } else if (refineType == 1) { //jewel refine
- return refineItemid >= 4020000 && refineItemid <= 4020008 && !(refineItemid == 4020008 && !refineSpecials);
- } else if (refineType == 2) { //crystal refine
- return refineItemid >= 4004000 && refineItemid <= 4004004 && !(refineItemid == 4004004 && !refineSpecials);
- }
-
- return false;
-}
-
-function getRockRefineTarget(refineItemid) {
- if (refineItemid >= 4011000 && refineItemid <= 4011006) {
- return 0;
- } else if (refineItemid >= 4021000 && refineItemid <= 4021008) {
- return 1;
- }
-
- return -1;
-}
-
-function refineItems(refineType) {
- var allDone = true;
-
- var refineFees = [[300, 300, 300, 500, 500, 500, 800, 270], [500, 500, 500, 500, 500, 500, 500, 1000, 3000], [5000, 5000, 5000, 5000, 1000000]];
- var itemCount = {};
-
- const InventoryType = Java.type('client.inventory.InventoryType');
- var iter = cm.getPlayer().getInventory(InventoryType.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];
-
- const InventoryType = Java.type('client.inventory.InventoryType');
- var iter = cm.getPlayer().getInventory(InventoryType.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;
-}
+}
\ No newline at end of file
diff --git a/scripts/npc/2042002.js b/scripts/npc/2042002.js
index 18ac7309e8d..b092f69f543 100644
--- a/scripts/npc/2042002.js
+++ b/scripts/npc/2042002.js
@@ -3,6 +3,7 @@
1.0 - First Version by Drago (MapleStorySA)
2.0 - Second Version by Ronan (HeavenMS)
3.0 - Third Version by Jayd - translated CPQ contents to English and added Pirate items
+ Special thanks to 頼晏 (ryantpayton) for also stepping in to translate CPQ scripts.
---------------------------------------------------------------------------------------------------
**/
@@ -20,25 +21,13 @@ var cpqMaxLvl = 50;
var cpqMinAmt = 2;
var cpqMaxAmt = 6;
-// Ronan's custom ore refiner NPC
-var refineRocks = true; // enables moon rock, star rock
-var refineCrystals = true; // enables common crystals
-var refineSpecials = true; // enables lithium, special crystals
-var feeMultiplier = 7.0;
-
function start() {
status = -1;
const YamlConfig = Java.type('config.YamlConfig');
if (!YamlConfig.config.server.USE_CPQ) {
- if (YamlConfig.config.server.USE_ENABLE_CUSTOM_NPC_SCRIPT) {
- status = 0;
- action(1, 0, 4);
- } else {
- cm.sendOk("The Monster Carnival is currently unavailable.");
- cm.dispose();
- }
-
+ cm.sendOk("The Monster Carnival is currently unavailable.");
+ cm.dispose();
return;
}
@@ -59,6 +48,7 @@ function action(mode, type, selection) {
status--;
}
+ const YamlConfig = Java.type('config.YamlConfig');
if (cm.getPlayer().getMapId() == 980000010) {
if (status == 0) {
cm.sendNext("I hope you had fun at the Monster Carnival!");
@@ -222,9 +212,9 @@ function action(mode, type, selection) {
}
} else {
var party = cm.getParty().getMembers();
- if ((selection >= 0 && selection <= 3) && party.size() < 1) {
+ if ((selection >= 0 && selection <= 3) && party.size() < (YamlConfig.config.server.USE_ENABLE_SOLO_EXPEDITIONS ? 1 : 2)) {
cm.sendOk("You need at least 2 players to participate in the battle!");
- } else if ((selection >= 4 && selection <= 5) && party.size() < 1) {
+ } else if ((selection >= 4 && selection <= 5) && party.size() < (YamlConfig.config.server.USE_ENABLE_SOLO_EXPEDITIONS ? 1 : 3)) {
cm.sendOk("You need at least 3 players to participate in the battle!");
} else {
cm.cpqLobby(selection);
@@ -237,11 +227,6 @@ function action(mode, type, selection) {
} else {
if (status == 0) {
var talk = "What would you like to do? If you have never participate in the Monster Carnival, you will need to know a few things before participating! \r\n#b#L0# Go to the Monster Carnival 1.#l \r\n#L3# Go to the Monster Carnival 2.#l \r\n#L1# Learn about the Monster Carnival.#l\r\n#L2# Trade #t4001129#.#l";
-
- const YamlConfig = Java.type('config.YamlConfig');
- if (YamlConfig.config.server.USE_ENABLE_CUSTOM_NPC_SCRIPT) {
- talk += "\r\n#L4# ... Can I just refine my ores?#l";
- }
cm.sendSimple(talk);
} else if (status == 1) {
if (selection == 0) {
@@ -269,24 +254,6 @@ function action(mode, type, selection) {
cm.warp(980030000, 0);
cm.dispose();
- } else if (selection == 4) {
- var selStr = "Very well, instead I offer a steadfast #bore refining#k service for you, taxing #r" + ((feeMultiplier * 100) | 0) + "%#k over the usual fee to synthetize them. What will you do?#b";
-
- var options = ["Refine mineral ores", "Refine jewel ores"];
- if (refineCrystals) {
- options.push("Refine crystal ores");
- }
- if (refineRocks) {
- options.push("Refine plates/jewels");
- }
-
- for (var i = 0; i < options.length; i++) {
- selStr += "\r\n#L" + i + "# " + options[i] + "#l";
- }
-
- cm.sendSimple(selStr);
-
- status = 76;
}
} else if (status == 2) {
select = selection;
@@ -310,7 +277,7 @@ function action(mode, type, selection) {
}
} else if (select == 2) {//S2 Warrior 26 S3 Magician 6 S4 Bowman 6 S5 Thief 8
status = 10;
- cm.sendSimple("Please make sure you have #t4001129# for the weapon you want. Select the weapon you would like to trade #t4001129#. The choices I have are really good, and I'm not the one who speaks to the people who say it! \r\n#b#L0# #z1302004# (" + n3 + " coins)#l\r\n#L1# #z1402006# (" + n3 + " coins)#l\r\n#L2# #z1302009# (" + n4 + " coins)#l\r\n#L3# #z1402007# (" + n4 + " coins)#l\r\n#L4# #z1302010# (" + n5 + " coins)#l\r\n#L5# #z1402003# (" + n5 + " coins)#l\r\n#L6# #z1312006# (" + n3 + " coins)#l\r\n#L7# #z1412004# (" + n3 + " coins)#l\r\n#L8# #z1312007# (" + n4 + " coins)#l\r\n#L9# #z1412005# (" + n4 + " coins)#l\r\n#L10# #z1312008# (" + n5 + " coins)#l\r\n#L11# #z1412003# (" + n5 + " coins)#l\r\n#L12# Continue to the next page(1/2)#l");
+ cm.sendSimple("Please make sure you have # t4001129 # for the weapon you want. Select the weapon you would like to trade # t4001129 #. The choices I have are really good, and I'm not the one who speaks to the people who say it! \r\n#b#L0# #z1302004# (" + n3 + " coins)#l\r\n#L1# #z1402006# (" + n3 + " coins)#l\r\n#L2# #z1302009# (" + n4 + " coins)#l\r\n#L3# #z1402007# (" + n4 + " coins)#l\r\n#L4# #z1302010# (" + n5 + " coins)#l\r\n#L5# #z1402003# (" + n5 + " coins)#l\r\n#L6# #z1312006# (" + n3 + " coins)#l\r\n#L7# #z1412004# (" + n3 + " coins)#l\r\n#L8# #z1312007# (" + n4 + " coins)#l\r\n#L9# #z1412005# (" + n4 + " coins)#l\r\n#L10# #z1312008# (" + n5 + " coins)#l\r\n#L11# #z1412003# (" + n5 + " coins)#l\r\n#L12# Continue to the next page (1/2)#l");
} else if (select == 3) {
status = 20;
cm.sendSimple("Select the weapon you would like to trade. The weapons I have here are extremely attractive. See for yourself! \r\n#b#L0# #z1372001# (" + n3 + " coins)#l\r\n#L1# #z1382018# (" + n3 + " coins)#l\r\n#L2# #z1372012# (" + n4 + " coins)#l\r\n#L3# #z1382019# (" + n4 + " coins)#l\r\n#L4# #z1382001# (" + n5 + " coins)#l\r\n#L5# #z1372007# (" + n5 + " coins)#l");
@@ -440,175 +407,12 @@ function action(mode, type, selection) {
cm.sendNext("Oh, and do not worry about turning into a ghost. In the Monster Carnival, #byou will not lose EXP after death#k. So it's really an experience like no other!");
cm.dispose();
} else if (select == 2) {
- cm.sendNext("#bProtetor#k basically an invoked item that drastically increases the abilities of the monsters invoked by your group. Protector works until it is demolished by the opposing group, so I'm hoping you'll summon several monsters first, and then bring the Protector.");
+ cm.sendNext("#bProtector#k is basically an invoked item that drastically increases the abilities of the monsters invoked by your group. Protector works until it is demolished by the opposing group, so I'm hoping you'll summon several monsters first, and then bring the Protector.");
}
} else if (status == 66) {
cm.sendNext("Lastly, while in the Monster Carnival, #byou can not use items / recovery potions that you carry around with you. #kMeanwhile, the monsters let these items fall for good. when, and when you #bget them, the item will immediately activate#k. That's why it's important to know when to get these items.");
cm.dispose();
- } else if (status == 77) {
- var allDone;
-
- if (selection == 0) {
- allDone = refineItems(0); // minerals
- } else if (selection == 1) {
- allDone = refineItems(1); // jewels
- } else if (selection == 2 && refineCrystals) {
- allDone = refineItems(2); // crystals
- } else if (selection == 2 && !refineCrystals || selection == 3) {
- allDone = refineRockItems(); // moon/star rock
- }
-
- if (allDone) {
- cm.sendOk("Done. Thanks for showing up~.");
- } else {
- cm.sendOk("Done. Be aware some of the items #rcould not be synthetized#k because either you have a lack of space on your ETC inventory or there's not enough mesos to cover the fee.");
- }
- cm.dispose();
}
}
}
-}
-
-function getRefineFee(fee) {
- return ((feeMultiplier * fee) | 0);
-}
-
-function isRefineTarget(refineType, refineItemid) {
- if (refineType == 0) { //mineral refine
- return refineItemid >= 4010000 && refineItemid <= 4010007 && !(refineItemid == 4010007 && !refineSpecials);
- } else if (refineType == 1) { //jewel refine
- return refineItemid >= 4020000 && refineItemid <= 4020008 && !(refineItemid == 4020008 && !refineSpecials);
- } else if (refineType == 2) { //crystal refine
- return refineItemid >= 4004000 && refineItemid <= 4004004 && !(refineItemid == 4004004 && !refineSpecials);
- }
-
- return false;
-}
-
-function getRockRefineTarget(refineItemid) {
- if (refineItemid >= 4011000 && refineItemid <= 4011006) {
- return 0;
- } else if (refineItemid >= 4021000 && refineItemid <= 4021008) {
- return 1;
- }
-
- return -1;
-}
-
-function refineItems(refineType) {
- var allDone = true;
-
- var refineFees = [[300, 300, 300, 500, 500, 500, 800, 270], [500, 500, 500, 500, 500, 500, 500, 1000, 3000], [5000, 5000, 5000, 5000, 1000000]];
- var itemCount = {};
-
- const InventoryType = Java.type('client.inventory.InventoryType');
- var iter = cm.getPlayer().getInventory(InventoryType.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];
-
- const InventoryType = Java.type('client.inventory.InventoryType');
- var iter = cm.getPlayer().getInventory(InventoryType.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;
-}
+}
\ No newline at end of file
diff --git a/scripts/npc/2082014.js b/scripts/npc/2082014.js
index c7726f98e51..704ff90e819 100644
--- a/scripts/npc/2082014.js
+++ b/scripts/npc/2082014.js
@@ -40,10 +40,7 @@ function action(mode, type, selection) {
}
if (status == 0) {
- const YamlConfig = Java.type('config.YamlConfig');
- if (YamlConfig.config.server.USE_ENABLE_CUSTOM_NPC_SCRIPT) {
- cm.openShopNPC(2082014);
- } else if (cm.isQuestStarted(3749)) {
+ if (cm.isQuestStarted(3749)) {
cm.sendOk("We've already located the enemy's ultimate weapon! Follow along the ship's bow area ahead and you will find my sister #b#p2082013##k. Report to her for futher instructions on the mission.");
} else {
cm.sendDefault();
diff --git a/scripts/npc/9000017.js b/scripts/npc/9000017.js
index 50bd2545390..d827cf83a14 100644
--- a/scripts/npc/9000017.js
+++ b/scripts/npc/9000017.js
@@ -17,127 +17,9 @@
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see .
*/
-/* Coco
- Refining NPC:
- * Chaos scroll SYNTHETIZER (rofl)
- *
- * @author RonanLana (ronancpl)
-*/
-
-var status = 0;
-var selectedType = -1;
-var selectedItem = -1;
-var item;
-var mats;
-var matQty;
-var cost;
-var qty;
-var equip;
-var last_use; //last item is a use item
+/* Coco */
function start() {
- cm.getPlayer().setCS(true);
- status = -1;
- action(1, 0, 0);
-}
-
-function action(mode, type, selection) {
- if (mode == 1) {
- status++;
- } else {
- cm.sendOk("Oh, ok... Talk back to us when you want to make business.");
- cm.dispose();
- return;
- }
-
- if (status == 0) {
- const YamlConfig = Java.type('config.YamlConfig');
- if (!YamlConfig.config.server.USE_ENABLE_CUSTOM_NPC_SCRIPT) {
- cm.sendOk("Hi, I'm #b#p" + cm.getNpc() + "##k.");
- cm.dispose();
- return;
- }
-
- var selStr = "Hey traveler! Come, come closer... We offer a #bhuge opportunity of business#k to you. If you want to know what it is, keep listening...";
- cm.sendNext(selStr);
- } else if (status == 1) {
- var selStr = "We've got here the knowledge to synthetize the mighty #b#t2049100##k! Of course, making one is not an easy task... But worry not! Just gather some material to me and a fee of #b1,200,000 mesos#k for our services to #bobtain it#k. You still want to do it?";
- cm.sendYesNo(selStr);
- } else if (status == 2) {
- //selectedItem = selection;
- selectedItem = 0;
-
- var itemSet = [2049100, 7777777];
- var matSet = new Array([4031203, 4001356, 4000136, 4000082, 4001126, 4080100, 4000021, 4003005]);
- var matQtySet = new Array([100, 60, 40, 80, 10, 8, 200, 120]);
- var costSet = [1200000, 7777777];
- item = itemSet[selectedItem];
- mats = matSet[selectedItem];
- matQty = matQtySet[selectedItem];
- cost = costSet[selectedItem];
-
- var prompt = "So, you want us to make some #t" + item + "#? In that case, how many do you want us to make?";
- cm.sendGetNumber(prompt, 1, 1, 100)
- } else if (status == 3) {
- qty = (selection > 0) ? selection : (selection < 0 ? -selection : 1);
- last_use = false;
-
- var prompt = "You want us to make ";
- if (qty == 1) {
- prompt += "a #t" + item + "#?";
- } else {
- prompt += qty + " #t" + item + "#?";
- }
-
- prompt += " In that case, we're going to need specific items from you in order to make it. Make sure you have room in your inventory, though!#b";
-
- if (mats instanceof Array) {
- for (var i = 0; i < mats.length; i++) {
- prompt += "\r\n#i" + mats[i] + "# " + matQty[i] * qty + " #t" + mats[i] + "#";
- }
- } else {
- prompt += "\r\n#i" + mats + "# " + matQty * qty + " #t" + mats + "#";
- }
-
- if (cost > 0) {
- prompt += "\r\n#i4031138# " + cost * qty + " meso";
- }
- cm.sendYesNo(prompt);
- } else if (status == 4) {
- var complete = true;
-
- if (cm.getMeso() < cost * qty) {
- cm.sendOk("Come on! We're not here doing you a favor! We all need money to live properly, so bring the cash so we make deal and start the synthesis.");
- } else if (!cm.canHold(item, qty)) {
- cm.sendOk("You didn't check if you got a slot to spare on your inventory before our business, no?");
- } else {
- if (mats instanceof Array) {
- for (var i = 0; complete && i < mats.length; i++) {
- if (matQty[i] * qty == 1) {
- complete = cm.haveItem(mats[i]);
- } else {
- complete = cm.haveItem(mats[i], matQty[i] * qty);
- }
- }
- } else {
- complete = cm.haveItem(mats, matQty * qty);
- }
-
- if (!complete) {
- cm.sendOk("You kidding, right? We won't be able to start the process without all the ingredients at hands. Go get all of them and then talk to us!");
- } else {
- if (mats instanceof Array) {
- for (var i = 0; i < mats.length; i++) {
- cm.gainItem(mats[i], -matQty[i] * qty);
- }
- } else {
- cm.gainItem(mats, -matQty * qty);
- }
- cm.gainMeso(-cost * qty);
- cm.gainItem(item, qty);
- cm.sendOk("Wow... can't believe it worked! To think for a moment that it could f... Ahem. Of course it worked, all work of ours are very efficient! Nice doing business with you.");
- }
- }
- cm.dispose();
- }
+ cm.sendDefault();
+ cm.dispose();
}
\ No newline at end of file
diff --git a/scripts/npc/9000036.js b/scripts/npc/9000036.js
index 575d9a32100..f3cdb58330c 100644
--- a/scripts/npc/9000036.js
+++ b/scripts/npc/9000036.js
@@ -19,208 +19,9 @@
*/
/* NPC: Agent E (9000036)
Victoria Road : Henesys
-
- Refining NPC:
- * Accessories refiner
- *
- * @author Ronan Lana
*/
-var status = -1;
-var selectedType = -1;
-var selectedItem = -1;
-var item;
-var items;
-var mats;
-var matQty;
-var cost;
-var qty = 1;
-var equip;
-var maxEqp = 0;
-
function start() {
- const YamlConfig = Java.type('config.YamlConfig');
- if (!YamlConfig.config.server.USE_ENABLE_CUSTOM_NPC_SCRIPT) {
- cm.sendOk("Hi, I'm #b#p" + cm.getNpc() + "##k.");
- cm.dispose();
- return;
- }
-
- cm.getPlayer().setCS(true);
- var selStr = "Hello, I am the #bAccessory NPC Crafter#k! My works are widely recognized to be too fine, up to the point at which all my items mimic not only the appearance but too the attributes of them! Everything I charge is some 'ingredients' to make them and, of course, a fee for my services. On what kind of equipment are you interessed?#b";
- var options = ["Pendants", "Face accessories", "Eye accessories", "Belts & medals", "Rings"/*,"#t4032496#"*/];
- for (var i = 0; i < options.length; i++) {
- selStr += "\r\n#L" + i + "# " + options[i] + "#l";
- }
- cm.sendSimple(selStr);
-}
-
-function action(mode, type, selection) {
- status++;
- if (mode != 1) {
- cm.dispose();
- return;
- }
- if (status == 0) {
- if (selection == 0) { //pendants
- var selStr = "Well, I've got these pendants on my repertoire:#b";
- items = [1122018, 1122007, 1122001, 1122003, 1122004, 1122006, 1122002, 1122005, 1122058];
- for (var i = 0; i < items.length; i++) {
- selStr += "\r\n#L" + i + "##t" + items[i] + "##b";
- }
- } else if (selection == 1) { //face accessory
- var selStr = "Hmm, face accessories? There you go: #b";
- items = [1012181, 1012182, 1012183, 1012184, 1012185, 1012186, 1012108, 1012109, 1012110, 1012111];
- for (var i = 0; i < items.length; i++) {
- selStr += "\r\n#L" + i + "##t" + items[i] + "##b";
- }
- } else if (selection == 2) { //eye accessory
- var selStr = "Got hard sight? Okay, so which glasses do you want me to make?#b";
- items = [1022073, 1022088, 1022103, 1022089, 1022082];
- for (var i = 0; i < items.length; i++) {
- selStr += "\r\n#L" + i + "##t" + items[i] + "##b";
- }
- } else if (selection == 3) { //belt & medal
- var selStr = "Hmm... For these, things get a little tricky. Since these items are too short and too similar one another, I don't really know what item will emerge when I finish the synthesis. Still wanna try for something?";
- items = [];
- maxEqp = 0;
-
- for (var x = 1132005; x < 1132017; maxEqp++, x++) {
- items[maxEqp] = x;
- }
-
- for (var x = 1142000; x < 1142102; maxEqp++, x++) {
- items[maxEqp] = x;
- }
-
- for (var x = 1142107; x < 1142121; maxEqp++, x++) {
- items[maxEqp] = x;
- }
-
- for (var x = 1142122; x < 1142143; maxEqp++, x++) {
- items[maxEqp] = x;
- }
- selStr += "\r\n#L" + i + "##bTry it!#b";
-
- } else if (selection == 4) { //ring refine
- var selStr = "Rings, huh? These are my specialty, go check it yourself!#b";
- items = [1112407, 1112408, 1112401, 1112413, 1112414, 1112405, 1112402];
-
- for (var i = 0; i < items.length; i++) {
- selStr += "\r\n#L" + i + "##t" + items[i] + "##b";
- }
-
- }/*else if (selection == 5) { //make necklace
- var selStr = "Need to make #t4032496#?#b";
- items = [4032496];
- for (var i = 0; i < items.length; i++)
- selStr += "\r\n#L" + i + "##t" + items[i] + "##l";
- }*/
- selectedType = selection;
- cm.sendSimple(selStr);
- } else if (status == 1) {
- if (selectedType != 3) {
- selectedItem = selection;
- }
-
- if (selectedType == 0) { //pendant refine
- var matSet = [[4003004, 4030012, 4001356, 4000026], [4000026, 4001356, 4000073, 4001006], [4001343, 4011002, 4003004, 4003005], [4001343, 4011006, 4003004, 4003005], [4000091, 4011005, 4003004, 4003005], [4000091, 4011001, 4003004, 4003005], [4000469, 4011000, 4003004, 4003005], [4000469, 4011004, 4003004, 4003005], [1122007, 4003002, 4000413]];
- var matQtySet = [[20, 20, 5, 1], [5, 5, 10, 1], [10, 2, 20, 4], [10, 1, 20, 4], [15, 3, 30, 6], [15, 3, 30, 6], [20, 5, 20, 8], [20, 4, 40, 8], [1, 1, 1]];
- var costSet = [150000, 500000, 200000, 200000, 300000, 300000, 400000, 400000, 2500000];
- } else if (selectedType == 1) { //face accessory refine
- var matSet = [[4006000, 4003004], [4006000, 4003004, 4000026], [4006000, 4003004, 4000026, 4000082, 4003002], [4006000, 4003005], [4006000, 4003005, 4000026], [4006000, 4003005, 4000026, 4000082, 4003002], [4001006, 4011008], [4001006, 4011008], [4001006, 4011008], [4001006, 4011008]];
- var matQtySet = [[5, 5], [5, 5, 5], [5, 5, 5, 5, 1], [5, 5], [5, 5, 5], [5, 5, 5, 5, 1], [1, 1], [1, 1], [1, 1], [1, 1]];
- var costSet = [100000, 200000, 300000, 125000, 250000, 375000, 500000, 500000, 500000, 500000, 25000, 25000, 25000, 25000];
- } else if (selectedType == 2) { //eye accessory refine
- var matSet = [[4001006, 4003002, 4000082, 4031203], [4001005, 4011008], [4001005, 4011008], [4001005, 4011008, 4000082], [4001006, 4003002, 4003000, 4003001]];
- var matQtySet = [[2, 2, 5, 10], [3, 2], [4, 3], [5, 3, 10], [2, 2, 10, 5]];
- var costSet = [250000, 250000, 300000, 400000, 200000];
- } else if (selectedType == 3) { //belt & medals refine
- var matSet = [[4001006, 4003005, 4003004], [7777, 7777]];
- var matQtySet = [[2, 5, 10], [7777, 7777]];
- var costSet = [15000, 7777];
- } else if (selectedType == 4) { //ring refine
- var matSet = [[4003001, 4001344, 4006000], [4003001, 4001344, 4006000], [4021004, 4011008], [4011008, 4001006], [1112413, 2022039], [1112414, 4000176], [4011007, 4021009]];
- var matQtySet = [[2, 2, 2], [2, 2, 2], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1]];
- var costSet = [10000, 10000, 10000, 20000, 15000, 15000, 10000];
- }/*else if (selectedType == 5) { //necklace refine
- var matSet = [[4011007, 4011008, 4021009]];
- var matQtySet = [[1, 1, 1]];
- var costSet = [10000];
- }*/
-
- if (selectedType == 3) {
- selectedItem = Math.floor(Math.random() * maxEqp);
- item = items[selectedItem];
- mats = matSet[0];
- matQty = matQtySet[0];
- cost = costSet[0];
- } else {
- item = items[selectedItem];
- mats = matSet[selectedItem];
- matQty = matQtySet[selectedItem];
- cost = costSet[selectedItem];
- }
-
- var prompt = "You want me to make ";
- if (selectedType != 3) {
- if (qty == 1) {
- prompt += "a #b#t" + item + "##k?";
- } else {
- prompt += "#b" + qty + " #t" + item + "##k?";
- }
- } else {
- prompt += "a #bbelt#k or a #bmedal#k?";
- }
-
- prompt += " Right! I will need some items to make that item. Make sure you have a #bfree slot#k in your inventory!#b";
- if (mats instanceof Array) {
- for (var i = 0; i < mats.length; i++) {
- prompt += "\r\n#i" + mats[i] + "# " + (matQty[i] * qty) + " #t" + mats[i] + "#";
- }
- } else {
- prompt += "\r\n#i" + mats + "# " + (matQty * qty) + " #t" + mats + "#";
- }
- if (cost > 0) {
- prompt += "\r\n#i4031138# " + (cost * qty) + " meso";
- }
- cm.sendYesNo(prompt);
- } else if (status == 2) {
- if (cm.getMeso() < (cost * qty)) {
- cm.sendOk("This is the fee I charge to make my items! No credit.");
- } else {
- var complete = true;
- if (mats instanceof Array) {
- for (var i = 0; complete && i < mats.length; i++) {
- if (!cm.haveItem(mats[i], matQty[i] * qty)) {
- complete = false;
- }
- }
- } else if (!cm.haveItem(mats, matQty * qty)) {
- complete = false;
- }
-
- if (!complete) {
- cm.sendOk("Are you sure you got all the items required? Double check it!");
- } else {
- if (cm.canHold(item, qty)) {
- if (mats instanceof Array) {
- for (var i = 0; i < mats.length; i++) {
- cm.gainItem(mats[i], -(matQty[i] * qty));
- }
- } else {
- cm.gainItem(mats, -(matQty * qty));
- }
- cm.gainMeso(-(cost * qty));
-
- cm.gainItem(item, qty);
- cm.sendOk("The item is done! Take and try this piece of art yourself.");
- } else {
- cm.sendOk("You got no free slot on your inventory.");
- }
- }
- }
-
- cm.dispose();
- }
+ cm.sendDefault();
+ cm.dispose();
}
diff --git a/scripts/npc/9000040.js b/scripts/npc/9000040.js
index 7e84360c858..cde33ef0231 100644
--- a/scripts/npc/9000040.js
+++ b/scripts/npc/9000040.js
@@ -19,72 +19,9 @@
*/
/* Dalair
Medal NPC.
-
- NPC Equipment Merger:
- * @author Ronan Lana
*/
-var status;
-var mergeFee = 50000;
-var name;
-
function start() {
- status = -1;
- action(1, 0, 0);
-}
-
-function action(mode, type, selection) {
- if (mode == -1) {
- cm.dispose();
- } else {
- if (mode == 0 && type > 0) {
- cm.dispose();
- return;
- }
- if (mode == 1) {
- status++;
- } else {
- status--;
- }
-
- if (status == 0) {
- const YamlConfig = Java.type('config.YamlConfig');
- if (!YamlConfig.config.server.USE_ENABLE_CUSTOM_NPC_SCRIPT) {
- cm.sendOk("The medal ranking system is currently unavailable...");
- cm.dispose();
- return;
- }
-
- var levelLimit = !cm.getPlayer().isCygnus() ? 160 : 110;
- var selStr = "The medal ranking system is currently unavailable... Therefore, I am providing the #bEquipment Merge#k service! ";
-
- const MakerProcessor = Java.type('client.processor.action.MakerProcessor');
- if (!YamlConfig.config.server.USE_STARTER_MERGE && (cm.getPlayer().getLevel() < levelLimit || MakerProcessor.getMakerSkillLevel(cm.getPlayer()) < 3)) {
- selStr += "However, you must have #rMaker level 3#k and at least #rlevel 110#k (Cygnus Knight), #rlevel 160#k (other classes) and a fund of #r" + cm.numberWithCommas(mergeFee) + " mesos#k to use the service.";
- cm.sendOk(selStr);
- cm.dispose();
- } else if (cm.getMeso() < mergeFee) {
- selStr += "I'm sorry, but this service tax is of #r" + cm.numberWithCommas(mergeFee) + " mesos#k, which it seems you unfortunately don't have right now... Please, stop by again later.";
- cm.sendOk(selStr);
- cm.dispose();
- } else {
- selStr += "For the fee of #r" + cm.numberWithCommas(mergeFee) + "#k mesos, merge unnecessary equipments in your inventory into your currently equipped gears to get stat boosts into them, statups based on the attributes of the items used on the merge!";
- cm.sendNext(selStr);
- }
- } else if (status == 1) {
- selStr = "#rWARNING#b: Make sure you have your items ready to merge at the slots #rAFTER#b the item you have selected to merge.#k Any items #bunder#k the item selected will be merged thoroughly.\r\n\r\nNote that equipments receiving bonuses from merge are going to become #rUntradeable#k thereon, and equipments that already received the merge bonus #rcannot be used for merge#k.\r\n\r\n";
- cm.sendGetText(selStr);
- } else if (status == 2) {
- name = cm.getText();
-
- if (cm.getPlayer().mergeAllItemsFromName(name)) {
- cm.gainMeso(-mergeFee);
- cm.sendOk("Merging complete! Thanks for using the service and enjoy your new equipment stats.");
- } else {
- cm.sendOk("There is no #b'" + name + "'#k in your #bEQUIP#k inventory!");
- }
-
- cm.dispose();
- }
- }
+ cm.sendOk("The medal ranking system is currently unavailable...");
+ cm.dispose();
}
diff --git a/scripts/npc/9000041.js b/scripts/npc/9000041.js
index 3b90cf41bc1..7f12d46ff7f 100644
--- a/scripts/npc/9000041.js
+++ b/scripts/npc/9000041.js
@@ -19,54 +19,9 @@
*/
/* NPC: Donation Box (9000041)
Victoria Road : Henesys
-
- NPC Bazaar:
- * @author Ronan Lana
*/
-var options = ["EQUIP", "USE", "SET-UP", "ETC"];
-var name;
-var status;
-var selectedType = 0;
-
function start() {
- status = -1;
- action(1, 0, 0);
+ cm.sendOk("The medal ranking system is currently unavailable...");
+ cm.dispose();
}
-
-function action(mode, type, selection) {
- status++;
- if (mode != 1) {
- cm.dispose();
- return;
- }
-
- if (status == 0) {
- const YamlConfig = Java.type('config.YamlConfig');
- if (!YamlConfig.config.server.USE_ENABLE_CUSTOM_NPC_SCRIPT) {
- cm.sendOk("The medal ranking system is currently unavailable...");
- cm.dispose();
- return;
- }
-
- var selStr = "Hello, I am the #bBazaar NPC#k! Sell to me any item on your inventory you don't need. #rWARNING#b: Make sure you have your items ready to sell at the slots #rAFTER#b the item you have selected to sell.#k Any items #bunder#k the item selected will be sold thoroughly.";
- for (var i = 0; i < options.length; i++) {
- selStr += "\r\n#L" + i + "# " + options[i] + "#l";
- }
- cm.sendSimple(selStr);
- } else if (status == 1) {
- selectedType = selection;
- cm.sendGetText("From what item on your #r" + options[selectedType] + "#k inventory do you want to start the transaction?");
- } else if (status == 2) {
- name = cm.getText();
- var res = cm.getPlayer().sellAllItemsFromName(selectedType + 1, name);
-
- if (res > -1) {
- cm.sendOk("Transaction complete! You received #r" + cm.numberWithCommas(res) + " mesos#k from this action.");
- } else {
- cm.sendOk("There is no #b'" + name + "'#k in your #b" + options[selectedType] + "#k inventory!");
- }
-
- cm.dispose();
- }
-}
\ No newline at end of file
diff --git a/scripts/npc/9201101.js b/scripts/npc/9201101.js
index d792fc5bd24..32eee0a2233 100644
--- a/scripts/npc/9201101.js
+++ b/scripts/npc/9201101.js
@@ -4,13 +4,6 @@
*/
function start() {
- const YamlConfig = Java.type('config.YamlConfig');
- if (YamlConfig.config.server.USE_ENABLE_CUSTOM_NPC_SCRIPT) {
- cm.openShopNPC(9201101);
- } else {
- //cm.sendOk("The patrol in New Leaf City is always ready. No creatures are able to break through to the city.");
- cm.sendDefault();
- }
-
+ cm.sendDefault();
cm.dispose();
}
diff --git a/scripts/npc/mapleTV.js b/scripts/npc/mapleTV.js
index d0cd016385e..c0b3836883e 100644
--- a/scripts/npc/mapleTV.js
+++ b/scripts/npc/mapleTV.js
@@ -21,37 +21,6 @@
Default Maple TV
*/
-var status;
-
function start() {
- const YamlConfig = Java.type('config.YamlConfig');
- if (YamlConfig.config.server.USE_ENABLE_CUSTOM_NPC_SCRIPT) {
- cm.dispose();
- cm.openNpc(9201088, "scroll_generator");
- return;
- }
-
- status = -1;
- action(1, 0, 0);
-}
-
-function action(mode, type, selection) {
- if (mode == -1) {
- cm.dispose();
- } else {
- if (mode == 0 && type > 0) {
- cm.dispose();
- return;
- }
- if (mode == 1) {
- status++;
- } else {
- status--;
- }
-
- if (status == 0) {
- // do nothing
- cm.dispose();
- }
- }
+ cm.dispose();
}
\ No newline at end of file
diff --git a/scripts/npc/scroll_generator.js b/scripts/npc/scroll_generator.js
deleted file mode 100644
index 91acf32a0a3..00000000000
--- a/scripts/npc/scroll_generator.js
+++ /dev/null
@@ -1,452 +0,0 @@
-/*
- This file is part of the HeavenMS MapleStory Server
- Copyleft (L) 2016 - 2019 RonanLana
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU Affero General Public License as
- published by the Free Software Foundation version 3 as published by
- the Free Software Foundation. You may not use, modify or distribute
- this program under any other version of the GNU Affero General Public
- License.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU Affero General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License
- along with this program. If not, see .
-*/
-/* NPC: MapleTV / Larry
-
- Exchanger NPC:
- * Scroll generator
- *
- * @author Ronan Lana
-*/
-
-var status;
-
-var jobWeaponRestricted = [[[2043000, 2043100, 2044000, 2044100, 2043200, 2044200]], [[2043000, 2043100, 2044000, 2044100], [2043000, 2043200, 2044000, 2044200], [2044300, 2044400]], [[2043700, 2043800], [2043700, 2043800], [2043700, 2043800]], [[2044500], [2044600]], [[2044700], [2043300]], [[2044800], [2044900]]];
-var aranWeaponRestricted = [jobWeaponRestricted[1][2][1]];
-
-var tier1Scrolls = [];
-var tier2Scrolls = [2040000, 2040400, 2040500, 2040600, 2040700, 2040800, 2040900];
-var tier3Scrolls = [2048000, 2049200, 2041000, 2041100, 2041300, 2040100, 2040200, 2040300];
-
-var typeTierScrolls = [["PAD", "MAD"], ["STR", "DEX", "INT", "LUK", "ACC", "EVA", "Speed", "Jump"], ["PDD", "MDD", "MHP", "MMP"]];
-
-var sgItems = [4003004, 4003005, 4001006, 4006000, 4006001, 4030012];
-var sgToBucket = [100, 50, 37.5, 37.5, 37.5, 200];
-var mesoToBucket = 2800000;
-
-var sgAppliedItems = [0, 0, 0, 0, 0, 0];
-var sgAppliedMeso = 0;
-
-var sgBuckets = 0.0;
-var sgBookBuckets = 0.0;
-var sgItemBuckets = 0.0;
-
-function start() {
- status = -1;
- action(1, 0, 0);
-}
-
-function action(mode, type, selection) {
- if (mode == -1) {
- cm.dispose();
- } else {
- if (mode == 0 && type > 0) {
- cm.dispose();
- return;
- }
- if (mode == 1) {
- status++;
- } else {
- status--;
- }
-
- if (status == 0) {
- cm.sendNext("This is the MapleTV Scroll Generator broadcast. Place your supplies or mesos earned throughout your adventure to redeem a prize! You can place #bany amount of supplies#k, however take note that placing #rdifferent supplies#k with #rbigger shots of any of them#k will improve the reward possibilities!");
- } else if (status == 1) {
- var sendStr;
-
- //print("Book: " + sgBookBuckets + " Item: " + sgItemBuckets);
-
- if (sgItemBuckets > 0.0) {
- sendStr = "With the items you have currently placed, you have #r" + sgBuckets + "#k buckets (#r" + (sgItemBuckets < 1.0 ? sgItemBuckets.toFixed(2) : Math.floor(sgItemBuckets)) + "#k supply buckets) for claiming a prize. Place supplies:";
- } else {
- sendStr = "You have placed no supplies yet. Place supplies:";
- }
-
- var listStr = "";
- var i;
- for (i = 0; i < sgItems.length; i++) {
- listStr += "#b#L" + i + "##t" + sgItems[i] + "##k";
- if (sgAppliedItems[i] > 0) {
- listStr += " - " + sgAppliedItems[i];
- }
- listStr += "#l\r\n";
- }
-
- listStr += "#b#L" + i + "#Mesos#k";
- if (sgAppliedMeso > 0) {
- listStr += " - " + sgAppliedMeso;
- }
- listStr += "#l\r\n";
-
- cm.sendSimple(sendStr + "\r\n\r\n" + listStr + "#r#L" + (sgItems.length + 2) + "#Retrieve a prize!#l#k\r\n");
- } else if (status == 2) {
- if (selection == (sgItems.length + 2)) {
- if (sgItemBuckets < 1.0) {
- cm.sendPrev("You have set not enough supplies. Insert at least one bucket of #bsupplies#k to claim a prize.");
- } else {
- generateRandomScroll();
- cm.dispose();
- }
- } else {
- var tickSel;
- if (selection < sgItems.length) {
- tickSel = "of #b#t" + sgItems[selection] + "##k";
- curItemQty = cm.getItemQuantity(sgItems[selection]);
- } else {
- tickSel = "#bmesos#k";
- curItemQty = cm.getMeso();
- }
-
- curItemSel = selection;
- if (curItemQty > 0) {
- cm.sendGetText("How many " + tickSel + " do you want to provide? (#r" + curItemQty + "#k available)#k");
- } else {
- cm.sendPrev("You have got #rnone#k " + tickSel + " to provide for Scroll Generation. Click '#rBack#k' to return to the main interface.");
- }
- }
- } else if (status == 3) {
- var text = cm.getText();
-
- try {
- var placedQty = parseInt(text);
- if (isNaN(placedQty) || placedQty < 0) {
- throw true;
- }
-
- if (placedQty > curItemQty) {
- cm.sendPrev("You cannot insert the given amount of #r" + (curItemSel < sgItems.length ? "#t" + sgItems[curItemSel] + "#" : "mesos") + "#k (#r" + curItemQty + "#k available). Click '#rBack#k' to return to the main interface.");
- } else {
- if (curItemSel < sgItems.length) {
- sgApplyItem(curItemSel, placedQty);
- } else {
- sgApplyMeso(placedQty);
- }
-
- cm.sendPrev("Operation succeeded. Click '#rBack#k' to return to the main interface.");
- }
- } catch (err) {
- cm.sendPrev("You must enter a positive number of supplies to insert. Click '#rBack#k' to return to the main interface.");
- }
-
- status = 2;
- } else {
- cm.dispose();
- }
- }
-}
-
-function getJobTierScrolls() {
- var scrolls = [];
-
- var job = cm.getPlayer().getJob();
- var jobScrolls = jobWeaponRestricted[Math.floor(cm.getPlayer().getJobStyle().getId() / 100)];
-
- const GameConstants = Java.type('constants.game.GameConstants');
- var jobBranch = GameConstants.getJobBranch(job);
- if (jobBranch >= 2) {
- Array.prototype.push.apply(scrolls, jobScrolls[Math.floor((job.getId() / 10) % 10) - 1]);
- } else {
- for (var i = 0; i < jobScrolls.length; i++) {
- Array.prototype.push.apply(scrolls, jobScrolls[i]);
- }
- }
-
- return scrolls;
-}
-
-function getScrollTypePool(rewardTier) {
- var scrolls = [];
- switch (rewardTier) {
- case 1:
- if (cm.getPlayer().isAran()) {
- Array.prototype.push.apply(scrolls, aranWeaponRestricted);
- } else {
- Array.prototype.push.apply(scrolls, getJobTierScrolls());
- }
-
- Array.prototype.push.apply(scrolls, tier1Scrolls);
- break;
- case 2:
- Array.prototype.push.apply(scrolls, tier2Scrolls);
- break;
- default:
- Array.prototype.push.apply(scrolls, tier3Scrolls);
- }
-
- return scrolls;
-}
-
-function getScrollTier(scrollStats) {
- for (var i = 0; i < typeTierScrolls.length; i++) {
- for (var j = 0; j < typeTierScrolls[i].length; j++) {
- if (scrollStats.get(typeTierScrolls[i][j]) > 0) {
- return i + 1;
- }
- }
- }
-
- return 4;
-}
-
-function getScrollSuccessTier(scrollStats) {
- var prop = scrollStats.get("success");
-
- const YamlConfig = Java.type('config.YamlConfig');
- if (prop > 90) {
- return 3;
- } else if (prop < 50) {
- return YamlConfig.config.server.SCROLL_CHANCE_ROLLS > 2 ? 2 : 1;
- } else {
- return YamlConfig.config.server.SCROLL_CHANCE_ROLLS > 2 ? 1 : 2;
- }
-}
-
-function getAvailableScrollsPool(baseScrolls, rewardTier, successTier) {
- var scrolls = [];
- const ItemInformationProvider = Java.type('server.ItemInformationProvider');
- var ii = ItemInformationProvider.getInstance();
-
- for (var i = 0; i < baseScrolls.length; i++) {
- for (var j = 0; j < 100; j++) {
- var scrollid = baseScrolls[i] + j;
- var scrollStats = ii.getEquipStats(scrollid);
- if (scrollStats != null && ii.getScrollReqs(scrollid).isEmpty()) {
- var scrollTier = getScrollTier(scrollStats);
- if (scrollTier == rewardTier && successTier == getScrollSuccessTier(scrollStats)) {
- scrolls.push(scrollid);
- }
- }
- }
- }
-
- return scrolls;
-}
-
-// passive tier buckets...
-
-function getLevelTier(level) {
- return Math.floor((level - 1) / 15) + 1;
-}
-
-function getPlayerCardTierPower() {
- var cardset = cm.getPlayer().getMonsterBook().getCardSet();
- var countTier = [0, 0, 0, 0, 0, 0, 0, 0, 0];
-
- for (var iterator = cardset.iterator(); iterator.hasNext();) {
- var ce = iterator.next();
-
- var cardid = ce.getKey();
- var ceTier = Math.floor(cardid / 1000) % 10;
- countTier[ceTier] += ce.getValue();
-
- if (ceTier >= 8) { // is special card
- const LifeFactory = Java.type('server.life.LifeFactory');
- const ItemInformationProvider = Java.type('server.ItemInformationProvider');
- var mobLevel = LifeFactory.getMonsterLevel(ItemInformationProvider.getInstance().getCardMobId(cardid));
- var mobTier = getLevelTier(mobLevel) - 1;
-
- countTier[mobTier] += (ce.getValue() * 1.2);
- }
- }
-
- return countTier;
-}
-
-function calculateMobBookTierBuckets(tierSize, playerCards, tier) {
- if (tier < 1) {
- return 0.0;
- }
-
- tier--; // started at 1
- var tierHitRate = playerCards[tier] / (tierSize[tier] * 5);
- if (tierHitRate > 0.5) {
- tierHitRate = 0.5;
- }
-
- return tierHitRate * 4;
-}
-
-function calculateMobBookBuckets() {
- var book = cm.getPlayer().getMonsterBook();
- var bookLevelMult = 0.9 + (0.1 * book.getBookLevel());
-
- var playerLevelTier = getLevelTier(cm.getPlayer().getLevel());
- if (playerLevelTier > 8) {
- playerLevelTier = 8;
- }
-
- const MonsterBook = Java.type('client.MonsterBook');
- var tierSize = MonsterBook.getCardTierSize();
- var playerCards = getPlayerCardTierPower();
-
- var prevBuckets = calculateMobBookTierBuckets(tierSize, playerCards, playerLevelTier - 1);
- var currBuckets = calculateMobBookTierBuckets(tierSize, playerCards, playerLevelTier);
-
- return (prevBuckets + currBuckets) * bookLevelMult;
-}
-
-function recalcBuckets() {
- sgBookBuckets = calculateMobBookBuckets();
- sgItemBuckets = calculateSuppliesBuckets();
-
- var buckets = sgBookBuckets + sgItemBuckets;
- if (buckets > 6.0) {
- sgBuckets = 6;
- } else {
- sgBuckets = Math.floor(buckets);
- }
-}
-
-// variable buckets...
-
-function sgApplyItem(idx, amount) {
- if (sgAppliedItems[idx] != amount) {
- sgAppliedItems[idx] = amount;
- recalcBuckets();
- }
-}
-
-function sgApplyMeso(amount) {
- if (sgAppliedMeso != amount) {
- sgAppliedMeso = amount;
- recalcBuckets();
- }
-}
-
-function calculateSuppliesBuckets() {
- var suppliesHitRate = 0.0;
- for (var i = 0; i < sgItems.length; i++) {
- suppliesHitRate += sgAppliedItems[i] / sgToBucket[i];
- }
- suppliesHitRate *= 2;
-
- suppliesHitRate += (sgAppliedMeso / mesoToBucket);
- return suppliesHitRate;
-}
-
-function calculateScrollTiers() {
- var buckets = sgBuckets;
- var tiers = [0, 0, 0];
- while (buckets > 0) {
- var pool = [];
- for (var i = 0; i < tiers.length; i++) {
- if (tiers[i] < 2) {
- pool.push(i);
- }
- }
-
- var rnd = pool[Math.floor(Math.random() * pool.length)];
-
- tiers[rnd]++;
- buckets--;
- }
-
- // normalize tiers
- for (var i = 0; i < tiers.length; i++) {
- tiers[i] = 3 - tiers[i];
- }
-
- return tiers;
-}
-
-function getRandomScrollFromTiers(tiers) {
- var typeTier = tiers[0], subtypeTier = tiers[1], successTier = tiers[2];
- var scrollTypePool = getScrollTypePool(typeTier);
- var scrollPool = getAvailableScrollsPool(scrollTypePool, subtypeTier, successTier);
-
- if (scrollPool.length > 0) {
- return scrollPool[Math.floor(Math.random() * scrollPool.length)];
- } else {
- return -1;
- }
-}
-
-function getRandomScrollFromRightPermutations(tiers) {
- for (var i = 2; i >= 0; i--) {
- for (var j = i - 1; j >= 0; j--) {
- if (tiers[i] >= 3) {
- break;
- } else if (tiers[j] > 1) {
- tiers[i]++;
- tiers[j]--;
-
- var itemid = getRandomScrollFromTiers(tiers);
- if (itemid != -1) {
- return itemid;
- }
- }
- }
- }
-
- return -1;
-}
-
-function getRandomScroll(tiers) {
- var itemid = getRandomScrollFromTiers(tiers);
- if (itemid == -1) {
- // worst case shift-right permutations...
- itemid = getRandomScrollFromRightPermutations(tiers);
- }
-
- return itemid;
-}
-
-function performExchange(sgItemid, sgCount) {
- if (cm.getMeso() < sgAppliedMeso) {
- return false;
- }
-
- for (var i = 0; i < sgItems.length; i++) {
- var itemid = sgItems[i];
- var count = sgAppliedItems[i];
- if (count > 0 && !cm.haveItem(itemid, count)) {
- return false;
- }
- }
-
- cm.gainMeso(-sgAppliedMeso);
-
- for (var i = 0; i < sgItems.length; i++) {
- var itemid = sgItems[i];
- var count = sgAppliedItems[i];
- cm.gainItem(itemid, -count);
- }
-
- cm.gainItem(sgItemid, sgCount);
- return true;
-}
-
-function generateRandomScroll() {
- const InventoryType = Java.type('client.inventory.InventoryType');
- if (cm.getPlayer().getInventory(InventoryType.USE).getNumFreeSlot() >= 1) {
- var itemid = getRandomScroll(calculateScrollTiers());
- if (itemid != -1) {
- if (performExchange(itemid, 1)) {
- cm.sendNext("Transaction accepted! You have received a #r#t" + itemid + "##k.");
- } else {
- cm.sendOk("Oh, it looks like some items are missing... Please double-check provided items in your inventory before trying to exchange.");
- }
- } else {
- cm.sendOk("Sorry for the inconvenience, but it seems there are no scrolls on store right now... Try again later.");
- }
- } else {
- cm.sendOk("Please look out for a slot available on your USE inventory before trying for a scroll.");
- }
-}
diff --git a/src/main/java/client/Character.java b/src/main/java/client/Character.java
index 9a83c22f46c..f4923b01a3f 100644
--- a/src/main/java/client/Character.java
+++ b/src/main/java/client/Character.java
@@ -25,7 +25,6 @@
import client.autoban.AutobanManager;
import client.creator.CharacterFactoryRecipe;
import client.inventory.Equip;
-import client.inventory.Equip.StatUpgrade;
import client.inventory.Inventory;
import client.inventory.InventoryProof;
import client.inventory.InventoryType;
@@ -9192,245 +9191,6 @@ private int gainSlotsInternal(int type, int slots) {
}
}
- public int sellAllItemsFromName(byte invTypeId, String name) {
- //player decides from which inventory items should be sold.
- InventoryType type = InventoryType.getByType(invTypeId);
-
- Inventory inv = getInventory(type);
- inv.lockInventory();
- try {
- Item it = inv.findByName(name);
- if (it == null) {
- return (-1);
- }
-
- ItemInformationProvider ii = ItemInformationProvider.getInstance();
- return (sellAllItemsFromPosition(ii, type, it.getPosition()));
- } finally {
- inv.unlockInventory();
- }
- }
-
- public int sellAllItemsFromPosition(ItemInformationProvider ii, InventoryType type, short pos) {
- int mesoGain = 0;
-
- Inventory inv = getInventory(type);
- inv.lockInventory();
- try {
- for (short i = pos; i <= inv.getSlotLimit(); i++) {
- if (inv.getItem(i) == null) {
- continue;
- }
- mesoGain += standaloneSell(getClient(), ii, type, i, inv.getItem(i).getQuantity());
- }
- } finally {
- inv.unlockInventory();
- }
-
- return (mesoGain);
- }
-
- private int standaloneSell(Client c, ItemInformationProvider ii, InventoryType type, short slot, short quantity) {
- if (quantity == 0xFFFF || quantity == 0) {
- quantity = 1;
- }
-
- Inventory inv = getInventory(type);
- inv.lockInventory();
- try {
- Item item = inv.getItem(slot);
- if (item == null) { //Basic check
- return (0);
- }
-
- int itemid = item.getItemId();
- if (ItemConstants.isRechargeable(itemid)) {
- quantity = item.getQuantity();
- } else if (ItemId.isWeddingToken(itemid) || ItemId.isWeddingRing(itemid)) {
- return (0);
- }
-
- if (quantity < 0) {
- return (0);
- }
- short iQuant = item.getQuantity();
- if (iQuant == 0xFFFF) {
- iQuant = 1;
- }
-
- if (quantity <= iQuant && iQuant > 0) {
- InventoryManipulator.removeFromSlot(c, type, (byte) slot, quantity, false);
- int recvMesos = ii.getPrice(itemid, quantity);
- if (recvMesos > 0) {
- gainMeso(recvMesos, false);
- return (recvMesos);
- }
- }
-
- return (0);
- } finally {
- inv.unlockInventory();
- }
- }
-
- private static boolean hasMergeFlag(Item item) {
- return (item.getFlag() & ItemConstants.MERGE_UNTRADEABLE) == ItemConstants.MERGE_UNTRADEABLE;
- }
-
- private static void setMergeFlag(Item item) {
- short flag = item.getFlag();
- flag |= ItemConstants.MERGE_UNTRADEABLE;
- flag |= ItemConstants.UNTRADEABLE;
- item.setFlag(flag);
- }
-
- private List getUpgradeableEquipped() {
- List list = new LinkedList<>();
-
- ItemInformationProvider ii = ItemInformationProvider.getInstance();
- for (Item item : getInventory(InventoryType.EQUIPPED)) {
- if (ii.isUpgradeable(item.getItemId())) {
- list.add((Equip) item);
- }
- }
-
- return list;
- }
-
- private static List getEquipsWithStat(List>> equipped, StatUpgrade stat) {
- List equippedWithStat = new LinkedList<>();
-
- for (Pair> eq : equipped) {
- if (eq.getRight().containsKey(stat)) {
- equippedWithStat.add(eq.getLeft());
- }
- }
-
- return equippedWithStat;
- }
-
- public boolean mergeAllItemsFromName(String name) {
- InventoryType type = InventoryType.EQUIP;
-
- Inventory inv = getInventory(type);
- inv.lockInventory();
- try {
- Item it = inv.findByName(name);
- if (it == null) {
- return false;
- }
-
- Map statups = new LinkedHashMap<>();
- mergeAllItemsFromPosition(statups, it.getPosition());
-
- List>> upgradeableEquipped = new LinkedList<>();
- Map>> equipUpgrades = new LinkedHashMap<>();
- for (Equip eq : getUpgradeableEquipped()) {
- upgradeableEquipped.add(new Pair<>(eq, eq.getStats()));
- equipUpgrades.put(eq, new LinkedList>());
- }
-
- /*
- for (Entry es : statups.entrySet()) {
- System.out.println(es);
- }
- */
-
- for (Entry e : statups.entrySet()) {
- Double ev = Math.sqrt(e.getValue());
-
- Set extraEquipped = new LinkedHashSet<>(equipUpgrades.keySet());
- List statEquipped = getEquipsWithStat(upgradeableEquipped, e.getKey());
- float extraRate = (float) (0.2 * Math.random());
-
- if (!statEquipped.isEmpty()) {
- float statRate = 1.0f - extraRate;
-
- int statup = (int) Math.ceil((ev * statRate) / statEquipped.size());
- for (Equip statEq : statEquipped) {
- equipUpgrades.get(statEq).add(new Pair<>(e.getKey(), statup));
- extraEquipped.remove(statEq);
- }
- }
-
- if (!extraEquipped.isEmpty()) {
- int statup = (int) Math.round((ev * extraRate) / extraEquipped.size());
- if (statup > 0) {
- for (Equip extraEq : extraEquipped) {
- equipUpgrades.get(extraEq).add(new Pair<>(e.getKey(), statup));
- }
- }
- }
- }
-
- dropMessage(6, "EQUIPMENT MERGE operation results:");
- for (Entry>> eqpUpg : equipUpgrades.entrySet()) {
- List> eqpStatups = eqpUpg.getValue();
- if (!eqpStatups.isEmpty()) {
- Equip eqp = eqpUpg.getKey();
- setMergeFlag(eqp);
-
- String showStr = " '" + ItemInformationProvider.getInstance().getName(eqp.getItemId()) + "': ";
- String upgdStr = eqp.gainStats(eqpStatups).getLeft();
-
- this.forceUpdateItem(eqp);
-
- showStr += upgdStr;
- dropMessage(6, showStr);
- }
- }
-
- return true;
- } finally {
- inv.unlockInventory();
- }
- }
-
- public void mergeAllItemsFromPosition(Map statups, short pos) {
- Inventory inv = getInventory(InventoryType.EQUIP);
- inv.lockInventory();
- try {
- for (short i = pos; i <= inv.getSlotLimit(); i++) {
- standaloneMerge(statups, getClient(), InventoryType.EQUIP, i, inv.getItem(i));
- }
- } finally {
- inv.unlockInventory();
- }
- }
-
- private void standaloneMerge(Map statups, Client c, InventoryType type, short slot, Item item) {
- short quantity;
- ItemInformationProvider ii = ItemInformationProvider.getInstance();
- if (item == null || (quantity = item.getQuantity()) < 1 || ii.isCash(item.getItemId()) || !ii.isUpgradeable(item.getItemId()) || hasMergeFlag(item)) {
- return;
- }
-
- Equip e = (Equip) item;
- for (Entry s : e.getStats().entrySet()) {
- Float newVal = statups.get(s.getKey());
-
- float incVal = s.getValue().floatValue();
- switch (s.getKey()) {
- case incPAD:
- case incMAD:
- case incPDD:
- case incMDD:
- incVal = (float) Math.log(incVal);
- break;
- }
-
- if (newVal != null) {
- newVal += incVal;
- } else {
- newVal = incVal;
- }
-
- statups.put(s.getKey(), newVal);
- }
-
- InventoryManipulator.removeFromSlot(c, type, (byte) slot, quantity, false);
- }
-
public void setShop(Shop shop) {
this.shop = shop;
}
diff --git a/src/main/java/config/ServerConfig.java b/src/main/java/config/ServerConfig.java
index fff7bca8daf..036dae258d7 100644
--- a/src/main/java/config/ServerConfig.java
+++ b/src/main/java/config/ServerConfig.java
@@ -131,10 +131,6 @@ public class ServerConfig {
public boolean USE_MAKER_PERMISSIVE_ATKUP;
public boolean USE_MAKER_FEE_HEURISTICS;
- //Custom Configuration
- public boolean USE_ENABLE_CUSTOM_NPC_SCRIPT;
- public boolean USE_STARTER_MERGE;
-
//Commands Configuration
public boolean BLOCK_GENERATE_CASH_ITEM;
public boolean USE_WHOLE_SERVER_RANKING;