summaryrefslogtreecommitdiff
path: root/npc/001-11/Demure.txt
blob: 8e14066b37ca34b29efdbbba7dd10f9797c76af1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
// TMW2 scripts.
// Author:
//    Jesusalva
// Description:
//    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);

        mes "##B"+l("Top 10 - Valentine Day")+"##b";
	    mes("1." +.@name$[0]+" ("+.@value[0]+")");
	    mes("2." +.@name$[1]+" ("+.@value[1]+")");
	    mes("3." +.@name$[2]+" ("+.@value[2]+")");
	    mes("4." +.@name$[3]+" ("+.@value[3]+")");
	    mes("5." +.@name$[4]+" ("+.@value[4]+")");
	    mes("6." +.@name$[5]+" ("+.@value[5]+")");
	    mes("7." +.@name$[6]+" ("+.@value[6]+")");
	    mes("8." +.@name$[7]+" ("+.@value[7]+")");
	    mes("9." +.@name$[8]+" ("+.@value[8]+")");
	    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;
    }

    // Demure Main
    mesn;
    mesq l("That annoying guy on the side of the tree is annoying. I want to ban him.");
    next;
    mesn;
    mesq l("Anyway, it is Valentine Day, a good day to trade @@ with your admired one!", getitemlink(BoxOfChocolates));
    next;
    do {
        mesc l("You currently have @@ points, @@ boxes of chocolate and @@ love letters.", #VALENTINE_POINTS, countitem(BoxOfChocolates), countitem(LoveLetter));
        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"),
            rif(!.@eatfirst, l("Send Chocolate")),
            l("Receive Chocolate"),
            l("Okay, bye");
        mes "";

        switch (@menu) {
            case 1:
            mesn;
            mes lg("Valentine Day event consist in gathering @@ and sending them to your loved one.", getitemlink(BoxOfChocolates));
            next;
            mesn;
            mes l("Don't worry if they don't correspond to you. Each box sent will grant you 1 event point.");
            mes l("The prizes are only for the top 10, but Loratay on Land Of Fire Village can make a dress for you.");
            next;
            mes l("You can optionally send a @@ along the chocolate box, so the person knows it was you who sent the chocolate.", gettitemlink(LoveLetter));
            mes l("Sending the letter will give you double event points, capped to 10 extra points.");
            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?");
            next;
            break;
            case 2:
            ScoreValentine();
            break;
            case 3:
            SendGift(); next;
            break;
            case 4:
            GetGift(); next;
            break;
        }
    } while (@menu != 5);
    closedialog;
    goodbye;
    close;

OnInit:
    .@npcId = getnpcid(.name$);
    setunitdata(.@npcId, UDT_HEADTOP, GMCap);
    setunitdata(.@npcId, UDT_HEADMIDDLE, GMRobe);
    setunitdata(.@npcId, UDT_HAIRSTYLE, 14);
    setunitdata(.@npcId, UDT_HAIRCOLOR, 18);

    .sex = G_FEMALE;
    .distance = 5;
    end;

}