summaryrefslogtreecommitdiff
path: root/world/map/npc/002-1/sarah.txt
blob: 19e5f8664f8d974f1c779345ae494b4a4123df15 (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
// Variables used: nibble 1 of QUEST_SouthTulimshar

002-1,93,43,0|script|Sarah|106
{
    // This NPC previously used the variable TMW_Quest
    callfunc "ClearVarTMW_Quest";

    set @state, ((QUEST_SouthTulimshar & NIBBLE_1_MASK) >> NIBBLE_1_SHIFT);

    if (@state >= 2) goto L_Done;
    if (@state == 1) goto L_Progress;

    mes "[Sarah]";
    mes "\"Boy, am I hungry or what!\"";
    next;

    set @TEMP, rand(2);
    if(@TEMP == 1) goto L_Opening1;
    goto L_Opening0;

L_Opening0:
    mes "\"Cherry Cake is the best!\"";
    next;
    goto L_Ask;

L_Opening1:
    mes "\"Mmm, Cherry Cake... I love it!\"";
    next;
    goto L_Ask;

L_Ask:
    mes "\"Can you bring me a piece of Cherry Cake?  Pretty please?\"";
    menu
        "Yes.", L_Req0,
        "No.", L_Close;

L_Req0:
    mes "[Sarah]";
    mes "\"Yippee!  Bring me a piece of Cherry Cake, and I'll give you a nice hat!\"";
    next;
    set @state, 1;
    callsub S_Update_Var;
    mes "[Sarah]";
    mes "\"Please bring it to me!\"";
    goto L_Close;

L_Progress:
    if (countitem("CherryCake") < 1)
        goto L_NotEnough;
    mes "[Sarah]";
    mes "\"Whee!\"";
    next;
    mes "You brought me Cherry Cake!  Here is your new hat, as promised.\"";
    getinventorylist;
    if ((@inventorylist_count - (countitem("CherryCake") == 1)) > 99) goto L_TooMany;
    delitem "CherryCake", 1;
    getitem "SerfHat", 1;
    set @state, 2;
    callsub S_Update_Var;
    close2;
    emotion EMOTE_TONGUE, strcharinfo(0);
    end;

L_NotEnough:
    mes "[Sarah]";
    mes "\"Oh, I'm starving!  Please bring me Cherry Cake!\"";
    goto L_Close;

L_Done:
    mes "[Sarah]";
    mes "\"It was so tasty, I can't eat anything more... Thank you!\"";
    close2;
    emotion EMOTE_TONGUE, strcharinfo(0);
    end;

L_Close:
    set @TEMP, 0;
    set @state, 0;
    close;

L_TooMany:
    next;
    mes "[Sarah]";
    mes "\"You don't have room for my reward. I'll wait until you do.\"";
    goto L_Close;

S_Update_Var:
    set QUEST_SouthTulimshar, (QUEST_SouthTulimshar & ~(NIBBLE_1_MASK) | (@state << NIBBLE_1_SHIFT));
    return;
}