summaryrefslogtreecommitdiff
path: root/npc/003-1/sarah.txt
blob: 38fd2876b475e96fa5ee0099f94d8a33ed8a1930 (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
// TMW2 Script
// Author:
//    Saulc
//    Jesusalva
//    DangerDuck
// Description:
//    "Random" NPC without "any purpose" but to give a Serf Hat.
//    Secretly a pirate lord. Uh.
//    Also repeatable daily (60 GP for a cake every day, so you can have a 10 GP profit selling cakes)

003-1,90,144,0	script	Sarah	NPC_FEMALE_TONORI,{
    function quest_completed;
    function quest_open;
    function quest_started;
    function AssignGHQ;

    // Main Loop
    do
    {
        .@q = getq(TulimsharQuest_Sarah);
        if (.@q == 1)
            quest_completed();
        select
            rif(!.@q, l("Hello, I'm new here! Can I help you?")),
            menuaction(l("Quit"));

        switch (@menu) {
            case 1:
                quest_started();
                break;
        }
    } while (@menu != 2);

    closedialog;
    goodbye;
    close;

// Quest completed
function quest_completed {
    if (getq2(TulimsharQuest_Sarah) != gettimeparam(GETTIME_DAYOFMONTH)) {
        .@price = getiteminfo(CherryCake, ITEMINFO_SELLPRICE) * 4;
        mesn;
        mesq l("Hey, I remember you! You brought me cake the other day!");
        next;
        mesn;
        mesq l("I am coordinating some pirat... uhm... actually nevermind, but the problem is that I can't leave here! So if you can bring me %d %s, I'll pay you %s GP!", 5, getitemlink(CherryCake), fnum(.@price*5));
        next;
        if (countitem(CherryCake) >= 5) {
            mesc "["+l("Deliver the cake to Sarah?")+"]", 1;
            if (askyesno() == ASK_YES) {
                delitem CherryCake, 5;
                Zeny += .@price * 5;
                setq2 TulimsharQuest_Sarah, gettimeparam(GETTIME_DAYOFMONTH);
            }
        }
    } else {
        mesn;
        mesq l("It was so tasty, I can't eat anything more... Thank you.");
        next;
    }
    AssignGHQ();
    return;
}

// Quest Core
function quest_started {
    speech S_FIRST_BLANK_LINE | S_LAST_NEXT,
        l("Oh, Welcome then.");
    speech S_LAST_NEXT,
        l("Can you bring me 5 pieces of Cherry Cake? Pretty please?");
    do
    {
        select
            l("Here they are!"),
            menuaction(l("Quit"));

        switch (@menu) {
            case 1:
                quest_open();
                break;
            case 2:
                mesc l("Protip: @@ is dropped by @@. It is a tough monster, you might need some strategy to kill it. @@ can be bought in shops.", getitemlink(CherryCake), getmonsterlink(GiantMaggot));
                mesc l("%s can also be obtained from %s, at a lower drop rate.", getitemlink(CherryCake), getmonsterlink(Duck));
                next;
                break;
        }
    } while (@menu != 2);
    return;
}

// Quest check
function quest_open {
    if (countitem(CherryCake) >= 5) {
        speech S_FIRST_BLANK_LINE,
            l("You brought me 5 @@ ! Here is your @@, as promised.",getitemlink(CherryCake), getitemlink(SerfHat));
        delitem CherryCake,5;
        getitem SerfHat,1;
        getexp 80, 7;
        setq TulimsharQuest_Sarah, 1, gettimeparam(GETTIME_DAYOFMONTH);
        close;
    } else {
        speech S_FIRST_BLANK_LINE,
            l("Sorry, that is not the cake I love.");
        close;
    }
    return;
}

// Grand Hunter Quest (post-quest)
function AssignGHQ {
    GHQ_Assign(Duck, "Holiday");
    end;
}

OnInit:
    .@npcId = getnpcid(.name$);
    setunitdata(.@npcId, UDT_HEADTOP, TerraniteArmor);
    setunitdata(.@npcId, UDT_HEADMIDDLE, RaidTrousers);
    setunitdata(.@npcId, UDT_HEADBOTTOM, NPCEyesT);
    setunitdata(.@npcId, UDT_WEAPON, CandorBoots); // Boots
    setunitdata(.@npcId, UDT_HAIRSTYLE, 19);
    setunitdata(.@npcId, UDT_HAIRCOLOR, 16);

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