summaryrefslogtreecommitdiff
path: root/npc/014-5/sagratha.txt
blob: 0df85a15120221668fa45a5ace455d82094e157c (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
176
// TMW2 scripts.
// Authors:
//    Jesusalva
// Description:
//    Sagratha's House Door
//
// getq(HurnscaldQuest_Sagratha)
//  Field 1
//      0 - Sagratha is home and annyoed
//      1 - Wyara sent player saggy way
//      2 - Rumor Confirmed, check again
//  Field 2
//      RESERVED - INSTANCE ID
//  Field 3
//      During stage 1 and 2: Holds if player looked everywhere
//      During stage 3 and 4: Control puzzles
//      During stage 5 boss fight

// Check instances and rebuild if needed
// Returns map name
// SaggyInstCheck( {house=true} )
function	script	SaggyInstCheck	{
	.@house=getarg(0, true);

	.@q2=getq2(HurnscaldQuest_Sagratha);
	// Map name limit: 4 chars (sgt1)
	.@mapn$="sgt1@"+getcharid(0);
	.@map2$="sgt2@"+getcharid(0);
	if (!(isinstance(.@q2) && .@q2 != 0)) {
		.@inst = instance_create("Sagratha House "+getcharid(0), getcharid(3), IOT_CHAR);
	    instance_attachmap("014-5-1", .@inst, false, .@mapn$);
	    //instance_attachmap("015-8", .@inst, false, .@mapn$);
	    instance_attachmap("015-8-1", .@inst, false, .@map2$);
	    // Instance lasts one hour
		instance_set_timeout(3600, 3600, .@inst);
		instance_init(.@inst);
	    setq2 HurnscaldQuest_Sagratha, .@inst;
	}

	if (.@house) {
		return .@mapn$;
	} else {
		return .@map2$;
	}
}

014-5,122,137,0	script	Sagratha Door	NPC_HIDDEN,0,0,{
    end;

L_Magicless:
    npctalk3 l("A light magic barrier prevents you from entering.");
    dispbottom l("If I only knew some magic...");
    end;

L_Lockpick:
    mesn;
    mesc l("The door is locked!");
    select
        l("Knock on the door?"),
        l("Attempt to lockpick?"),
        l("Leave it alone?");
    mes "";

    if (@menu == 1) {
        /*
        if (getq(HurnscaldQuest_InjuriedMouboo) == 2)) {
            mesn strcharinfo(0);
            mesc l("Nobody answers.");
            mes "";
        }
        */
        mesn l("Sagratha");
        mesq l("No, I don't need monster repellent nor anything! Go away!");
        close;
    } else if (@menu == 2) {
        if (LockPicking(4, 5)) {
            getexp BaseLevel*4, 5;
            mesn;
            mesc l("*click*");
            next;
            mesn l("Sagratha");
            mesq l("Who is there? Are they trying to break my lock again?!");
            next;
            select
                l("Run away?"),
                l("Stay there?");
            mes "";

            if (@menu == 2) {
                mesn l("Sagratha");
                mesq l("Oh my Jesusalva - You broke my lock! Why?!");
                next;
                select
                    l("I need to talk with you!"),
                    l("No reason.");
                mes "";
                if (@menu == 1) {
                    mesn l("Sagratha");
                    mesq l("No, I don't teach magic. No, I'm not interested in @@ affairs.", get_race());
                    next;
                    mesn l("Sagratha");
                    mesq l("Yes, I know when next Alliance's Council meeting will be. No, I don't need anything.");
                    next;
                    mesn l("Sagratha");
                    mesq l("Now begone.");
                } else {
                    mesn l("Sagratha");
                    mesq l("What?! Do my house look like the place to you pratice your thief skills?!");
                    mesq col(l("DIE!"), 1);
                    specialeffect(312, SELF, getcharid(3));
                    percentheal -40, -100;
                }
            }

        } else {
            mesn l("Sagratha");
            mesq l("Who is there? Are they trying to break my lock again?!");
            mesq col(l("DIE!"), 1);
            specialeffect(312, SELF, getcharid(3));
            percentheal -40, -100;
        }
    }
    close;

L_Open:
    mesn;
    mesc l("The door is locked!");
    select
        l("Knock on the door?"),
        l("Attempt to lockpick?"),
        l("Leave it alone?");
    mes "";
    if (@menu == 3)
        close;
    mesc l("*CREAK*");
    mesc l("The pressure you did made the door burst open. It is unusually quiet inside...");
    next;
    //enable_items();
    //mesc l("WARNING: Save your game now."), 3;
    //mesc l("WARNING: Change your equipment now."), 3;
    //next;
    //disable_items();
    /*
	if (has_instance("014-5-1") == "") {
		.@inst = instance_create("Sagratha House", getcharid(3), IOT_CHAR);
        instance_attachmap("014-5-1", .@inst);
        // 20 minutes (1200s) inside, or 5 minutes (300s) outside
		instance_set_timeout(1200, 30, .@inst);
		instance_init(.@inst);
    }
    warp "014-5-1", 33, 44;
    //addmapmask instance_mapname("014-5-1"), 1;
    changemusic "014-5-1", "eric_matyas_ghouls.ogg";
    */
	.@mapn$=SaggyInstCheck();
    warp .@mapn$, 33, 44;
    changemusic .@mapn$, "eric_matyas_ghouls.ogg";
    closeclientdialog;
    close;

L_Welcome:
    warp "014-5-1", 33, 44;
    dispbottom l("Mouboos are cute");
    end;

OnTouch:
    .@q=getq(HurnscaldQuest_Sagratha);
    if (!MAGIC_LVL) goto L_Magicless;
    if (.@q >= 1 && .@q < 6) goto L_Open;
    if (.@q >= 6) goto L_Welcome;

    // No special condition
    goto L_Lockpick;
    end;

}