summaryrefslogtreecommitdiff
path: root/npc
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2023-06-25 23:13:31 -0300
committerJesusaves <cpntb1@ymail.com>2023-06-25 23:13:31 -0300
commit4c842f5ea967fd96a9eb93bd06b1973ecb85f967 (patch)
tree0b1de69c2b2bcf96013b39624bb70d3336c0eb6d /npc
parent392f8ce15649456eb500ba4f4186b5a70bb29e47 (diff)
downloadserverdata-4c842f5ea967fd96a9eb93bd06b1973ecb85f967.tar.gz
serverdata-4c842f5ea967fd96a9eb93bd06b1973ecb85f967.tar.bz2
serverdata-4c842f5ea967fd96a9eb93bd06b1973ecb85f967.tar.xz
serverdata-4c842f5ea967fd96a9eb93bd06b1973ecb85f967.zip
Add a general store so players can acquire consumables like arrows and stuff
Diffstat (limited to 'npc')
-rw-r--r--npc/033-5/_import.txt1
-rw-r--r--npc/033-5/shop.txt82
2 files changed, 83 insertions, 0 deletions
diff --git a/npc/033-5/_import.txt b/npc/033-5/_import.txt
index be6102d..d6b8ba2 100644
--- a/npc/033-5/_import.txt
+++ b/npc/033-5/_import.txt
@@ -1,3 +1,4 @@
// Map 033-5: Porthos' General Store
// This file is generated automatically. All manually added changes will be removed when running the Converter.
"npc/033-5/_warps.txt",
+"npc/033-5/shop.txt",
diff --git a/npc/033-5/shop.txt b/npc/033-5/shop.txt
new file mode 100644
index 0000000..edcc72d
--- /dev/null
+++ b/npc/033-5/shop.txt
@@ -0,0 +1,82 @@
+// 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;
+}
+
+