summaryrefslogtreecommitdiff
path: root/world/map/npc/056-2/mirak.txt
blob: d7b5380331651d9ad682392a1af88d2cbee09ae8 (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
056-2,67,24,0|script|Mirak|372
{
// Variables to set:
// @dq_cost - The number of points this quest uses
// @dq_money - The money reward for doing the quest
// @dq_exp - Experince gained by doing the quest

// Variables used inside:
// Mirak_Quest - This variable contains the @annoy level and the storyline (@talk)
// Mirak_Bantime - Time you cannot come back to the NPC when you upset him
// Mirak_Questtime - Time you cannot come back once you finished the quest
// Update Dailyquest Points
    callfunc "DailyQuestPoints";

// Bitmasks
    set @Mirak_MASK, NIBBLE_0_MASK;
    set @Mirak_SHIFT, NIBBLE_0_SHIFT;

    set @talk, ((QUEST_Mirak & @Mirak_MASK) >> @Mirak_SHIFT);

    set @Mirak_Annoy_MASK, NIBBLE_1_MASK;
    set @Mirak_Annoy_SHIFT, NIBBLE_1_SHIFT;

    set @annoy, ((QUEST_Mirak & @Mirak_Annoy_MASK) >> @Mirak_Annoy_SHIFT);

// Bitmasks END

    if (Mirak_Questtime > gettimetick(2))
        goto L_TooSoon;
    if (@annoy > 3)
        goto L_Kill;
    if (Mirak_Bantime > gettimetick(2))
        goto L_Ban;
    if (@talk < 3)
        goto L_Talk;
    goto L_Ban;

L_Ban:
    mes "[Mirak]";
    mes "\"How did you get back here?\"";
    goto L_Kill;

L_Talk:
    set Mirak_Bantime, 0;
    set Mirak_Questtime, 0;
    if (@talk == 1)
        goto L_Talk1;
    if (@talk == 2)
        goto L_Talk2;
    mes "The old man reads a book and looks up when he sees you coming.";
    mes "He looks at you angrily.";
    next;
    mes "[Mirak]";
    mes "\"Hi, my name is Mirak. You might have the impression that I am nice, but I am NOT! I want to be left alone to read in peace! I tried that at my mansion in Port City but it did not work. My damn brother, he always kept going on about Bat Wings...\"";
    next;
    mes "Suddenly his face gets red. He breathes slowly three times...";
    next;
    mes "He seems to be calm again.";
    next;
    mes "[Mirak]";
    mes "\"Eh... Ah! That's why I bought this house in this goddamn woods. I hoped nobody would come by here. It seems I was wrong. I believe that you did not read the notes I left behind. Read them on your way out.\"";
    mes "He looks down on his book and ignores you.";
    set @talk, 1;
    callsub S_Update_Mask;
    close;

L_Talk1:
    mes "[Mirak]";
    mes "\"What?! You again? Get going!\"";
    set @talk, 2;
    callsub S_Update_Mask;
    close;

L_Talk2:
    mes "[Mirak]";
    mes "\"What do you want?!\"";
    menu
        "Nothing.", L_Nothing,
        "Money!", L_Quest;

L_Nothing:
    mes "[Mirak]";
    mes "\"Ahhhh! Get lost, or you'll regret it!\"";
    set @annoy, @annoy+1;
    callsub S_Update_Mask_Annoy;
    close;

L_Quest:
    set @dq_cost, DailyQuestPoints;
    set @dq_money, 20;
    set @dq_exp, 20;
    mes "[Mirak]";
    mes "\"If you have some energy left, which I need, I can give you money for it. But only if you will leave me alone!\"";
    menu
        "Okay.", L_Trade,
        "Nah, I won't leave you alone.", L_Kill;

L_TooSoon:
    mes "Mirak looks up, sees you, and gets angry.";
    mes "[Mirak]";
    mes "\"I told you not to bother me again! That's why I paid you!\"";
    goto L_Kill;

L_Kill:
    misceffect sfx_magic_war, strcharinfo(0);
    set Hp, 1;
    set @annoy, 0;
    callsub S_Update_Mask_Annoy;
    set Mirak_Bantime, gettimetick(2) + 86400;
    set Mirak_Questtime, 0;
    mes "The old man stands up and looks at you angrier than ever. He mumbles something and your head explodes.";
    next;
    mes "[Mirak]";
    mes "\"That's what you get for annoying me! I studied under the Mages of Tulimshar!";
    mes "I feel better now.\"";
    next;
    mes "The old man sits back down and continues to read.";
    close2;
    warp getsavepoint(0), getsavepoint(1), getsavepoint(2);
    close;

L_Trade:
    if (DailyQuestPoints == 0)
        goto L_NoPoints;
    set Zeny, Zeny + (@dq_money * @dq_cost);
    getexp @dq_exp * @dq_cost, 0;
    set DailyQuestPoints, DailyQuestPoints - @dq_cost;

    mes "[" + @dq_money * @dq_cost + " money]";
    mes "[" + @dq_exp * @dq_cost + " experience points]";
    mes "\"Now leave or you'll regret it. Don't come back!\"";
    set Mirak_Questtime, gettimetick(2) + 86400;
    set Mirak_Bantime, 0;
    close;

L_NoPoints:
    mes "[Mirak]";
    mes "\"Why do you bother me!? You have no energy left!\"";
    goto L_Kill;

// Bitmasks

S_Update_Mask_Annoy:
    set QUEST_Mirak,
        (QUEST_Mirak & ~(@Mirak_Annoy_MASK))
            | (@annoy << @Mirak_Annoy_SHIFT);
    return;

S_Update_Mask:
    set QUEST_Mirak,
        (QUEST_Mirak & ~(@Mirak_MASK))
            | (@talk << @Mirak_SHIFT);
    return;
}