summaryrefslogtreecommitdiff
path: root/npc/custom/eAAC_Scripts/kafraExpress/ke_dye.txt
blob: 735ef5465b2aad1476ba7c76530e4434698a4f50 (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
//===== eAthena Script =======================================
//= Kafra Express - Stylist Module
//===== By: ==================================================
//= Skotlex
//===== Current Version: =====================================
//= 1.9
//===== Compatible With: =====================================
//= eAthena SVN 3424+
//===== Description: =========================================
//= Part of the Kafra Express Script Package.
//= Offers dying of hair, clothes and hair-style adjusts
//===== Additional Comments: =================================
//= See config.txt for configuration.
//============================================================

-	script	keInit_dye	-1,{
OnInit:	//Load Config
	donpcevent "keConfig::OnLoadDye";
	end;
}

function	script	F_keStylist	{

	function SF_inputpalette;
	function SF_wheelpalette;

	set @jobClass,callfunc("GF_getJobLevel",class);
	set @maxCDye,0;
	
	switch (@jobClass) {
	case 0:
		set @maxCDye, $@kedy_clothJN;
		break;
	case 1:
		set @maxCDye, $@kedy_clothJ1ST;
		break;
	case 2:
		set @maxCDye, $@kedy_clothJ2ND;
		break;
	case 3:	
		set @maxCDye, $@kedy_clothJSN;
		break;
	case 4:
		set @maxCDye, $@kedy_clothJWED;
		break;
	}
	do {
		if ($@kedy_enableHairstyle) {
			set @kmenu, select(
				"- Return",
				"- Change hairstyle (current is "+getlook(1)+"/max is "+$@kedy_styles+")",
				"- Change hairstyle (by wheel)",
				"- Dye hair (current is "+getlook(6)+"/max is "+$@kedy_hair+")",
				"- Dye hair (by wheel)",
				"- Dye clothes (current is "+getlook(7)+"/max is "+@maxCDye+")",
				"- Dye clothes (by wheel)"
			);
		} else {
			set @kmenu, select(
				"- Return",
				"- Dye hair (current is "+getlook(6)+"/max is "+$@kedy_hair+")",
				"- Dye hair (by wheel)",
				"- Dye clothes (current is "+getlook(7)+"/max is "+@maxCDye+")",
				"- Dye clothes (by wheel)"
			);
			if (@kmenu > 1)
				set @kmenu, @kmenu+2;
		}
		switch (@kmenu) {
		case 2:	//Hair Style Input
			SF_inputpalette 1,$@kedy_styles;
			break;
		case 3:	//Hair Style Wheel
			SF_wheelpalette 1,$@kedy_styles;
			break;
		case 4:	//Hair Dye Input
			SF_inputpalette 6,$@kedy_hair;
			break;
		case 5:	//Hair Dye Wheel
			SF_wheelpalette 6,$@kedy_hair;
			break;
		case 6:	//Clothes Input
			SF_inputpalette 7,@maxCDye;
			break;
		case 7:	//Clothes Wheel
			SF_wheelpalette 7,@maxCDye ;
			break;
		}
	} while (@kmenu > 1);
	return;
	
//Subfunction: SF_inputpalette(int part, int maxPalette)
//Sets a palette from the user's request.
function	SF_inputpalette {
	input @pal;
	if (@pal < 0 || @pal > getarg(1)) {
		callfunc "F_keIntro", e_swt2, "Sorry, we do not have that dye available.";
		return;
	}
	setlook getarg(0),@pal;
	emotion e_lv;
}	//SF_ end

//Subfunction: SF_wheelpalette(int part, int maxPalette)
//Sets a palette through browsing.
function	SF_wheelpalette {
	set @loc, getarg(0);
	set @max, getarg(1);
	set @pal, getlook(@loc);
	set @dir, 1;
	do {
		if (@dir > 0)
			set @submenu, select(
				"Next",
				"Previous",
				"Done (current is "+@pal+")"
			);
		else
			set @submenu, select(
				"Previous",
				"Next",
				"Done (current is "+@pal+")"
			);
		switch (@submenu) {
		case 2: //Swap direction
			set @dir, @dir*-1;
		case 1:
			set @pal, @pal+@dir;
			if (@pal < 0)
				set @pal, @max;
			else if (@pal > @max)
				set @pal, 0;
			setlook @loc,@pal;
		}
	} while (@submenu != 3);
	emotion e_lv2;
}	//SF_ end

}