summaryrefslogtreecommitdiff
path: root/world/map/npc/033-1/kimarr.txt
blob: 7cdac53396bbf12a4d2dc011df9d74c0360e4abc (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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
033-1.gat,74,32,0	script	Kimarr	218, {

	set @Q_Barbarians_MASK, NIBBLE_0_MASK;
	set @Q_Barbarians_SHIFT, NIBBLE_0_SHIFT;

	set @state, ((QUEST_Barbarians & @Q_Barbarians_MASK) >> @Q_Barbarians_SHIFT);

	if (@state >= 3) goto L_Again;
	if (@state == 2) goto L_Reward;
	if (@state == 1) goto L_Ask;

	mes "[Barbarian]";
	mes "\"Greetings, little person.\"";
	next;
	mes "\"I am Kimarr, hunter and warrior of the Mangarr.\"";
	next;
	mes "\"You are very small, better be careful in this snowy mountains. It is cold and dangerous monsters are here.\"";
	menu
		"Hello, my name is " + strcharinfo(0) + " and I'm not small. I'm a great warrior!",-,
		"I'm " + strcharinfo(0) + ", don't underestimate me. I'm an experienced adventurer!" ,-,
		"I'm the legendary " + strcharinfo(0) + ", I've fought countless battles.",-;

	mes "Kimarr seems to be amused.";
	mes "[Kimarr]";
	mes "\"Really? Do you want to prove it?\"";
	menu
		"Sure! What shall I do?", L_Explain,
		"No, I don't need to prove anything.",L_Close;

L_Explain:
	mes "[Kimarr]";
	mes "\"Every young member of our tribe proves his or her worth by hunting monsters.\"";
	next;
	mes "\"The first monsters to hunt are fluffies. Fluffies give a good meal for a young person and the fur can be used to make clothes and blankets.\"";
	next;
	callsub S_Explain_Game;

	set @state, 1;
	callsub S_Update_Mask;
L_Ask:
	mes "[Kimarr]";
	mes "\"So, are you going to try?\"";
	menu
		"Yeah, let's start",L_Game,
		"Could you explain again?",-,
		"Maybe later.",L_Close;

	callsub S_Explain_Game;
	goto L_Ask;

S_Explain_Game:
	mes "[Kimarr]";
	mes "\"In that cave there are living fluffies. They like to eat apples.\"";
	next;
	mes "\"I also saw one of them getting excited about one of that sweet things you call 'cake'.\"";
	next;
	mes "\"You should be careful, other monsters living here might like the food as well\"";
	next;
	mes "\"Go to the cave entrance and throw food on the floor to make them come out.\"";
	next;
	mes "\"Then hunt as many fluffies as you can until I tell you to stop.\"";
	next;
	mes "\"Drop more food when no fluffies are left.\"";
	return;

L_Reward:
	mes "[Kimarr]";
	mes "\"That was very impressing - now you can call yourself hunter " + strcharinfo(0) +".\"";
	next;
	getinventorylist;
	if (@inventorylist_count == 100) goto L_Full_Inv;
	mes "\"Take this as a symbol of your strength. You're a member of our tribe now.\"";
	getitem "YetiSkinShirt", 1;
	set @state, 3;
	callsub S_Update_Mask;
	close;

L_Again:
	mes "[Kimarr]";
	mes "\"Does hunter " + strcharinfo(0) + " want to hunt some fluffies again?\"";
	menu
		"Yeah!",L_Game,
		"Can you tell me who were the most successfull fluffy hunters?",-,
		"Not now.",L_Close;
	//TODO: give list of best hunters
	close;

L_Full_Inv:
	mes "[Kimarr]";
	mes "\"You are carrying a lot of things. I will give something to you when you have room for it.\"";
	close;

L_Close:
	close;

L_Game:
//REMOVE
goto L_Reward;
	if ($@FLUFFY_HUNTING) goto L_Someone_Else;
	set $@FLUFFY_HUNTING, 1;
	set $@FLUFFY_COUNTER, 0;
	set $@FLUFFY_TIME, 0;
	set $@FLUFFY_LVL, baselevel;
//TODO: set minimum  number of killed fluffies (maybe based on level?)
	set $@FLUFFY_MIN, 10;
	warp "033-1.gat", 79, 34;
	startnpctimer;
	goto L_Close;

L_Someone_Else:
	mes "[Kimarr]";
	mes "\"At the moment someone else is hunting. Let's wait until that hunting has ended.\"";
	close;

OnTimer1000:
	setnpctimer 0;
	if ($@FLUFFY_HUNTING != 0) goto L_Hunting;

L_Hunting:
	set $@FLUFFY_TIME, $@FLUFFY_TIME + 1;
	if ($@FLUFFY_TIME > 300) goto L_CleanUp;
	//TODO: monsterID angry fluffy
	if (getareausers("033-1.gat", 79, 29, 88, 42) == 0) goto L_CleanUp;

	set $@FLUFFY_REDAPPLES, getareadropitem("033-1.gat", 79, 29, 88, 42, 535, 1);
	set $@FLUFFY_XMASCAKE, getareadropitem("033-1.gat", 79, 29, 88, 42, 508, 1);
	set $@FLUFFY_CAKE, getareadropitem("033-1.gat", 79, 29, 88, 42, 513, 1);
	set $@FLUFFY_GREENAPPLE, getareadropitem("033-1.gat", 79, 29, 88, 42, 719, 1);

//TODO: balance the spawns and maybe add the new monster
	set $@FLUFFY_SPAWN, $@FLUFFY_REDAPPLES + 5 * $@FLUFFY_XMASCAKE + 3 * $@FLUFFY_CAKE + $@FLUFFY_GREENAPPLE;

//TODO: remove debug messages
	if ($@FLUFFY_TIME % 10 == 0)
		mapannounce "033-1.gat", "$@FLUFFY_TIME " + $@FLUFFY_TIME, 0;
	if ($@FLUFFY_TIME % 10 == 0)
		mapannounce "033-1.gat", "$@FLUFFY_COUNTER " + $@FLUFFY_COUNTER, 0;
	areamonster "033-1.gat", 79, 29, 88, 42, "", 1020, $@FLUFFY_SPAWN, "Kimarr::onFluffyDeath";
	if (($@FLUFFY_SPAWN > 0) && ($@FLUFFY_LVL > 40) && (rand(5 * $@FLUFFY_XMASCAKE + 3 * $@FLUFFY_CAKE + 10 * $@FLUFFY_LVL) > 500)) // Ice Goblin
		areamonster "033-1.gat", 79, 29, 88, 42, "", 1058, 1, "Kimarr::onPetDeath";
	if (($@FLUFFY_SPAWN > 0) && ($@FLUFFY_LVL > 60) && (rand(5 * $@FLUFFY_XMASCAKE + 3 * $@FLUFFY_CAKE + 10 * $@FLUFFY_LVL) > 550)) // Santa Slime
		areamonster "033-1.gat", 79, 29, 88, 42, "", 1015, 1, "Kimarr::onPetDeath";
	if (($@FLUFFY_SPAWN > 0) && ($@FLUFFY_LVL > 70) && (rand(5 * $@FLUFFY_XMASCAKE + 3 * $@FLUFFY_CAKE + 10 * $@FLUFFY_LVL) > 600)) // Yeti
		areamonster "033-1.gat", 79, 29, 88, 42, "", 1072, 1, "Kimarr::onPetDeath";
	set $@FLUFFY_REDAPPLES, 0;
	set $@FLUFFY_XMASCAKE , 0;
	set $@FLUFFY_CAKE, 0;
	set $@FLUFFY_GREENAPPLE, 0;
	end;
//onInit:
//	initnpctimer;
//	stopnpctimer;

onFluffyDeath:
	set $@FLUFFY_COUNTER, $@FLUFFY_COUNTER + 1;
	mapannounce "033-1.gat", "fluffies killed: " + $@FLUFFY_COUNTER, 0;
	end;

L_CleanUp:
	areatimer "033-1.gat", 79, 29, 88, 42, 10, "Kimarr::onReward";
	set $@FLUFFY_HUNTING, 0;
	mapannounce "033-1.gat", "You killed " + $@FLUFFY_COUNTER + "Fluffies", 0;
	set $@FLUFFY_COUNTER, 0;
	//TODO: save amount of killed fluffies in playervariable (hunting redoable, npc tells the best result)
	set $@FLUFFY_TIME, 0;
//TODO: check if that command really only kills the event monsters
	killmonster "033-1.gat", "All";
	stopnpctimer;
	setnpctimer 0;
	mapannounce "033-1.gat", "clean up", 0;
	end;

onReward:
	//TODO: add check for new record
	warp "033-1.gat", 77, 34;
	set @place, -1;
//TODO: prevent that one player can be in that list more than once
	if ($FLUFFYGAME_PTS[8] < $@FLUFFY_COUNTER) set @place,8;
	if ($FLUFFYGAME_PTS[7] < $@FLUFFY_COUNTER) set @place,7;
	if ($FLUFFYGAME_PTS[6] < $@FLUFFY_COUNTER) set @place,6;
	if ($FLUFFYGAME_PTS[5] < $@FLUFFY_COUNTER) set @place,5;
	if ($FLUFFYGAME_PTS[4] < $@FLUFFY_COUNTER) set @place,4;
	if ($FLUFFYGAME_PTS[3] < $@FLUFFY_COUNTER) set @place,3;
	if ($FLUFFYGAME_PTS[2] < $@FLUFFY_COUNTER) set @place,2;
	if ($FLUFFYGAME_PTS[1] < $@FLUFFY_COUNTER) set @place,1;
	if ($FLUFFYGAME_PTS[0] < $@FLUFFY_COUNTER) set @place,0;
	if (@place != -1) callsub MOVE_NAME;

	if (@state > 1) goto L_Skip;
	if ($@FLUFFY_COUNTER < $@FLUFFY_MIN) goto L_Skip;
	set @state, 2;
	callsub S_Update_Mask;
L_Skip:
	end;
//////

S_MOVE_NAME:
    set @i,9;

MOVE_NAME_L1:
    set @i, @i-1;
    set $FLUFFYGAME_PTS[@i+1], $FLUFFYGAME_PTS[@i];
    set $FLUFFYGAME_PTS[@i+1], $FLUFFYGAME_PTS[@i];
    if (@i == @place) goto MOVE_NAME_L2;
    goto MOVE_NAME_L1;

MOVE_NAME_L2:
    set $FLUFFYGAME_PTS[@place], $@FLUFFY_COUNTER;
    set $FLUFFYGAME_NAME[@place], strcharinfo(0);
    return;

S_Update_Mask:
        set QUEST_Barbarians,
        	(QUEST_Barbarians & ~(@Q_Barbarians_MASK))
                | (@state << @Q_Barbarians_SHIFT);
        return;
}