[Release] Fixed Fredrick in ThePack II
Code:
/*Fredrick NPC (9030000)
*By Moogra (Fixed by Ronald)
*/
importPackage(net.sf.odinms.server);
var status;
var choice;
function start() {
status = -1;
action(1, 0, 0);
}
function action(mode, type, selection) {
if (mode == 1)
status++;
else {
cm.dispose();
return;
}
if (status == 0)
cm.sendNext("Hi, I'm the store banker.");
else if (status == 1)
cm.sendSimple("Would you like to withdraw\r\n#b#L0#Mesos#l #L1#Items#l");
else if (status == 2) {
cm.sendNext("Let me check if you have any....");
choice = selection;
} else {
if (choice == 0) {
if (status == 3) {
var mesoEarnt = cm.getHiredMerchantMesos();
if (mesoEarnt > 0)
cm.sendYesNo("You have made "+mesoEarnt+" mesos in your store so far. Would you like to withdraw them?");
else {
cm.sendNext("You have not made any mesos");
cm.dispose();
}
} else if (status == 4) {
cm.sendNext("Thank you for using my services, your mesos has been recieved");
cm.gainMeso(cm.getHiredMerchantMesos());
cm.setHiredMerchantMesos(0);
cm.dispose();
}
} else {
if (status == 3) {
var items = cm.getHiredMerchantItems();
if (items.size() > 0) {
var text = "Please select an item\r\n";
for (var i = 0; i < items.size(); i++)
text += "#L"+i+"##i"+items.get(i).getRight().getItemId()+"##l ";
cm.sendSimple(text);
} else {
cm.sendNext("You do not have any items from your store");
cm.dispose();
}
} else if (status == 4) {
var items = cm.getHiredMerchantItems();
if (cm.getC() == null)
cm.getPlayer().dropMessage("Received");
MapleInventoryManipulator.addFromDrop(cm.getC(), items.get(selection).getRight());
cm.sendNext("Thank you for using my services, your item has been recieved");
cm.removeHiredMerchantItem(items.get(selection).getLeft());
cm.dispose();
}
}
}
}
Just replace your script with that.
Credits to Moogra for ThePack II and the Script
Me for fixing it up.
Re: [Release] Fixed Fredrick in ThePack II
Also, if there are scripts in the Pack II that aren't working you can tell me.
Re: [Release] Fixed Fredrick in ThePack II
Re: [Release] Fixed Fredrick in ThePack II
Quote:
Originally Posted by
ridekink08
What does this fix?
In The Pack II, Fredrick gives you the mesos, that you earn from your Hired Merchant, and the items.
It didn't work for some reason, so I fixed.
Re: [Release] Fixed Fredrick in ThePack II
Is their anyway like say if the server restarts. Will the items be retrievable?
Re: [Release] Fixed Fredrick in ThePack II
Quote:
Originally Posted by
ridekink08
Is their anyway like say if the server restarts. Will the items be retrievable?
I haven't restarted my server. So I do not know yet. I'm pretty sure since there's a table for Hired Merchants, the items and mesos will be stored and once you get back on, you can restore your mesos and items.
Re: [Release] Fixed Fredrick in ThePack II
Maybe this fixed that. Is their anyway you can see. Because I know that was sorta a problem with my hired merchants on my server.
Re: [Release] Fixed Fredrick in ThePack II
Quote:
Originally Posted by
ridekink08
Maybe this fixed that. Is their anyway you can see. Because I know that was sorta a problem with my hired merchants on my server.
Uhm, on my next restart for my server, I'll try, okay?
Re: [Release] Fixed Fredrick in ThePack II
Thanks. Would appreciate feedback.
Re: [Release] Fixed Fredrick in ThePack II
Tried it on my dev server, didn't work.
Opened a store, put in some items.
Logged out properly
Restarted server
Logged back on and noticed store was gone (duh)
Opened Fredrick and clicked on items.
No items available, FUUUU-
Anyway, it probably needs some more fixage. ;)
Re: [Release] Fixed Fredrick in ThePack II
Did you shut down the server correctly?
Re: [Release] Fixed Fredrick in ThePack II
Quote:
Originally Posted by
DJMitch
Tried it on my dev server, didn't work.
Opened a store, put in some items.
Logged out properly
Restarted server
Logged back on and noticed store was gone (duh)
Opened Fredrick and clicked on items.
No items available, FUUUU-
Anyway, it probably needs some more fixage. ;)
Lmao, you dummy, my post at first was just my theory.
Re: [Release] Fixed Fredrick in ThePack II
/*Fredrick NPC (9030000)
*By Moogra (Fixed by Ronald)
*/
LOL *AHEM*
Re: [Release] Fixed Fredrick in ThePack II
Quote:
Originally Posted by
MrMysterious
/*Fredrick NPC (9030000)
*By Moogra (Fixed by Ronald)
*/
LOL *AHEM*
What about it? It didn't work when Moogra made it. And I am Ronald?
Re: [Release] Fixed Fredrick in ThePack II
If you wanna keep the items you will have to make a table in the DB.