summaryrefslogtreecommitdiff
path: root/npc/008-2-12/nurse.txt
blob: 415746cf98de46f0dc45d2060a076944e6e7a4ac (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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
// Evol scripts.
// Author:
//    gumi
//    The Moubootaur Legends Development Team
// Quest states:
//    [1] 0  - cannot do the quest
//    [1] 1  - can do the quest
//    [1] 2  - talked to inspector (1) <= start
//    [1] 3  - talked to old woman (1)
//    [1] 4  - talked to old woman (2)
//    [1] 5  - talked to inspector (2)
//    [1] 6  - talked to troupe leader (1)
//    [1] 7  - talked to inspector (3)
//    [1] 8  - talked to old man
//    [1] 9  - talked to old woman (3)
//    [1] 10 - talked to inspector (4)
//    [1] 11 - talked to old woman (4)
//    [1] 12 - talked to malek
//    [1] 13 - searched the bookcase
//    [1] 14 - talked to inspector (5)
//    [1] 15 - talked to troupe leader (2) <= reward
//    [1] 16 - talked to inspector (6) <= reward, end
//    [2] unused
//    [3] unused
//    [t] unused
// Description:
//    Hurnscald Nurse. Robberies in Hurnscald.

008-2-12,28,30,0	script	Nurse	NPC_NURSE_LEGACY,{
    function bloodDonor;
    .@q2=getq2(HurnscaldQuests_BloodDonor);

    speech(4,
        l("How can I help you?"));

    // XXX: this npc used to teach the resist poison skill, do we still want that?

    selectd(
        l("Oooh, these wounds! They hurt so much!"),
        l("I don't feel so well, I might be sick."),
        rif(.@q2 < gettimetick(2), l("I would like to donate blood.")),
        l("No, I'm fine."),
        rif(getq(.quest_inspector) == 2, l("Have you seen anything out of the ordinary?")));

    switch (@menu)
    {
    case 1:
        if (BaseLevel > .heal_max_level)
        {
            speech(
                l("I'm sorry but I'm here only to help young adventurers and the town residents."),
                l("Your level is already higher than %d.", .heal_max_level),
                l("You can get some rest at the inn near here."));
            close;
        }
        speech(4,
            l("Here, let me heal you."));

        // Jesusalva: I don't trust npcskill()
        npcskill(AL_HEAL, .heal_skill_level, .heal_npc_stats, .heal_npc_level);

        speech(
            l("There you go, like new."));
        break;
    case 2:
        speech(
            l("Then you should better see the doctor."),
            l("He is usually in his office on the 3rd floor."));
        break;
    case 3:
        bloodDonor();
        break;
    case 4:
        speech(
            l("Then I would ask you to leave."),
            l("There are people who really need our help."));
        break;
    case 5:
        speech(
            l("I'm too busy here to observe the town."));
        break;
    }
    close;

function bloodDonor {
    .@q2=getq2(HurnscaldQuests_BloodDonor);
    .@q3=getq3(HurnscaldQuests_BloodDonor);
    // Cheating??!
    if (.@q2 > gettimetick(2))
        kick(getcharid(3));
    // Anyway, ML code comes here, adapted for TMW
    mesc l("Donating blood will BLOCK YOUR MOVEMENT for three minutes.");
    mesc l("Do not disconnect while waiting. You need 100% HP to donate.");
    next;
    // Always show Info if it is your first time donating blood
    @menu = 1;
    if (.@q3) {
        select
            l("Info"),
            rif(readparam(Hp) == readparam(MaxHp), l("Yes, please use my blood to save lifes.")),
            l("I changed my mind");
        mes "";
    }
    if (@menu == 3)
        return;
    if (@menu == 1) {
        mesn;
        mesq l("Donating blood is a noble act, which allows to save lifes.");
        next;
        mesn;
        mesq l("When people loses too much blood, they die, unless we can lend them somebody's else blood.");
        next;
        mesn;
        mesq l("Not everyone can be a blood donor. For example, you must be healthy.");
        mesq l("You can find more info about this on these links:");
        mes "";
        mes "[@@https://www.blood.co.uk/|https://www.blood.co.uk/@@]";
        mes "[@@https://www.nhsbt.nhs.uk/what-we-do/blood-services/blood-donation/|https://www.nhsbt.nhs.uk/what-we-do/blood-services/blood-donation/@@]";
        mes l("France: [@@https://dondesang.efs.sante.fr/|https://dondesang.efs.sante.fr/@@]");
        mes l("Brazil: [@@http://www.prosangue.sp.gov.br/home/Default.html|http://www.prosangue.sp.gov.br/home/Default.html@@]");
        if (readparam(Hp) < readparam(MaxHp))
            return;
        next;
        mesc l("Donate blood?", 1);
        if (askyesno() == ASK_NO)
            return;
    }
    // Donate blood
    mesn;
    mesq l("This will take only a short while.");
    next;
    setq1 HurnscaldQuests_BloodDonor, 2;
    percentheal -90, 0;
    addtimer(180000, "Nurse::OnDonationComplete");
    warp "008-2-14", 31, 27;
    setpcblock(PCBLOCK_ATTACK|PCBLOCK_SKILL|PCBLOCK_USEITEM|PCBLOCK_MOVE, true);
    dispbottom l("Any movement/skill/item will be without effect until time is up.");
    closedialog;
    return;
}

OnDonationComplete:
    if (checkpcblock() & PCBLOCK_ATTACK)
        setpcblock(PCBLOCK_ATTACK|PCBLOCK_SKILL|PCBLOCK_USEITEM|PCBLOCK_MOVE, false);
    warp "008-2-12", 30, 30;
    percentheal 100, 0;
    // Experience gain is based on HP
    getexp readparam(Hp)*2, readparam(Hp)/100;
    .@q3=getq3(HurnscaldQuests_BloodDonor)+1;
    // Cooldown: 60*60*24*30: 30 days
    setq HurnscaldQuests_BloodDonor, 1, gettimetick(2)+(2592000), .@q3;
    if (BaseLevel >= 30)
        getitem Bread, 1;
    if (BaseLevel >= 50)
        getitem ChocolateBar, 1;
    if (BaseLevel >= 70)
        getitem BottleOfWater, 1;
    mesn;
    mesq l("Thanks for donating blood. You can donate again in 30 days.");
    mesq l("You should eat and drink water after donating blood. Thanks for saving lifes!");
    close;


OnInit:
    .heal_max_level = 20; // she will only heal low level players

    .heal_skill_level = 10; // what level of the healing skill to use
    .heal_npc_stats = 99; // what stat points the NPC has
    .heal_npc_level = 60; // what level the npc has

    .quest_inspector = HurnscaldQuests_Inspector;
    .quest_debug = .quest_inspector;
    .distance = 3;
    end;
}