// TMW-2 Script
// Author:
// Jesusalva
// Description:
// Contraband of counterfeit goods.
015-3-3,45,66,0 script Blanc#Contraband NPC_NO_SPRITE,{
// Store not available
if (!.active)
end;
// STORY MODE
setpcblock(PCBLOCK_HARD, true);
mesc l("STORY MODE ENABLED. Monsters won't attack you, so you can read without worries."), 1;
next;
clear;
showavatar NPC_BLANC;
mesn;
mesq l("Hey pal, I am preparing a trip for The Mana World: Classic, which is beyond the mirror lake. Care to sell me contrabanded stuff?");
mesc l("Blanc can purchase account bound items, and exchange named items by non-named items.");
next;
.@id=requestitemindex();
if (.@id < 1) goto L_Close;
// Collect the item ID and meta data
delinventorylist();
getinventorylist();
.@x=@inventorylist_id[.@id];
.@c1=@inventorylist_card1[.@id];
//.@r=@inventorylist_refine[.@id]; // TODO: Not restore-able without getitem2()
.@gid=getcharid(2);
if (.@gid)
.@admin=(getguildrole(.@gid, getcharid(3)) == GPOS_GUILDMASTER);
else
.@admin=false;
// No duplicates
if (countitem(.@x) > 1) {
mesn;
mesq l("You are carrying duplicates of the same item. Sorry, but I have no idea which one you mean."), 1;
goto L_Close;
}
// Skip equipped items
if (isequipped(.@x)) {
mesn;
mesq l("You should unequip this item first."), 1;
goto L_Close;
}
// Trade restriction from the database
if (getiteminfo(.@x, ITEMINFO_TRADE) & ITR_NOSELLTONPC) {
mesn;
mesq l("Ehm, I count as a NPC, so... you can't contraband items which cannot be sold to NPCs, pal!"), 1;
goto L_Close;
}
mesn;
mesq l("A(n) %s, hm? And what do you want me to do with it?", getitemlink(.@x));
.@price = getiteminfo(.@x, ITEMINFO_SELLPRICE);
select
l("Nothing. Sorry bothering."),
rif(checkbound(.@x, 1), l("I would like to sell it for %s GP.", fnum(.@price*2/3))),
rif(checkbound(.@x, 2) && .@admin, l("I would like to sell it for %s GP.", fnum(.@price*1/3))),
rif(.@c1 >= 252, l("I would like to swap, I offer you %s GP.", fnum(.@price))),
rif(!checkbound(.@x) && !.@c1, l("I would like to sell it for %s GP.", fnum(.@price*11/10)));
switch (@menu) {
case 2:
mesn;
mesq l("Are you sure?");
if (askyesno() == ASK_NO) break;
// Sell account bound items
delitem .@x, 1;
Zeny += .@price * 2 / 3;
mesn;
mesq l("Pleasure doing business with you.");
break;
case 3:
// Sell guild bound items
if (!.@admin) { atcommand("@ban 2d "+strcharinfo(0)); end; } // Anti-Cheat
delitem .@x, 1;
Zeny += .@price * 1 / 3;
mesn;
mesq l("Pleasure doing business with you.");
break;
case 4:
// Remove item name
if (Zeny < .@price) {
mesn;
mesq l("Try to fool another, you broken peniless piece of %s meat!", get_race());
mesc l("%s stabs you, wounding you fatally!", .name$);
die();
goto L_Close;
}
.@o0i = getitemoptionidbyindex(.@id, 0);
.@o0v = getitemoptionvaluebyindex(.@id, 0);
.@o1i = getitemoptionidbyindex(.@id, 1);
.@o1v = getitemoptionvaluebyindex(.@id, 1);
.@o2i = getitemoptionidbyindex(.@id, 2);
.@o2v = getitemoptionvaluebyindex(.@id, 2);
.@o3i = getitemoptionidbyindex(.@id, 3);
.@o3v = getitemoptionvaluebyindex(.@id, 3);
.@o4i = getitemoptionidbyindex(.@id, 4);
.@o4v = getitemoptionvaluebyindex(.@id, 4);
Zeny -= .@price;
delitem .@x, 1;
CsysNpcCraft(.@x, .@o0i, .@o0v, .@o1i, .@o1v,
.@o2i, .@o2v, .@o3i, .@o3v, .@o4i, .@o4v);
// Refine by .@r
//for (.@i=0;.@i<.@r;.@i++) {
//}
mesn;
mesq l("Eh, sure, you can have this %s. It is not refined but should do the trick. Maybe. NO REFUNDS!", getitemlink(.@x));
break;
case 5:
// Regular item sale
delitem .@x, 1;
Zeny += .@price * 11 / 10;
mesn;
mesq l("Pleasure doing business with you.");
break;
}
goto L_Close;
L_Close:
next;
closeclientdialog;
setpcblock(PCBLOCK_HARD, false);
close;
// Load
OnMinute21:
OnMinute46:
setnpcdisplay .name$, NPC_BLANC;
.active=1;
end;
// Unload
OnMinute23:
OnMinute48:
setnpcdisplay .name$, NPC_NO_SPRITE;
.active=0;
end;
OnInit:
.active=0;
.sex = G_OTHER;
.distance = 3;
/*
if (debug) {
setnpcdisplay .name$, NPC_BLANC;
.active=1;
}
*/
end;
}