summaryrefslogtreecommitdiff
path: root/world/map/npc/functions/barber.txt
diff options
context:
space:
mode:
authormekolat <mekolat@users.noreply.github.com>2016-01-05 10:30:44 -0500
committermekolat <mekolat@users.noreply.github.com>2016-02-08 21:04:25 -0500
commit401ff146cbd56e214007c1a298194fdef66d5a96 (patch)
tree5f4164a08fd85327cbb03387e2b6593d0306dbc4 /world/map/npc/functions/barber.txt
parent1e3050b638726ea407d28f4b860fb2b5722b069b (diff)
downloadserverdata-401ff146cbd56e214007c1a298194fdef66d5a96.tar.gz
serverdata-401ff146cbd56e214007c1a298194fdef66d5a96.tar.bz2
serverdata-401ff146cbd56e214007c1a298194fdef66d5a96.tar.xz
serverdata-401ff146cbd56e214007c1a298194fdef66d5a96.zip
remove the cruft left behind, prepare for new races
Diffstat (limited to 'world/map/npc/functions/barber.txt')
-rw-r--r--world/map/npc/functions/barber.txt87
1 files changed, 63 insertions, 24 deletions
diff --git a/world/map/npc/functions/barber.txt b/world/map/npc/functions/barber.txt
index 2c940c33..2413e0fe 100644
--- a/world/map/npc/functions/barber.txt
+++ b/world/map/npc/functions/barber.txt
@@ -4,13 +4,15 @@
// 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)
+// Note: there is a soft limit of 15 colors per classes 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
{
+ if (getequipid(equip_head) == 647)
+ goto L_Debug;
callfunc "getHeadStyles";
goto L_Main;
@@ -21,12 +23,11 @@ L_Main:
set @color$, "Unknown";
if (@style >= 1 && @style <= 20)
set @style$, @HairStyles$[(@style - 1)];
- if (Class > 1)
- set @color, (@color - (15 * Class));
+ if (@color == ((HC_WHITE - Class) + 1))
+ set @color$, "Shocked White";
+ set @color, (@color - (15 * (Class - 1)));
if (@color >= 0 && @color <= 15)
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$, "";
@@ -61,24 +62,22 @@ L_Style:
@HairStyles$[18], L_MenuItems,
@HairStyles$[19], L_MenuItems,
@HairStyles$[20], L_MenuItems,
- @HairStyles$[21], L_MenuItems,
- @HairStyles$[22], L_MenuItems,
- @HairStyles$[23], L_MenuItems,
- @HairStyles$[24], L_MenuItems,
- @HairStyles$[25], L_MenuItems;
+ @HairStyles$[21], L_MenuItems;
L_MenuItems:
if (@menu == @style)
goto L_SameStyle;
if(@menu == (getarraysize(@HairStyles$) - 1)) goto L_RandomStyle;
- if(@menu == getarraysize(@HairStyles$)) goto L_Done;
+ if(@menu >= getarraysize(@HairStyles$)) goto L_Done;
setlook LOOK_HAIR_STYLE, @menu;
goto L_Main;
L_RandomStyle:
- set @randomStyle, rand(1, (getarraysize(@HairStyles$) -4));
- if(@randomStyle == @style) goto L_RandomStyle;
- setlook LOOK_HAIR_STYLE, @randomStyle;
+ setarray @randomStyle[0], rand(1, (getarraysize(@HairStyles$) - 2));
+ setarray @randomStyle[1], @randomStyle[1] + 1; // infinite loop prevention
+ if(@randomStyle[0] == @style && @randomStyle[1] < 15) goto L_RandomStyle;
+ setlook LOOK_HAIR_STYLE, @randomStyle[0];
+ setarray @randomStyle[1], 0;
menu
"Surprise me once again", L_RandomStyle,
"Go back", L_Main,
@@ -89,7 +88,6 @@ L_SameStyle:
goto L_Main;
L_Color:
- if(@style == @BaldStyle) goto L_SameColor; // last headstyle of any class is bald
if(!@colorOpts) set @HairColors$[getarraysize(@HairColors$)], "Surprise me";
if(!@colorOpts) set @HairColors$[getarraysize(@HairColors$)], "Nah, I'm fine";
if(!@colorOpts) set @colorOpts, 1;
@@ -116,24 +114,26 @@ L_MenuItems1:
if (@menu - 1 == @color)
goto L_SameColor;
if(@menu == (getarraysize(@HairColors$) - 1)) goto L_RandomColor;
- if(@menu == getarraysize(@HairColors$)) goto L_Done;
+ if(@menu >= getarraysize(@HairColors$)) goto L_Done;
setlook LOOK_HAIR_COLOR, ((@menu - 1) + (15 * (Class - 1)));
goto L_Main;
L_RandomColor:
- set @randomColor, rand((15 * (Class - 1)), ((getarraysize(@HairColors$) -4) + (15 * (Class - 1))));
- if(@randomColor == @color) goto L_RandomColor;
- setlook LOOK_HAIR_COLOR, @randomColor;
+ setarray @randomColor[0], rand((15 * (Class - 1)), ((getarraysize(@HairColors$) - 3) + (15 * (Class - 1))));
+ setarray @randomColor[1], @randomColor[1] + 1;
+ if(@randomColor[0] == @color && @randomColor[1] < 15) goto L_RandomColor;
+ setlook LOOK_HAIR_COLOR, @randomColor[0];
+ setarray @randomColor[1], 0;
menu
"Surprise me once again", L_RandomColor,
"Go back", L_Main,
"Goodbye", L_Done;
L_SameColor:
- mes "You are either bald or your hair is already that color.";
+ mes "You already have that color.";
goto L_Main;
-S_Janitor:
+L_Done:
// cleanup
set @menu, 0;
set @style, 0;
@@ -144,7 +144,46 @@ S_Janitor:
set @colorOpts, 0;
return;
-L_Done:
- callsub S_Janitor;
- return;
+L_Debug:
+ npcaction 9; // FIXME: this should become a builtin (ie `clear`)
+ mes "Class: " + Class;
+ mes "Style: " + getlook(LOOK_HAIR_STYLE);
+ mes "Color: " + getlook(LOOK_HAIR_COLOR);
+ menu
+ "edit| Set Class", L_DebugClass,
+ "edit| Set Style", L_DebugStyle,
+ "edit| Set Color", L_DebugColor,
+ "toggle| Simulate logout", L_DebugLogout,
+ "Close", L_Done;
+
+L_DebugLogout:
+ callfunc "fixHeadStyles";
+ goto L_Debug;
+
+L_DebugClass:
+ set @dbg_class, 0;
+ mes "input class (0-32767)";
+ input @dbg_class;
+ if (@dbg_class >= 0 && @dbg_class <= 32767)
+ set Class, @dbg_class;
+ set @dbg_class, 0;
+ goto L_Debug;
+
+L_DebugStyle:
+ set @dbg_style, 0;
+ mes "input style (0-255)";
+ input @dbg_style;
+ if (@dbg_style >= 0 && @dbg_style <= 255)
+ setlook LOOK_HAIR_STYLE, @dbg_style;
+ set @dbg_style, 0;
+ goto L_Debug;
+
+L_DebugColor:
+ set @dbg_color, 0;
+ mes "input color (0-255)";
+ input @dbg_color;
+ if (@dbg_color >= 0 && @dbg_color <= 255)
+ setlook LOOK_HAIR_COLOR, @dbg_color;
+ set @dbg_color, 0;
+ goto L_Debug;
}