summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2021-12-08 00:05:02 -0300
committerJesusaves <cpntb1@ymail.com>2021-12-08 00:05:02 -0300
commitb082e14d7b7f0496151877afe87e11c4965d8425 (patch)
tree0953e3337c81863062448c114de2609d76fc2855
parentca014dd3aed4d9854fe8cd836be7982a534d2ebe (diff)
downloadserverdata-b082e14d7b7f0496151877afe87e11c4965d8425.tar.gz
serverdata-b082e14d7b7f0496151877afe87e11c4965d8425.tar.bz2
serverdata-b082e14d7b7f0496151877afe87e11c4965d8425.tar.xz
serverdata-b082e14d7b7f0496151877afe87e11c4965d8425.zip
Haphazardly fill Santa's shop. Lock all shops until quest is completed.
-rw-r--r--npc/080-1/final.txt3
-rw-r--r--npc/081-1/dungeon.txt49
2 files changed, 50 insertions, 2 deletions
diff --git a/npc/080-1/final.txt b/npc/080-1/final.txt
index de96701a..a318f6f6 100644
--- a/npc/080-1/final.txt
+++ b/npc/080-1/final.txt
@@ -137,9 +137,8 @@ OnCountFunds:
setcurrency(countitem(XmasTicket));
end;
-/* @price is total cost. @points is if we accept two items as currency. */
OnPayFunds:
- //dispbottom "Hi: price="+@price+" and points="+@points;
+ if (!X21ED2_CLEAR()) end;
if( countitem(XmasTicket) < @price )
end;
/* Verify if you're not purchasing a dupe */
diff --git a/npc/081-1/dungeon.txt b/npc/081-1/dungeon.txt
index db76c51b..ea15a80d 100644
--- a/npc/081-1/dungeon.txt
+++ b/npc/081-1/dungeon.txt
@@ -158,6 +158,55 @@ OnInit:
OnInit:
.distance=5;
+ setarray .prizes, ElfNightcap, TopHat, ShroomHat, FunkyHat,
+ SnowmanSnowGlobe, ChristmasTreeHat, BunnyEars,
+ SantaBeardHat, MushHat, LeatherGoggles, SantaSnowGlobe,
+ MoubooHead, Goggles, Sunglasses, ChristmasElfHat, FaceMask;
+ setarray .prices, 300, 400, 500, 600,
+ 625, 650, 700,
+ 800, 825, 850, 875,
+ 1000, 1100, 1200, 1500, 1600;
+ tradertype(NST_CUSTOM);
+ freeloop(true);
+ for (.@i = 0; .@i < getarraysize(.prizes); .@i++) {
+ sellitem(.prizes[.@i], .prices[.@i]);
+ }
+ freeloop(false);
end;
+OnCountFunds:
+ setcurrency(countitem(XmasTicket));
+ end;
+
+OnPayFunds:
+ if (!X21ED2_CLEAR()) end;
+ if( countitem(XmasTicket) < @price )
+ end;
+ /* Verify if you're not purchasing a dupe */
+ /* This requires servercode@712c09c2c6d848243c3426aeb3dbdf730c1e0b08 to work */
+ for (.@i=0;.@i < getarraysize(@bought_nameid); .@i++) {
+ if (debug || $@XMAS21_OVERRIDE)
+ debugmes("%dx %s", @bought_quantity[.@i], getitemname(@bought_nameid[.@i]));
+
+ .@arr = array_find(.prizes, @bought_nameid[.@i]);
+ if (.@arr < 0) { dispbottom "REPORT ME: Array Error (Santa)"; end;}
+ .@bit = (2 ** .@arr);
+
+ if (#X21PRIZES_SANTA & .@bit) {
+ dispbottom l("You already purchased a(n) %s during the event.", getitemlink(@bought_nameid[.@i]));
+ dispbottom l("Therefore, the operation was cancelled.");
+ end;
+ }
+ }
+ delitem XmasTicket, @price;
+ /* Record the items on the bitmask (far more important) */
+ /* This requires servercode@712c09c2c6d848243c3426aeb3dbdf730c1e0b08 to work */
+ for (.@i=0;.@i < getarraysize(@bought_nameid); .@i++) {
+ .@arr = array_find(.prizes, @bought_nameid[.@i]);
+ if (.@arr < 0) { dispbottom "REPORT ME: Fatal Array Error (Santa)"; end;}
+ .@bit = (2 ** .@arr);
+ #X21PRIZES_SANTA = #X21PRIZES_SANTA | .@bit;
+ }
+ purchaseok();
+ end;
}