summaryrefslogtreecommitdiff
path: root/npc/006-1/tree.txt
blob: df6dd2ef6722940858c9c25a05121b719578b3f6 (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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
function	script	QuestTreeTrigger	{
    @Q_MASK = NIBBLE_2_MASK;
    @Q_SHIFT = NIBBLE_2_SHIFT;

    @Q_status = (QUEST_MAGIC & @Q_MASK) >> @Q_SHIFT;
    @Q_status_lower = @Q_status & 3;
    @Q_status = (@Q_status & 12) >> 2;

    if (@Q_status & getarg(0, @flag)) goto L_close;  // already did that

    if (getarg(0, @flag) == 2) goto L_hug;
    goto L_Cont;

L_Cont:
    @Q_status = @Q_status | getarg(0, @flag);
    callsub S_Update_Var;

    if (@Q_status != 3) goto L_close;

    if (MAGIC_FLAGS & MFLAG_DID_CUTTREE) goto L_close;

    mes "Maybe it is just a trick of the light, but you can't help but think that the tree looks different... healthier, almost younger.";
    mes "[20000 experience points]";
    getexp 20000, 0;
    @value = 15;
    callfunc "QuestSagathaHappy";
    goto L_close;

L_hug:
    mes "You hug the tree.";
    next;
    goto L_Cont;

L_close:
    @Q_MASK = 0;
    @Q_SHIFT = 0;
    @Q_status = 0;
    @Q_status_lower = 0;
    @Q_wr_status = 0;
    @value = 0;
    return;

S_Update_Var:
    @Q_wr_status = (@Q_status << 2) | @Q_status_lower;
    QUEST_MAGIC = (QUEST_MAGIC & ~(@Q_MASK) | (@Q_wr_status << @Q_SHIFT));
    return;
}

function	script	QuestTreeTouch	{
    @Q_MASK = NIBBLE_2_MASK;
    @Q_SHIFT = NIBBLE_2_SHIFT;

    @Q_status = (QUEST_MAGIC & @Q_MASK) >> @Q_SHIFT;
    @Q_status = (@Q_status & 12) >> 2;

    if (@Q_status == 3) goto L_Happy;

    if ((MAGIC_FLAGS & (MFLAG_KNOWS_DRUIDTREE | MFLAG_KNOWS_CUTTREE)) == MFLAG_KNOWS_CUTTREE) goto L_cut;

    if ((MAGIC_FLAGS & (MFLAG_KNOWS_DRUIDTREE | MFLAG_KNOWS_CUTTREE)) == MFLAG_KNOWS_DRUIDTREE) goto L_Water;

    if ((MAGIC_FLAGS & (MFLAG_KNOWS_DRUIDTREE | MFLAG_KNOWS_CUTTREE)) > 0)   //i.e., both are set
        goto L_both;

    mes "[Dying Tree]";
    mes "You see a strange tree.";
    goto L_close;

L_cut:
    mes "[Dying Tree]";
    mes "This must be the tree that the earth spirit was referring to.";
    next;
    menu
        "Cut off a branch", L_do_cut,
        "Leave it alone", L_close;

L_Water:
    mes "[Dying Tree]";
    mes "This must be the druid tree.";
    next;
    menu
        "Water the tree", L_Givewater,
        "Kiss tree", L_kiss,
        "Leave it alone", L_close;

L_both:
    mes "[Dying Tree]";
    mes "This must be the druid tree that Wyara and the earth spirit were talking about.";
    next;
    menu
        "Water the tree", L_Givewater,
        "Kiss tree", L_kiss,
        "Cut off a branch", L_do_cut,
        "Leave it alone", L_close;

L_Givewater:
    if (countitem("BottleOfWater") < 1) goto L_No_Water;
    delitem "BottleOfWater", 1;
    getitem "EmptyBottle", 1;

    mes "[Dying Tree]";
    mes "You pour a bottle of water into the sand. The water dissipates quickly, without any effect.";
    goto L_close;

L_No_Water:
    mes "[Dying Tree]";
    mes "You don't have any water.";
    goto L_close;

L_kiss:
    mes "[Dying Tree]";
    mes "You pluck out a splinter from your lip.";
    mes "Somehow, you don't think that this helped.";
    goto L_close;

L_do_cut:
    if (countitem("BoneKnife") < 1) goto L_No_boneknife;

    if (MAGIC_FLAGS & MFLAG_DID_CUTTREE) goto L_really_cut;

    mes "[Dying Tree]";
    mes "You find a suitable branch and put your bone knife in position.";
    mes "Holding the branch, you have an uneasy feeling – as if something inside the tree were trying to resist you...";
    mes "Do you want to continue cutting?";
    next;
    menu
        "Nah... better not.", L_close,
        "Yes, let's cut!", L_really_cut;

L_really_cut:
    MAGIC_FLAGS = MAGIC_FLAGS | MFLAG_DID_CUTTREE;
    getitem "DruidTreeBranch", 1;
    mes "[Dying Tree]";
    mes "You cut off a branch from the tree.";
    mes "For an instant, you have an uneasy feeling, as if the branch were writhing in your hand...";
    goto L_close;

L_No_boneknife:
    mes "[Dying Tree]";
    mes "Try as you might, you can't seem to find a way to cut off a branch. Perhaps you need a different tool for cutting?";
    goto L_close;

L_Happy:
    mes "[Druid Tree]";
    mes "The tree looks younger and healthier now.";
    goto L_close;

L_close:
    @Q_MASK = 0;
    @Q_SHIFT = 0;
    @Q_status = 0;
    return;

}

006-1,82,59,0	script	#DruidTree0#_M	NPC400,{
    callfunc "QuestTreeTouch";
    close;
}