summaryrefslogtreecommitdiff
path: root/npc/005-2/saxsochest.txt
blob: 591372e4ff6ec602f7f012e2b33e52eedffeb4fa (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
// TMW2 Script
// Author:
//    Crazyfefe
// Description:
//    Minor quest for a necklace

005-2,44,41,0	script	Saxso Chest	NPC_NO_SPRITE,{

    function quest_completed {
        speech S_FIRST_BLANK_LINE | S_LAST_NEXT,
            l("you already opened the chest.");
            close;
    }

    function quest_open {
        if (countitem(.key) > 0) {
            speech S_FIRST_BLANK_LINE | S_LAST_NEXT,
                l("You open the chest and found a @@.",getitemlink(.reward));
            delitem .key,1;
            getitem .reward,1;
            getexp 80, 15;
            setq CandorQuest_Chest, 1;
            close;
        } else {
            speech S_FIRST_BLANK_LINE,
                l("You don't have the key.");
            tutmes l("In the world, you may find several treasure boxes. Different treasure boxes need different keys."), l("Treasure!");
            tutmes l("The most common treasure box uses %s and can opened many times. However, this is a special treasure box. You'll need a %s to open it.", getitemlink(TreasureKey), getitemlink(.key)), l("Treasure!");
            tutmes l("This key is dropped by the Saxso Ghost. Did you knew you can obtain info about the monster drop rates and strength?"), l("Monster Information!");
            tutmes l("Use %s (name in english) to obtain this info. You don't need the full name either, so go ahead and try it!", b("@monsterinfo Saxso")), l("Monster Information!");
            close;
        }
    }

    function quest_started {
        speech S_FIRST_BLANK_LINE | S_LAST_NEXT,
            l("It looks locked.");
        narrator S_LAST_NEXT,
            l("Perhaps you should use a key to open it.");
        do
        {
            select
                l("Use a key."),
                menuaction(l("Quit"));

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

    do
    {
        .@chest = getq(CandorQuest_Chest);
        if (.@chest == 1)
            goto quest_completed;
        select
            rif(.@chest == 0,l("There is a dusty chest.")),
            menuaction(l("Quit"));

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

    closedialog;
    goodbye;
    close;

OnInit:
    .key = SaxsoKey;
    .reward = ToothNecklace;

    .sex = G_MALE;
    .distance = 3;
    end;
}