From 4423ae8391682e7298923b53ec5769affd1ee620 Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Tue, 9 Mar 2021 18:39:42 -0300 Subject: Restrict max Strange Coin purchase on Easter to 100/year. Finishing Lilica's Quest is what makes this roll around. --- db/quest_db.conf | 4 ++++ npc/001-4/lilica.txt | 36 ++++++++++++++++++++++++++++++++---- 2 files changed, 36 insertions(+), 4 deletions(-) diff --git a/db/quest_db.conf b/db/quest_db.conf index 1a244339a..a1d538c1a 100644 --- a/db/quest_db.conf +++ b/db/quest_db.conf @@ -536,6 +536,10 @@ quest_db: ( Id: 310 Name: "SQuest_WorkerDay" }, +{ + Id: 311 + Name: "SQuest_Easter" +}, // ID 400+: Event Quests { diff --git a/npc/001-4/lilica.txt b/npc/001-4/lilica.txt index 509452c92..1e6ffc296 100644 --- a/npc/001-4/lilica.txt +++ b/npc/001-4/lilica.txt @@ -16,7 +16,7 @@ l("Scary..........."), -, l("Trade Silver Eggs"), L_Silver, l("Trade Golden Eggs"), L_Golden, - rif(EASTER_EVENT != gettime(7),l("I want an Eggshell Hat!")), L_Quest, + rif(getq(SQuest_Easter) != gettime(7), l("I want an Eggshell Hat!")), L_Quest, l("View LeaderBoard"), L_Leader; close; @@ -63,7 +63,8 @@ L_QuestDone: delitem GoldenEasteregg, 40; delitem SilverEasteregg, 10; //if (rand(0, 10000) < 1000) goto L_Unlucky; - EASTER_EVENT=gettime(7); + setq SQuest_Easter, gettime(7), 0; + //EASTER_EVENT=gettime(7); // The code below not allow hat to leave user account. A bad idea here so I left commented. //getitembound(.@Hat, 1, 1); getnameditem(.@Hat, strcharinfo(0)); @@ -97,6 +98,27 @@ OnInit: end; } +function script EasterCoinCheck { + for (.@i=0;.@i < getarraysize(@bought_nameid); .@i++) { + + if (debug || $@GM_OVERRIDE) + debugmes("%dx %s", @bought_quantity[.@i], getitemname(@bought_nameid[.@i])); + + if (@bought_nameid[.@i] == StrangeCoin) { + .@q2=getq2(SQuest_Easter)+@bought_quantity[.@i]; + if (.@q2 > 100) { + dispbottom l("Attempted to buy %d/%d %s, operation cancelled.", + @bought_quantity[.@i], 100-getq2(SQuest_Easter), + getitemlink(StrangeCoin)); + if (TUTORIAL) + dispbottom l("This quota is reset yearly, by completing %s's quest.", b("Lilica")); + end; + } + } + } + return; +} + // Silver Easter Egg exchange. 001-4,139,151,0 trader #eastershop1 NPC_HIDDEN,{ end; @@ -117,7 +139,10 @@ OnCountFunds: OnPayFunds: if( countitem(SilverEasteregg) < @price ) end; - delitem SilverEasteregg,@price; + // Strange Coins are different + EasterCoinCheck(); + // Complete purchase + delitem SilverEasteregg, @price; purchaseok(); end; } @@ -153,7 +178,10 @@ OnCountFunds: OnPayFunds: if( countitem(GoldenEasteregg) < @price ) end; - delitem GoldenEasteregg,@price; + // Strange Coins are different + EasterCoinCheck(); + // Complete purchase + delitem GoldenEasteregg, @price; purchaseok(); end; } -- cgit v1.2.3-60-g2f50