Script references patch

Cleared issue in a few scripts which would be trying to access Java Math library methods with unexpected parameter types.
Fixed EllinPQ rewarder NPC handing out an unexpected itemid to the player.
Cleared SQL foreign key constraint statement no longer supposed to be used.
This commit is contained in:
ronancpl
2019-10-30 23:31:15 -03:00
parent 7d8d4691da
commit d9f87f18a1
31 changed files with 39 additions and 34 deletions

View File

@@ -217,7 +217,7 @@ function action(mode, type, selection) {
complete = false;
}
if(java.lang.Math.random() >= 0.9) //A lucky find! Scroll 60%
if(Math.random() >= 0.9) //A lucky find! Scroll 60%
item += 1;
if (!complete || !cm.canHold(item, 1))
@@ -251,7 +251,7 @@ function action(mode, type, selection) {
var reward;
if (rewdSet[selectedItem] instanceof Array) {
var length = rewdSet[selectedItem][1] - rewdSet[selectedItem][0];
reward = rewdSet[selectedItem][0] + java.lang.Math.round(java.lang.Math.random() * length);
reward = rewdSet[selectedItem][0] + Math.round(Math.random() * length);
}
else reward = rewdSet[selectedItem];

View File

@@ -13,13 +13,14 @@ function action(mode, type, selection) {
return;
}
if (status == 0) {
cm.sendSimple("My name is Pergen, I am the strongest magician around these parts.#b\r\n#L0#Hey, take these rubbles. You can perform your magic on them.#l");
cm.sendSimple("My name is #p2131001#, I am the strongest magician around these parts.#b\r\n#L0#Hey, take these rubbles. You can perform your magic on them.#l");
} else if (status == 1) {
if (!cm.haveItem(exchangeItem, 100)) {
cm.sendNext("You don't have enough... I need at least 100.");
cm.dispose();
} else {
cm.sendGetNumber("Hey, that's a good idea! I can give you #i4310000#Perfect Pitch for each 100 #i" + exchangeItem + "##t" + exchangeItem + "# you give me. How many do you want? (Current Items: " + cm.itemQuantity(exchangeItem) + ")", java.lang.Math.min(300, cm.itemQuantity(exchangeItem) / 100), 1, java.lang.Math.min(300, cm.itemQuantity(exchangeItem) / 100));
// thanks yuxaij for noticing a few methods having parameters not matching the expected Math library function parameter types
cm.sendGetNumber("Hey, that's a good idea! I can give you #i4310000#Perfect Pitch for each 100 #i" + exchangeItem + "##t" + exchangeItem + "# you give me. How many do you want? (Current Items: " + cm.itemQuantity(exchangeItem) + ")", Math.min(300, cm.itemQuantity(exchangeItem) / 100), 1, Math.min(300, cm.itemQuantity(exchangeItem) / 100));
}
} else if (status == 2) {
if (selection >= 1 && selection <= cm.itemQuantity(exchangeItem) / 100) {

View File

@@ -5,6 +5,6 @@
*/
function start(){
cm.sendOk("My name is Euryth... As you can see, I am a fairy. People tell me I do not act fairy-like, but... I like making things out of metal objects. Shhh, don't tell this to anyone, but I also like MMA.");
cm.sendOk("My name is #p2131002#... As you can see, I am a fairy. People tell me I do not act fairy-like, but... I like making things out of metal objects. Shhh, don't tell this to anyone, but I also like MMA.");
cm.dispose();
}

View File

@@ -19,7 +19,7 @@ function action(mode, type, selection) {
cm.sendNext("You don't have enough... I need at least 100.");
cm.dispose();
} else {
cm.sendGetNumber("Hey, that's a good idea! I can give you #i4310000#Perfect Pitch for each 100 #i" + exchangeItem + "##t" + exchangeItem + "# you give me. How many do you want? (Current Items: " + cm.itemQuantity(exchangeItem) + ")", java.lang.Math.min(300, cm.itemQuantity(exchangeItem) / 100), 1, java.lang.Math.min(300, cm.itemQuantity(exchangeItem) / 100));
cm.sendGetNumber("Hey, that's a good idea! I can give you #i4310000#Perfect Pitch for each 100 #i" + exchangeItem + "##t" + exchangeItem + "# you give me. How many do you want? (Current Items: " + cm.itemQuantity(exchangeItem) + ")", Math.min(300, cm.itemQuantity(exchangeItem) / 100), 1, Math.min(300, cm.itemQuantity(exchangeItem) / 100));
}
} else if (status == 2) {
if (selection >= 1 && selection <= cm.itemQuantity(exchangeItem) / 100) {

View File

@@ -19,7 +19,7 @@ function action(mode, type, selection) {
cm.sendNext("You don't have enough... I need at least 100.");
cm.dispose();
} else {
cm.sendGetNumber("Hey, that's a good idea! I can give you #i4310000#Perfect Pitch for each 100 #i" + exchangeItem + "##t" + exchangeItem + "# you give me. How many do you want? (Current Items: " + cm.itemQuantity(exchangeItem) + ")", java.lang.Math.min(300, cm.itemQuantity(exchangeItem) / 100), 1, java.lang.Math.min(300, cm.itemQuantity(exchangeItem) / 100));
cm.sendGetNumber("Hey, that's a good idea! I can give you #i4310000#Perfect Pitch for each 100 #i" + exchangeItem + "##t" + exchangeItem + "# you give me. How many do you want? (Current Items: " + cm.itemQuantity(exchangeItem) + ")", Math.min(300, cm.itemQuantity(exchangeItem) / 100), 1, Math.min(300, cm.itemQuantity(exchangeItem) / 100));
}
} else if (status == 2) {
if (selection >= 1 && selection <= cm.itemQuantity(exchangeItem) / 100) {

View File

@@ -19,7 +19,7 @@ function action(mode, type, selection) {
cm.sendNext("You don't have enough... I need at least 100.");
cm.dispose();
} else {
cm.sendGetNumber("Hey, that's a good idea! I can give you #i4310000#Perfect Pitch for each 100 #i" + exchangeItem + "##t" + exchangeItem + "# you give me. How many do you want? (Current Items: " + cm.itemQuantity(exchangeItem) + ")", java.lang.Math.min(300, cm.itemQuantity(exchangeItem) / 100), 1, java.lang.Math.min(300, cm.itemQuantity(exchangeItem) / 100));
cm.sendGetNumber("Hey, that's a good idea! I can give you #i4310000#Perfect Pitch for each 100 #i" + exchangeItem + "##t" + exchangeItem + "# you give me. How many do you want? (Current Items: " + cm.itemQuantity(exchangeItem) + ")", Math.min(300, cm.itemQuantity(exchangeItem) / 100), 1, Math.min(300, cm.itemQuantity(exchangeItem) / 100));
}
} else if (status == 2) {
if (selection >= 1 && selection <= cm.itemQuantity(exchangeItem) / 100) {

View File

@@ -19,7 +19,7 @@ function action(mode, type, selection) {
cm.sendNext("You don't have enough... I need at least 100.");
cm.dispose();
} else {
cm.sendGetNumber("Hey, that's a good idea! I can give you #i4310000#Perfect Pitch for each 100 #i" + exchangeItem + "##t" + exchangeItem + "# you give me. How many do you want? (Current Items: " + cm.itemQuantity(exchangeItem) + ")", java.lang.Math.min(300, cm.itemQuantity(exchangeItem) / 100), 1, java.lang.Math.min(300, cm.itemQuantity(exchangeItem) / 100));
cm.sendGetNumber("Hey, that's a good idea! I can give you #i4310000#Perfect Pitch for each 100 #i" + exchangeItem + "##t" + exchangeItem + "# you give me. How many do you want? (Current Items: " + cm.itemQuantity(exchangeItem) + ")", Math.min(300, cm.itemQuantity(exchangeItem) / 100), 1, Math.min(300, cm.itemQuantity(exchangeItem) / 100));
}
} else if (status == 2) {
if (selection >= 1 && selection <= cm.itemQuantity(exchangeItem) / 100) {

View File

@@ -111,9 +111,9 @@ function action(mode, type, selection) {
cm.dispose();
}
} else if (selection == 2){
if (cm.haveItem(1032061) && !cm.haveItem(1032101) && cm.haveItem(4001198, 10)) {
if (cm.haveItem(1032061) && !cm.haveItem(1032072) && cm.haveItem(4001198, 10)) {
cm.gainItem(1032061,-1);
cm.gainItem(1032101, 1);
cm.gainItem(1032072, 1); // thanks yuxaij for noticing unexpected itemid here
cm.gainItem(4001198, -10);
cm.dispose();
} else {

View File

@@ -127,7 +127,7 @@ function action(mode, type, selection) {
cm.dispose();
return;
}
var rand = java.lang.Math.floor(java.lang.Math.random() * pri.length);
var rand = Math.floor(Math.random() * pri.length);
if (!cm.haveItem(ite, quan)) {
cm.sendOk("You need #b" + quan + " #t" + ite + "##k to exchange it with item.");
} else if (cm.getInventory(1).getNextFreeSlot() <= -1 || cm.getInventory(2).getNextFreeSlot() <= -1 || cm.getInventory(3).getNextFreeSlot() <= -1 || cm.getInventory(4).getNextFreeSlot() <= -1) {

View File

@@ -35,11 +35,11 @@ function action(mode, type, selection) {
cm.mapMessage(6, "Engarde! Master Guardians approach!");
for (var i = 0; i < 10; i++) {
var mob = eim.getMonster(9400594);
cm.getMap().spawnMonsterOnGroundBelow(mob, new java.awt.Point(-1337 + (java.lang.Math.random() * 1337), 276));
cm.getMap().spawnMonsterOnGroundBelow(mob, new java.awt.Point(-1337 + (Math.random() * 1337), 276));
}
for (var i = 0; i < 20; i++) {
var mob = eim.getMonster(9400582);
cm.getMap().spawnMonsterOnGroundBelow(mob, new java.awt.Point(-1337 + (java.lang.Math.random() * 1337), 276));
cm.getMap().spawnMonsterOnGroundBelow(mob, new java.awt.Point(-1337 + (Math.random() * 1337), 276));
}
eim.setIntProperty("glpq6", 1);
cm.dispose();

View File

@@ -1,5 +1,5 @@
function enter(pi) {
if (java.lang.Math.random() < 0.1) {
if (Math.random() < 0.1) {
pi.playPortalSound(); pi.warp(930000300,"16st");
} else {
pi.playPortalSound(); pi.warp(930000300, "02st");

View File

@@ -1,5 +1,5 @@
function enter(pi) {
if (java.lang.Math.random() < 0.1) {
if (Math.random() < 0.1) {
pi.playPortalSound(); pi.warp(930000300,"16st");
} else {
pi.playPortalSound(); pi.warp(930000300, "03st");

View File

@@ -1,5 +1,5 @@
function enter(pi) {
if (java.lang.Math.random() < 0.1) {
if (Math.random() < 0.1) {
pi.playPortalSound(); pi.warp(930000300,"16st");
} else {
pi.playPortalSound(); pi.warp(930000300, "04st");

View File

@@ -1,5 +1,5 @@
function enter(pi) {
if (java.lang.Math.random() < 0.1) {
if (Math.random() < 0.1) {
pi.playPortalSound(); pi.warp(930000300,"16st");
} else {
pi.playPortalSound(); pi.warp(930000300, "05st");

View File

@@ -1,5 +1,5 @@
function enter(pi) {
if (java.lang.Math.random() < 0.1) {
if (Math.random() < 0.1) {
pi.playPortalSound(); pi.warp(930000300,"16st");
} else {
pi.playPortalSound(); pi.warp(930000300, "06st");

View File

@@ -1,5 +1,5 @@
function enter(pi) {
if (java.lang.Math.random() < 0.1) {
if (Math.random() < 0.1) {
pi.playPortalSound(); pi.warp(930000300,"16st");
} else {
pi.playPortalSound(); pi.warp(930000300, "07st");

View File

@@ -1,5 +1,5 @@
function enter(pi) {
if (java.lang.Math.random() < 0.1) {
if (Math.random() < 0.1) {
pi.playPortalSound(); pi.warp(930000300,"16st");
} else {
pi.playPortalSound(); pi.warp(930000300, "08st");

View File

@@ -1,5 +1,5 @@
function enter(pi) {
if (java.lang.Math.random() < 0.1) {
if (Math.random() < 0.1) {
pi.playPortalSound(); pi.warp(930000300,"16st");
} else {
pi.playPortalSound(); pi.warp(930000300, "09st");

View File

@@ -1,5 +1,5 @@
function enter(pi) {
if (java.lang.Math.random() < 0.1) {
if (Math.random() < 0.1) {
pi.playPortalSound(); pi.warp(930000300,"16st");
} else {
pi.playPortalSound(); pi.warp(930000300, "10st");

View File

@@ -1,5 +1,5 @@
function enter(pi) {
if (java.lang.Math.random() < 0.1) {
if (Math.random() < 0.1) {
pi.playPortalSound(); pi.warp(930000300,"16st");
} else {
pi.playPortalSound(); pi.warp(930000300, "11st");

View File

@@ -1,5 +1,5 @@
function enter(pi) {
if (java.lang.Math.random() < 0.1) {
if (Math.random() < 0.1) {
pi.playPortalSound(); pi.warp(930000300,"16st");
} else {
pi.playPortalSound(); pi.warp(930000300, "12st");

View File

@@ -1,5 +1,5 @@
function enter(pi) {
if (java.lang.Math.random() < 0.1) {
if (Math.random() < 0.1) {
pi.playPortalSound(); pi.warp(930000300,"16st");
} else {
pi.playPortalSound(); pi.warp(930000300, "13st");

View File

@@ -1,5 +1,5 @@
function enter(pi) {
if (java.lang.Math.random() < 0.1) {
if (Math.random() < 0.1) {
pi.playPortalSound(); pi.warp(930000300,"16st");
} else {
pi.playPortalSound(); pi.warp(930000300, "14st");

View File

@@ -1,5 +1,5 @@
function enter(pi) {
if (java.lang.Math.random() < 0.1) {
if (Math.random() < 0.1) {
pi.playPortalSound(); pi.warp(930000300,"16st");
} else {
pi.playPortalSound(); pi.warp(930000300, "15st");

View File

@@ -1,5 +1,5 @@
function enter(pi) {
if (java.lang.Math.random() < 0.1) {
if (Math.random() < 0.1) {
pi.playPortalSound(); pi.warp(930000300,"16st");
} else {
pi.playPortalSound(); pi.warp(930000300, "01st");