summaryrefslogblamecommitdiff
path: root/npc/re/quests/newgears/2012_headgears.txt
blob: c96c47edeaf1f48a59355d319a52647740b563e4 (plain) (tree)
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
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
























































































































































































































































































































































































































































































































































































































































































































































                                                                                                                                                 
//===== Hercules Script ======================================
//= 2012 Headgear Quests
//===== By: ==================================================
//= Euphy, -SkittleNugget-
//===== Current Version: =====================================
//= 1.0
//===== Description: =========================================
//= [Official Conversion]
//= Enhance gears by synthesizing them with Energy Crystals.
//===== Additional Comments: =================================
//= 1.0 First version. [Euphy]
//=     Script is a little messy, could use some cleaning.
//============================================================

// Main NPC :: 2012_hat_quest
//============================================================
moc_para01,41,169,3	script	Reno#2012hat	64,{
	// iRO has (very) minor differences in dialogue from the original script.
	// To use iRO's version, uncomment the line below.
	//.@features_iRO = 1;

	//custom translation - all checks below
	if (checkweight(Axe,1) == 0 || MaxWeight - Weight < 800) {
		mes "- Carrying too many items, cannot proceed. -";
		close;
	}

	setarray .@type$,"lower","intermediate","advanced","highest";
	setarray .@crystal$,"Rough","Purified","High";

	// playtime checks
	setarray .@quests,
		// base, first, count
		5161, 5162, 7, // Lower
		5169, 5170, 4, // Intermediate
		5174, 5175, 8; // High
	setarray .@crystal_quests, 5225,5226,5227;

	setarray .@min_level,60,80,90,100;

	// hunting quest wait time
	for (.@i = 0; .@i < getarraysize(.@quests); .@i += 3) {
		if (questprogress(.@quests[.@i],PLAYTIME) == 2) {
			erasequest .@quests[.@i];
			mes "[Reno]";
			mes "The waiting time for a "+.@type$[.@i]+" collection quest has expired."
				" You can now take another request.";
			close;
		}
	}
	// buff wait time
	for (.@i = 0; .@i < getarraysize(.@crystal_quests); ++.@i) {
		if (questprogress(.@crystal_quests[.@i],PLAYTIME) == 2) {
			erasequest .@crystal_quests[.@i];
			mes "[Reno]";
			mes "The waiting time for storing "+.@crystal$[.@i]+" Energy Crystals has expired."
				" You can now store them again.";
			close;
		}
	}

	// hunting quest checks
	callsub(S_CheckHunting, 5161, 5162, 7, .@type$[0], Rough_Energy_Crystal, 10);
	callsub(S_CheckHunting, 5169, 5170, 4, .@type$[1], Purified_Energy_Crystal, 10);
	callsub(S_CheckHunting, 5174, 5175, 4, .@type$[2], High_Purity_Energy_Xtal, 5);
	callsub(S_CheckHunting, 5174, 5179, 4, .@type$[3], High_Purity_Energy_Xtal, 10);

	// buff checks
	.@energy_buf00 = (getstatus(SC_QUEST_BUFF1) || getstatus(SC_QUEST_BUFF2) || getstatus(SC_QUEST_BUFF3));
	if (!.@energy_buf00) {
		for (.@i = 0; .@i < 3; ++.@i) {
			if (questprogress(5222 + .@i)) {
				.@item = Rough_Energy_Crystal + .@i;
				.@amount = 2 + rand(3);
				mes "[Reno]";
				mes getitemname(.@item)+" storage is now complete.";
				next;
				setquest .@crystal_quests[.@i];
				erasequest 5222 + .@i;
				getitem .@item, .@amount;
				mes "[Reno]";
				mes "^0000FF"+.@amount+" "+getitemname(.@item)+"s^000000 were extracted.";
				close;
			}
		}
	}

	mes "[Reno]";
	mes "Hi? I am Reno from the Energy Crystal Research Association, or ECRA.";
	next;
	.@opt$ = "ECRA?"
		":Quest to get Energy Crystals"
		":Energy Crystal Buffs"
		":Compress Energy Crystals"
		":Exchange Crystals for Headgear"
		":Random Gear for Crystals";
	if (.@features_iRO)
		.@opt$ += ":See Equipment List";
	switch (select(.@opt$)) {
	case 1:
		mes "[Reno]";
		mes "ECRA is the institute that researches '^0000FFEnergy Crystals^000000' that"
			" shall be used as an alternative energy source in the Rune Midgart"
			" Kingdom, which suffers from a shortage of energy.";
		next;
		select("The reason for doing this?");
		mes "[Reno]";
		mes "I would like to explain that we are not trying to make an excuse to get away"
			" from facing problem before I explain the reason. Never! So please let me"
			" finish.";
		next;
		mes "[Reno]";
		mes "The Research Team has sent me the results they found.";
		next;
		mes "[Reno]";
		mes "Energy Crystals turned out to be ^0000FFgenerated inside the bodies of some"
			" monsters^000000, and according to the research, stronger monsters"
			" generate higher-class energy crystals in their bodies.";
		next;
		mes "[Reno]";
		mes "The Research Team decided to collect Energy Crystals by giving requests to"
			" adventurers, with appropriate rewards. That enables us to collect better"
			" and be more ^FF0000efficient^000000.";
		next;
		mes "[Reno]";
		mes "Energy Crystals, accumulated through hunting monsters by my request, shall be"
			" used for my research. ^0000FFSome of them are planned to be returned to"
			" adventurers.^000000";
		next;
		mes "[Reno]";
		mes "Adventurers can use collected Energy Crystals for ^FF0000upgrading"
			" equipments^000000 through me.";
		next;
		mes "[Reno]";
		mes "If it works well, it seems to be good for both ECRA and adventurers.";
		close;
	case 2:
		mes "[Reno]";
		mes "The hunting quests are ranked by monster level and difficulty. The ranges are"
			" lower, intermediate, high quests and can only be taken once per day.";
		next;

		.@opt$ = "Lower level hunting [61-80]"
			":Intermediate level hunting [80-99]"
			":High level hunting [90 and up]"
			":Cancel my current quest.";
		.@choice = select(.@opt$) - 1;
		if (.@choice < 3) {
			if (BaseLevel < .@min_level[.@choice]) {
				mes "[Reno]";
				mes "I am sorry but the request for the "+.@type$[.@choice]
					+ " collection is only available for those level "
					+ .@min_level[.@choice] + " and higher. You do not seem to"
					" be capable of carrying out this request.";
				close;
			}
			if (callsub(S_CheckQuestStatus, .@quests[.@choice*3], .@quests[.@choice*3+1], .@quests[.@choice*3+2])) {
				mes "[Reno]";
				mes "You seem to be under the other request of "+.@type$[.@choice]
					+ " collection. If the quest seems to be too hard... how"
					" about you ^FF0000give up on the request^000000?";
				close;
			}
			if (questprogress(.@quests[.@choice*3], PLAYTIME) == 1) {
				mes "[Reno]";
				mes "Currently waiting for the "+.@type$[.@choice]+" collection"
					" commission. Tasks in each collection can only be"
					" completed once per day."; //custom translation
				close;
			}
			mes "[Reno]";
			mes "You selected to hunt a monster from the "+.@type$[.@choice]
				+ " collection. After hunting these monsters you will receive "
				+ ((.@features_iRO)?"10 ":"")+"^0000FF"+.@crystal$[.@choice]
				+ " Energy Crystals^000000 when you return to me.";
			next;
			mes "[Reno]";
			mes "Please select the monster that you think you can easily hunt from the list.";
			next;
			switch (.@choice) {
			case 0:
				.@quest = select(
					"[Lower class] Requiem",
					"[Lower class] Bathory",
					"[Lower class] Spring Rabbit",
					"[Lower class] Sleeper",
					"[Lower class] Evil Druid",
					"[Lower class] Ground Petite",
					"[Lower class] Clock"
				);
				break;
			case 1:
				.@quest = select(
					"[Intermediate class] Siroma",
					"[Intermediate class] Dark Priest",
					"[Intermediate class] Stapo",
					"[Intermediate class] Solider"
				);
				break;
			case 2:
				.@quest = select(
					"[Advanced] Desert Wolf",
					"[Advanced] Medusa",
					"[Advanced] Pinguicula",
					"[Advanced] Majoruros",
					"[Highest] Raydric",
					"[Highest] Naga",
					"[Highest] Ancient Mummy",
					"[Highest] Ancient Mimic"
				);
				if (.@quest > 4 && BaseLevel < .@min_level[3]) {
					mes "[Reno]";
					mes "I am sorry but the request for the most advanced"
						" collection is only available for those level "
						+ .@min_level[3]+" and higher. You do not seem to"
						" be capable of carrying out this request.";
					close;
				}
				break;
			}
			setquest .@quests[.@choice*3+1] + .@quest - 1;
			mes "[Reno]";
			mes "The request for "+.@type$[.@choice]+" collection monsters has been"
				" issued. Please check the details on the issued document.";
			close;
		}
		// else: Cancel
		for (.@i = 0; .@i<3; ++.@i) {
			if (callsub(S_CheckQuestStatus, .@quests[.@i*3], .@quests[.@i*3+1], .@quests[.@i*3+2])) {
				mes "[Reno]";
				mes "You are currently under the request of the "
					+.@type$[.@i]+" collection. If you give up now,"
					" all your history will be lost. Do you really"
					" want to give up?";
				next;
				if (select("Yes:No") != 1) {
					.@erase_quest = 2;
					continue;
				}
				.@erase_quest = 1;
				for (.@quest = .@quests[.@i*3+1]; .@quest < .@quests[.@i*3+1]+.@quests[.@i*3+2]; ++.@quest) {
					if (questprogress(.@quest))
						erasequest .@quest;
				}
			}
		}
		switch (.@erase_quest) {
		case 0:
			mes "[Reno]";
			mes "You are not under any request.";
		case 1:
			mes "[Reno]";
			mes "The written request for you has been withdrawn.";
		case 2:
			mes "[Reno]";
			mes "Please keep up on it.";
		}
		close;
	case 3:
		mes "[Reno]";
		mes "Do you want to accumulate Energy Crystals inside of your body to receive a buff?";
		next;
		.@choice = select("Accumulating Energy Crystals?"
				":Accumulate Rough Energy Crystal"
				":Accumulate Purified Energy Crystal"
				":Accumulate High Energy Crystal") - 1;
		if (!.@choice) {
			mes "[Reno]";
			mes "Energy Crystals are accumulated in your body when you hunt the"
				" monsters we ask you to.";
			next;
			mes "[Reno]";
			mes "Our research shows that some methods enable humans to accumulate the"
				" energy crystals inside of the body in the form of a buff.";
			next;
			mes "[Reno]";
			mes "If you spend about 3 hours, you will be able to gain a small amount"
				" of Energy Crystals. So do you want to receive the buff?";
			close;
		}
		.@quest = 5222 + .@choice;
		.@rate = 1 + .@choice;
		setarray .@buffs, SC_QUEST_BUFF1, SC_QUEST_BUFF2, SC_QUEST_BUFF3;
		if (questprogress(.@crystal_quests[.@choice], PLAYTIME) == 1) {
			mes "[Reno]";
			mes "Were you successful? While storing other Energy Crystals will not have"
				" much effect on your body, storing the same one may cause you harm."; //custom translation
			close;
		}
		if (BaseLevel < .@min_level[.@choice]) {
			mes "[Reno]";
			mes "With a body like that, you can't accumulate "+.@crystal$[.@choice]
				+" Energy Crystals. You must be level "+.@min_level[.@choice]+" or"
				" your body will be harmed in the process."; //custom translation
			close;
		}
		if (.@energy_buf00) {
			mes "[Reno]";
			mes "Accumulating Energy Crystal has already begun. I am sorry but it is"
				" impossible to accumulate two different types of Energy Crystals"
				" at a time.";
			close;
		}
		if (questprogress(.@quest) > 0) {
			erasequest .@quest;
			mes "[Reno]";
			mes "An error has occurred. Please forgive me for the inconvenience."; //custom translation
			close;
		}
		mes "[Reno]";
		mes "It takes 3 hours for your body to accumulate 2 to 4 "+.@crystal$[.@choice]
			+" Energy Crystals. Do you want to start?";
		next;
		if (select("Cancel:Start") == 1) {
			mes "[Reno]";
			mes "I recommend that you try to accumulate Energy Crystal when you have time.";
			close;
		}
		mes "[Reno]";
		mes "You might feel a slight tingle.";
		next;
		specialeffect2 EF_BASH3D;
		percentheal .@rate * -5,0;
		//consumeitem ??; //Keep_Connection_[.@rate]
		sc_start .@buffs[.@choice], 10800000, .@rate; // Atk/Matk + 5*rate (+5, +10, +15)
		setquest .@quest;
		mes "[Reno]";
		mes "- Puck -";
		next;
		mes "[Reno]";
		mes "Everything seems to be in order. Let's start accumulating "+.@crystal$[.@choice]
			+" Energy Crystals. Remember to come back to me after 3 hours to get the "
			+.@crystal$[.@choice]+" Energy Crystals.";
		close;
	case 4:
		mes "[Reno]";
		mes "Do you want to compress the Energy Crystals?";
		next;
		switch(select("What does compressing do?"
				":Compress Rough to Purified Crystal"
				":Compress Purified to High Crystal")) {
		case 1:
			mes "[Reno]";
			mes "Are you curious about Energy Crystal compression? I can compress"
				" lower level Energy Crystals into higher ones.";
			next;
			mes "[Reno]";
			mes "Here is what I can make.";
			mes "^FF000010 Rough Energy Crystals^000000 = ^FF00001 Purified Energy Crystal^000000";
			mes "^FF00005 Purified Energy Crystals^000000 = ^FF00001 High Energy Crystal^000000";
			next;
			mes "[Reno]";
			mes "If you need higher grade Energy Crystals, this is a good way to get"
				" them since the lower ones are easier to get.";
			close;
		case 2:
			.@crystal = Rough_Energy_Crystal;
			.@crystal_ = Purified_Energy_Crystal;
			.@rate = 10;
			break;
		case 3:
			.@crystal = Purified_Energy_Crystal;
			.@crystal_ = High_Purity_Energy_Xtal;
			.@rate = 5;
			break;
		}
		.@crystal_count = countitem(.@crystal);
		.@crystal_get = .@crystal_count / .@rate;
		mes "[Reno]";
		mes sprintf("^FF0000%d %s^000000 = ^FF00001 %s^000000",.@rate,getitemname(.@crystal),getitemname(.@crystal_));
		next;
		mes "[Reno]";
		mes sprintf("%d %ss will be compressed to %d %ss.",.@crystal_count,getitemname(.@crystal),.@crystal_get,getitemname(.@crystal_));
		mes "Do you want to compress?";
		next;
		if (select("Compress:Stop") == 2) {
			mes "[Reno]";
			mes "Okay, please contact if you need me in the future.";
			close;
		}
		while (true) {
			//custom translation
			if (countitem(.@crystal) < .@rate) {
				mes "[Reno]";
				mes "You don't have enough "+getitemname(.@crystal)+".";
				next;
				break;
			}
			delitem .@crystal,.@rate;
			getitem .@crystal_,1;
			.@crystal_count = countitem(.@crystal);
			.@crystal_get = .@crystal_count / .@rate;
			mes "[Reno]";
			mes "The compression was very successful.";
			mes "There are "+.@crystal_count+" Energy Crystals left, which can"
				" compress into "+.@crystal_get+" Energy Crystals. Do you"
				" want to continue?";
			next;
			if (select("Compress:Stop") == 2)
				break;
		}
		mes "[Reno]";
		mes "Compression completed.";
		close;
	case 5:
		disable_items;
		mes "[Reno]";
		mes "Do you want to exchange Energy Crystals for equipment? Please select the type"
			" of Energy Crystal that you wish to exchange.";
		next;
		switch (select("See Equipment List"
				":["+countitem(Rough_Energy_Crystal)+"] Rough Energy Crystal"
				":["+countitem(Purified_Energy_Crystal)+"] Purified Energy Crystal"
				":["+countitem(High_Purity_Energy_Xtal)+"] High Energy Crystal")) {
		case 1:
			mes "[Reno]";
			mes "This is the brochure regarding the equipment upgrade that our Energy"
				" Crystal research association provides. Please take a look around.";
			close2;
			readbook Energy_Xtal_Combi_Book,1;
			end;

		// Variable descriptions
		// .@crystal: Energy Crystal used
		// .@items:   Array of tuples <material, showslot, cost, reward>, where:
		//            material: equipment to upgrade
		//            showslot: display slots with equipment name (-1 to disable)
		//            cost:     amount of Energy Crystals needed
		//            rewards:  upgraded equipment
		case 2:
			.@crystal = Rough_Energy_Crystal;
			setarray .@items,
				// Material,showslot,cost,rewards
				Wizardry_Hat,     -1, 100, Remodel_Wizardry_Hat,
				Magician_Hat,     -1, 100, Remodel_Magician_Hat,
				Mask_Of_Fox,      -1, 100, Remodel_Mask_Of_Fox,
				Joker_Jester,     -1, 100, Remodel_Joker_Jester,
				Bunny_Band,       -1, 100, Remodel_Bunny_Band,
				Munak_Turban_,    -1, 100, Remodel_Munak_Turban,
				Bongun_Hat_,      -1, 100, Remodel_Bongun_Hat,
				Opera_Ghost_Mask, -1, 100, Remodel_Opera_Mask;
			break;
		case 3:
			.@crystal = Purified_Energy_Crystal;
			setarray .@items,
				// Material,showslot,cost,rewards
				Binoculars,         -1, 200, Improved_Binoculars,
				Fin_Helm,           -1, 200, Improved_Fin_Helm,
				Assassin_Mask_,     -1, 200, Improved_Assassin_Mask,
				Welding_Mask,       -1, 200, Improved_Welding_Mask,
				Safety_Ring,        -1, 200, Safety_Ring_,
				Angel's_Protection,  1, 100, Im_Angel's_Protection,
				Angel's_Safeguard,   1, 100, Impr_Angel's_Safeguard,
				Angel's_Arrival,     1, 100, Impr_Angel's_Arrival,
				Angel's_Warmth,      1, 100, Impr_Angel's_Warmth,
				Kiss_Of_Angel,       1, 100, Improved_Kiss_Of_Angel;
			break;
		case 4:
			.@crystal = High_Purity_Energy_Xtal;
			setarray .@items,
				// Material,showslot,cost,rewards
				Corsair,           -1,  300, Enhanced_Corsair,
				Bone_Helm_,         1,  300, Enhanced_Bone_Helm,
				Helm_Of_Angel,     -1,  300, Enhanced_Helm_Of_Angel,
				Helm_Of_Sun,        0, 1000, Enhanced_Helm_Of_Sun,
				Helm_Of_Sun_,       1,  100, Enhanced_Helm_Of_Sun,
				Variant_Shoes,     -1,  300, Enhanced_Variant_Shoes,
				Ring_Of_Flame_Lord,-1,  300, Good_Ring_Of_Flame_Lord,
				Ring_Of_Resonance, -1,  300, Good_Ring_Of_Resonance,
				Angel's_Protection, 1,   20, Im_Angel's_Protection,
				Angel's_Safeguard,  1,   20, Impr_Angel's_Safeguard,
				Angel's_Arrival,    1,   20, Impr_Angel's_Arrival,
				Angel's_Warmth,     1,   20, Impr_Angel's_Warmth,
				Kiss_Of_Angel,      1,   20, Improved_Kiss_Of_Angel;
			break;
		}

		mes "[Reno]";
		mes "Please select the equipment to exchange for "+getitemname(.@crystal)+"s.";
		next;
		.@crystal_count = countitem(.@crystal);
		.@opt$ = "";
		for (.@i = 0; .@i < getarraysize(.@items); .@i += 4) {
			.@item_name$ = getitemname(.@items[.@i]) + ((.@items[.@i+1] > -1)?"["+.@items[.@i+1]+"]":"");
			.@opt$ += sprintf("%s (%d/%d):",.@item_name$,.@crystal_count,.@items[.@i+2]);
		}
		.@index = select(.@opt$) - 1;
		.@material = .@items[.@index*4];
		.@item_name$ = getitemname(.@material) + ((.@items[.@index*4+1] > -1)?"["+.@items[.@index*4+1]+"]":"");
		.@cost = .@items[.@index*4+2];
		.@reward = .@items[.@index*4+3];

		//custom translations
		if (.@material == Safety_Ring) {
			// Special case: Safety Ring
			if (countitem(Safety_Ring) < 1 || countitem(Ring_) < 1
			 || countitem(Earring_) < 1 || countitem(Glove_) < 1
			 || countitem(Brooch_) < 1 || countitem(Necklace_) < 1
			 || countitem(Rosary_) < 1 || countitem(.@crystal) < .@cost) {
				mes "[Reno]";
				mes "The materials to make a Safety Ring[1] are insufficient."
					" Please check your inventory.";
				close;
			}
			mes "[Reno]";
			mes "Before upgrading your Safety Ring, please listen to these"
				" ^FF0000precautions^000000.";
			next;
			mes "[Reno]";
			mes "^FF0000In addition to the Safety Ring, all refinements and cards of"
				" the required materials will also disappear.^000000";
			next;
		} else {
			if (countitem(.@material) < 1 || countitem(.@crystal) < .@cost) {
				mes "[Reno]";
				mes "The materials are insufficient. Please check your materials.";
				close;
			}
			mes "[Reno]";
			mes "Before upgrading your equipment, please listen to these"
				" ^FF0000precautions^000000.";
			next;
			mes "[Reno]";
			mes "^FF0000When using Energy Crystals to upgrade equipment, all previous"
				" refinements, enchantments, and cards will be lost.^000000";
			next;
		}
		mes "[Reno]";
		mes "Are you familiar with the ^FF0000precautions^000000?";
		next;
		if (select("I am.:No.") == 2) {
			mes "[Reno]";
			mes "Okay. Next time, then.";
			close;
		}
		mes "[Reno]";
		mes "Then let's begin to upgrade "+.@item_name$+".";
		next;
		if (countitem(.@material) < 1 || countitem(.@crystal) < .@cost) {
			mes "[Reno]";
			mes "The materials are insufficient. Please check your materials.";
			close;
		}
		if (.@material == Safety_Ring) {
			// Special case: Safety Ring
			if (countitem(Safety_Ring) < 1 || countitem(Ring_) < 1
			 || countitem(Earring_) < 1 || countitem(Glove_) < 1
			 || countitem(Brooch_) < 1 || countitem(Necklace_) < 1
			 || countitem(Rosary_) < 1 || countitem(.@crystal) < .@cost) {
				mes "[Reno]";
				mes "The materials to make a Safety Ring[1] are insufficient."
					" Please check your inventory.";
				close;
			}
		}
		specialeffect2 EF_REPAIRWEAPON;
		progressbar "ffff00",2;
		delitem .@material,1;
		if (.@material == Safety_Ring) {
			delitem Ring_,1;
			delitem Earring_,1;
			delitem Glove_,1;
			delitem Brooch_,1;
			delitem Necklace_,1;
			delitem Rosary_,1;
		}
		delitem .@crystal,.@cost;
		getitem .@reward,1;
		mes "[Reno]";
		mes "The upgrade was successful. Your Energy Crystals will help our research greatly.";
		close;
	case 6:
		mes "[Reno]";
		mes "Do you want to donate Energy Crystals to get a random new headgear?";
		next;
		switch (select("Donate Energy Crystals?"
				":Donate 300 Rough Energy Crystals."
				":Donate 600 Purified Energy Crystals."
				":Donate 900 High Energy Crystals.")) {
		case 1:
			mes "[Reno]";
			mes "We are collecting Energy Crystals so that we can research more"
				" combinations of headgears for adventurers.";
			next;
			mes "[Reno]";
			mes "Thanks to the support of adventurers we can use these Energy"
				" Crystals to further our research.";
			next;
			mes "[Reno]";
			mes "So we receive a minimum of 300 Rough Energy Crystals, 600 Purified"
				" Energy Crystals, and 900 High Energy Crystals.";
			if (!.@features_iRO) {
				next;
				mes "[Reno]";
				mes "You may feel that this is a burden, but for the sake of our"
					" research, please continue."; //custom translation
				close;
			}
			mes "For the donation, I'll give you a random new headgear.";
			next;
			mes "[Reno]";
			mes "300 Rough Energy Crystals";
			mes "- New Mage Hat";
			mes "- New Magician Hat";
			mes "- New Kitsune Mask";
			mes "- New Joker Jester";
			mes "- New Bunny Band";
			mes "- New Munak Hat";
			mes "- New Bongun Hat";
			mes "- New Phantom Opera Mask";
			next;
			mes "[Reno]";
			mes "600 Purified Energy Crystals";
			mes "- Good Binoculars";
			mes "- Good Fin Helm";
			mes "- Good Assassin Mask";
			mes "- Good Welding Mask";
			mes "- Good Safety Ring";
			mes "- Good Angelic Protection";
			mes "- Good Angelic Guard";
			mes "- Good Angelic Cardigan";
			mes "- Good Angel's Reincarnation";
			next;
			mes "[Reno]";
			mes "900 High Energy Crystals";
			mes "- Enhanced Corsair";
			mes "- Enhanced Bone Helm";
			mes "- Enhanced Helm of Angel";
			mes "- Enhanced Variant Shoes";
			mes "- Enhanced Ring of Flame Lord";
			mes "- Enhanced Ring of Resonance";
			close;
		case 2:
			if (countitem(Rough_Energy_Crystal) < 300) {
				mes "[Reno]";
				mes "Thank for your support, but we need 300 Rough Energy Crystals.";
				close;
			}
			delitem Rough_Energy_Crystal,300;
			.@r = rand(1,17);
			if (.@r <= 2)       getitem Remodel_Wizardry_Hat,1;
			else if (.@r <= 4)  getitem Remodel_Magician_Hat,1;
			else if (.@r <= 6)  getitem Remodel_Mask_Of_Fox,1;
			else if (.@r <= 8)  getitem Remodel_Joker_Jester,1;
			else if (.@r <= 10) getitem Remodel_Bunny_Band,1;
			else if (.@r <= 13) getitem Remodel_Munak_Turban,1;
			else if (.@r <= 16) getitem Remodel_Bongun_Hat,1;
			else                getitem Remodel_Opera_Mask,1;
			break;
		case 3:
			if (countitem(Purified_Energy_Crystal) < 600) {
				mes "[Reno]";
				mes "Thank for your support, but we need 600 Purified Energy Crystals.";
				close;
			}
			delitem Purified_Energy_Crystal,600;
			.@r = rand(1,18);
			if (.@r <= 3)       getitem Improved_Binoculars,1;
			else if (.@r <= 6)  getitem Improved_Fin_Helm,1;
			else if (.@r <= 9)  getitem Improved_Assassin_Mask,1;
			else if (.@r <= 12) getitem Improved_Welding_Mask,1;
			else if (.@r <= 13) getitem Safety_Ring_,1;
			else if (.@r <= 14) getitem Im_Angel's_Protection,1;
			else if (.@r <= 15) getitem Impr_Angel's_Safeguard,1;
			else if (.@r <= 16) getitem Impr_Angel's_Arrival,1;
			else if (.@r <= 17) getitem Impr_Angel's_Warmth,1;
			else                getitem Improved_Kiss_Of_Angel,1;
			break;
		case 4:
			if (countitem(High_Purity_Energy_Xtal) < 900) {
				mes "[Reno]";
				mes "Thank for your support, but we need 900 High Energy Crystals.";
				close;
			}
			delitem High_Purity_Energy_Xtal,900;
			.@r = rand(1,33);
			if (.@r <= 10)      getitem Enhanced_Corsair,1;
			else if (.@r <= 20) getitem Enhanced_Bone_Helm,1;
			else if (.@r <= 25) getitem Enhanced_Helm_Of_Angel,1;
			else if (.@r <= 30) getitem Enhanced_Variant_Shoes,1;
			else if (.@r <= 31) getitem Good_Ring_Of_Flame_Lord,1;
			else                getitem Good_Ring_Of_Resonance,1;
			break;
		}
		mes "[Reno]";
		mes "Thank you very much. The Energy Crystals you donated will be greatly helpful"
			" for our research. This is your reward for your donation."; //custom translation
		close;
	case 7: // iRO only
		mes "[Reno]";
		mes "This is the brochure regarding the equipment upgrade that our Energy Crystal"
			" research association provides. Please take a look around.";
		close2;
		readbook Energy_Xtal_Combi_Book,1;
		end;
	}
	end;

// callsub(S_CheckHunting, <quest index>, <start quest>, <number of quests>, "<type>", <reward id>, <reward amount>);
S_CheckHunting:
	.@basequest = getarg(0);
	.@first = getarg(1);
	.@last = .@first + getarg(2) - 1;
	for (.@i = .@first; .@i <= .@last; ++.@i) {
		if (questprogress(.@i, HUNTING) == 2) {
			mes "[Reno]";
			mes "Finished "+ getarg(3) +" collection hunting quest.";
			next;
			setquest .@basequest;
			erasequest .@i;
			getitem getarg(4), getarg(5);
			mes "You receive "+ getarg(5) +" "+ getitemname(getarg(4)) +" as the "+ getarg(3) +" collection reward.";
			close;
		}
	}
	return;

// callsub(S_CheckQuestStatus, <quest index>, <start quest>, <number of quests>
S_CheckQuestStatus:
	.@basequest = getarg(0);
	.@first = getarg(1);
	.@last = .@first + getarg(2) - 1;
	.@status = false;
	for (.@i = .@first; .@i <= .@last; ++.@i) {
		if (questprogress(.@i))
			return true;
	}
	return false;
}