summaryrefslogtreecommitdiff
path: root/world/map/npc/functions/barber.txt
blob: dc7f0329dae194d4112faa73b8218015766d4f0d (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
// The Barber script has been around since before the repository split
// so it's hard to figure out who wrote it.

// o11c updated it according to new scripting standards while adding pink.
// ... and added the code that shows your old color/style.

// Note: there is a soft limit of 12 colors (0-11) and 20 styles (0-19)
// This is the number that can be set when creating a character
// or using GM commands, but scripts (such as this one) can set
// any value 0-255

function|script|Barber|,
{
    set @style, getlook(LOOK_HAIR_STYLE);
    set @color, getlook(LOOK_HAIR_COLOR);

    set @style$, "Unknown";
    set @color$, "Unknown";
    if (@style >= 0 && @style < 20)
        set @style$, $@HairStyles$[@style];
    if (@color >= 0 && @color < 20)
        set @color$, $@HairColors$[@color];
    if (@color == 127)
        set @color$, "Shocked White";

    mes "Your current style is " + @style$ + " and your current color is " + @color$ + ".";
    set @style$, "";
    set @color$, "";

L_Main:
    menu
        "Change my style", L_Style,
        "Change my color", L_Color,
        "Nah, I'm fine", L_Done;

L_Style:
    menu
        "Bald", -,
        "Flat ponytail", -,
        "Bowl cut", -,
        "Combed back", -,
        "Emo", -,
        "Mohawk", -,
        "Pompadour", -,
        "Center parting/Short and slick", -,
        "Long and slick", -,
        "Short and curly", -,
        "Pigtails", -,
        "Long and curly", -,
        "Parted", -,
        "Perky ponytail", -,
        "Wave", -,
        "Mane", -,
        "Bun", -,
        "Shoulder Length Flick", -,
        "Fizzy", -,
        "Long and Clipped", -,
        "Surprise me", L_RandomStyle,
        "Nah, I'm fine", L_Done;

    if (@menu - 1 == @style)
        goto L_SameStyle;

    setlook LOOK_HAIR_STYLE, @menu - 1;
    goto L_Done;

L_RandomStyle:
    setlook LOOK_HAIR_STYLE, rand(20);
    goto L_Done;

L_SameStyle:
    mes "Your hair already has that style.";
    goto L_Main;

L_Color:
    menu
        "Brunette", -,
        "Green", -,
        "Dark red", -,
        "Light purple", -,
        "Gray", -,
        "Blonde", -,
        "Teal", -,
        "Light red", -,
        "Blue", -,
        "Dark purple", -,
        "Black", -,
        "Pink", -,
        "Brown", -,
        "Surprise me", L_RandomColor,
        "Nah, I'm fine", L_Done;

    if (@menu - 1 == @color)
        goto L_SameColor;

    setlook LOOK_HAIR_COLOR, @menu - 1;
    goto L_Done;

L_RandomColor:
    setlook LOOK_HAIR_COLOR, rand(13);
    goto L_Done;

L_SameColor:
    mes "Your hair is already that color.";
    goto L_Main;

L_Done:
    // cleanup
    set @menu, 0;
    set @style, 0;
    set @color, 0;
    return;
}

// Since this is a function, not an NPC, OnInit doesn't work
// So call this from a real NPC's OnInit (001-1/barber.txt)
function|script|OnInitBarber|,
{
    setarray $@HairStyles$,
        "Bald", "Flat ponytail", "Bowl cut", "Combed back", "Emo", "Mohawk",
        "Pompadour", "Center parting/Short and slick", "Long and slick",
        "Short and curly", "Pigtails", "Long and curly", "Parted",
        "Perky ponytail", "Wave", "Mane", "Bun", "Shoulder Length Flick",
        "Fizzy", "Long and Clipped";
    setarray $@HairColors$,
        "Brunette", "Green", "Dark red", "Light purple", "Gray", "Blonde",
        "Teal", "Light red", "Blue", "Dark purple", "Black", "Pink",
        "Brown";
    return;
}