From 1c2001f6ef1ddabd5e1852fe3ce5f2ae687cbad7 Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Sat, 9 Feb 2019 00:02:22 -0200 Subject: Receive chocolate boxes - OK --- npc/001-11/Demure.txt | 53 ++++++++++++++++++++++++++++++++++++++++++++++---- npc/commands/event.txt | 3 ++- 2 files changed, 51 insertions(+), 5 deletions(-) (limited to 'npc') diff --git a/npc/001-11/Demure.txt b/npc/001-11/Demure.txt index 14b3cd1d3..8e14066b3 100644 --- a/npc/001-11/Demure.txt +++ b/npc/001-11/Demure.txt @@ -5,6 +5,9 @@ // Valentine Event Master 001-11,40,25,0 script Demure#Valentine NPC_FEMALE,{ + goto L_Main; + + // Functions function ScoreValentine { .@nb = query_sql("SELECT c.name, i.value FROM `acc_reg_num_db` AS i, `char` AS c WHERE i.key='#VALENTINE_POINTS' AND i.account_id=c.account_id ORDER BY i.value DESC LIMIT 10", .@name$, .@value); @@ -21,6 +24,40 @@ mes("10."+.@name$[9]+" ("+.@value[9]+")"); next; } + // $@VALENTINE_GIFTSTACKS + // (account id, gifts to receive) + // $@VALENTINE_LOVELETTER + // (account id, list of names) + function SendGift { + mesn; + mesq l("How many chocolate do you want to send? You currenly have: @@", countitem(BoxOfChocolates)); + input @Val_Ammo; + if (@Val_Ammo > countitem(BoxOfChocolates)) { + mesc l("You don't have that many!"); + return; + } + } + function GetGift { + .@m = htget($@VALENTINE_GIFTSTACKS, getcharid(3)); + if (.@m > 0) { + mesq l("Hey, look, you have @@ boxes to collect!", .@m); + .@n$ = htget($@VALENTINE_LOVELETTER, getcharid(3), l("Secret Admirer")); + mesq l("They were given with @@ by @@.", any(l("love"), l("passion"), l("affection")), .@n$); + + inventoryplace BoxOfChocolates, .@m; + getitem BoxOfChocolates, .@m; + htput $@VALENTINE_GIFTSTACKS, getcharid(3), 0; + htput $@VALENTINE_LOVELETTER, getcharid(3), ""; + + } else { + mesq l("Sorry, you don't have any chocolate to pick up."); + } + + return; + } + +// Script begin +L_Main: // Safety Check if ($EVENT$ != "Valentine") { warp "Save", 0, 0; end; @@ -35,12 +72,18 @@ next; do { mesc l("You currently have @@ points, @@ boxes of chocolate and @@ love letters.", #VALENTINE_POINTS, countitem(BoxOfChocolates), countitem(LoveLetter)); - mesc l("@@ boxes of chocolate were given to you as a gift.", #VALENTINE_OPENED-#VALENTINE_RECEIVED); + if (#VALENTINE_OPENED-#VALENTINE_RECEIVED > 0) { + mesc l("@@ boxes of chocolate were given to you as a gift.", #VALENTINE_OPENED-#VALENTINE_RECEIVED); + // Demure can just send Soren's Chocolate to somebody else. + // Everyone else cannot send their gift chocolates. Please don't lose the boxes. + if (!is_gm()) + .@eatfirst=true; + } mes ""; select l("Information"), l("Scoreboards"), - l("Send Chocolate"), + rif(!.@eatfirst, l("Send Chocolate")), l("Receive Chocolate"), l("Okay, bye"); mes ""; @@ -59,6 +102,7 @@ next; mes l("When receiving the chocolate, you must eat it before event ends to get a point for that!"); mes l("These boxes cannot be sold, but they'll be deleted a while after the event ends."); + mes l("You also cannot send any boxes before eating any you've received, but Demure is an exception for this rule."); next; mes l("As with all TMW2 Major Events, the top 1 receive a special pet, and the other ranked ones get diverse rewards."); mes l("There might be reward for anyone who doesn't gets a rank, but I never count on that. So, let's start?"); @@ -68,9 +112,10 @@ ScoreValentine(); break; case 3: + SendGift(); next; + break; case 4: - mesn; - mesq l("NYI"); + GetGift(); next; break; } } while (@menu != 5); diff --git a/npc/commands/event.txt b/npc/commands/event.txt index bf678a5a0..12ea6f301 100644 --- a/npc/commands/event.txt +++ b/npc/commands/event.txt @@ -79,6 +79,7 @@ function script GlobalEventMenu { DelAccRegFromEveryPlayer("#VALENTINE_RECEIVED"); DelAccRegFromEveryPlayer("#VALENTINE_OPENED"); DelAccRegFromEveryPlayer("#VALENTINE_SENT"); + htdelete $@VALENTINE_GIFTSTACKS; htdelete $@VALENTINE_LOVELETTER; $@VALENTINE_LOVELETTER=0; } @@ -123,7 +124,7 @@ function script GlobalEventMenu { case 1: sClear(); set $EVENT$, ""; logmes "Disabled events.", LOGMES_ATCOMMAND; break; case 2: - set $EVENT$, "Valentine"; $@VALENTINE_LOVELETTER = htnew(); logmes "Enabled VALENTINE DAY event.", LOGMES_ATCOMMAND; + set $EVENT$, "Valentine"; $@VALENTINE_LOVELETTER = htnew(); $@VALENTINE_GIFTSTACKS = htnew(); logmes "Enabled VALENTINE DAY event.", LOGMES_ATCOMMAND; break; case 3: sEaster(); break; case 4: -- cgit v1.2.3-70-g09d2