// Moubootaur Legends Script // Author: // Jesusalva // Description: // General Shop (ML Consumables) 033-5,39,26,0 script Resourceful Seller NPC_PLAYER,{ mesn; mesq l("Hey, I can sell you any consumable which can be sold, as long that you know its name! Try to be [@@=createitems|specific@@], as I'll only show the few first results!"); next; mes l("What item are you looking for?"); input(.@name$); .@qty = searchitem(.@matches[0], .@name$); if (.@qty < 1) { mes l("I don't know any item by that name."); } .@menu$ = "Nothing"; mes l("I found some items:"); for (.@i = 0; .@i < .@qty; ++.@i) { // Check if this item is consumable if (getiteminfo(.@matches[.@i], ITEMINFO_TYPE) != IT_HEALING && getiteminfo(.@matches[.@i], ITEMINFO_TYPE) != IT_USABLE && getiteminfo(.@matches[.@i], ITEMINFO_TYPE) != IT_AMMO) { .@matches[.@i] = 0; continue; } // Check if this item can be acquired if (getiteminfo(.@matches[.@i], ITEMINFO_BUYPRICE) < 1 || getiteminfo(.@matches[.@i], ITEMINFO_TRADE) > 0) { .@matches[.@i] = 0; continue; } //Display name (eg: "Apple[0]") mes l("%s [%d] for %s GP", getitemlink(.@matches[.@i]), .@matches[.@i], fnum(getiteminfo(.@matches[.@i], ITEMINFO_BUYPRICE))); } for (.@i = 0; .@i < .@qty; ++.@i) { .@menu$ += ":"; if (.@matches[.@i] > 0) .@menu$ += getitemname(.@matches[.@i]); } next; mesn; mesq l("So, what do you want to buy?"); next; select(.@menu$); .@idx = @menu - 2; if (.@idx < 0) close; .@it = .@matches[.@idx]; .@price = getiteminfo(.@it, ITEMINFO_BUYPRICE); .@max = Zeny / .@price; if (.@max < 1) { mesn; mesc l("You cannot afford that."), 1; close; } mesn; mesq l("%s, I see! How many? (0-%s)", getitemlink(.@it), fnum(.@max)); input(.@cur, 0, .@max); if (.@cur > 0 && .@cur <= .@max) { Zeny -= .@cur * .@price; getitem(.@it, .@cur); } mes ""; mesn; mesq l("Pleasure doing business with you!"); close; OnInit: .@npcId = getnpcid(.name$); setunitdata(.@npcId, UDT_HEADTOP, NPCEyes); setunitdata(.@npcId, UDT_HEADMIDDLE, SilkRobe); //setunitdata(.@npcId, UDT_HEADBOTTOM, LeatherTrousers); // FIXME: LeatherTrousers are BROKEN! setunitdata(.@npcId, UDT_HAIRSTYLE, 26); setunitdata(.@npcId, UDT_HAIRCOLOR, 2); end; }