summaryrefslogtreecommitdiff
path: root/npc/functions/barber.txt
diff options
context:
space:
mode:
Diffstat (limited to 'npc/functions/barber.txt')
-rwxr-xr-x[-rw-r--r--]npc/functions/barber.txt425
1 files changed, 213 insertions, 212 deletions
diff --git a/npc/functions/barber.txt b/npc/functions/barber.txt
index d5a330f2..8b83fe6a 100644..100755
--- a/npc/functions/barber.txt
+++ b/npc/functions/barber.txt
@@ -1,220 +1,221 @@
-// Evol scripts.
-// Authors:
-// omatt
-// Reid
-// Travolta
-// Jesusalva
-// Description:
-// Function for supporting barber NPC.
-
-// BarberSayStyle({what})
-// what: 1 = Style; 2 = Color; 3 = Style + Color in dialog
-function script BarberSayStyle {
-
- .@get_color = getlook(LOOK_HAIR_COLOR);
- .@get_look = getlook(LOOK_HAIR);
- .@style_name$ = $@hairstyle$[.@get_look];
- .@color_name$ = $@haircolor$[.@get_color];
-
- switch (getarg(0, 3))
- {
- case 1:
- message strcharinfo(0), l("@@", .@style_name$);
- break;
- case 2:
- message strcharinfo(0), l("@@", .@color_name$);
- break;
- case 3:
- speech S_FIRST_BLANK_LINE | S_LAST_NEXT,
- l("Your hairstyle is @@ and its color is @@.", .@style_name$, .@color_name$);
- break;
- }
- return;
-}
-function script BarberChangeStyle {
- do
- {
- .@hairsizearray = getarraysize($@hairstyle$);
- .@get_look = getlook(LOOK_HAIR);
-
- // Here .@i starts from 1 because hairstyle 0 doesn't exist.
- for (.@i = 1; .@i < .@hairsizearray; .@i++)
- {
- .@menustr$ = .@menustr$
- + rif(.@get_look != .@i, l("" + $@hairstyle$[.@i] + ""))
- + ":";
- }
-
- .@menustr$ = .@menustr$ + l("I'm fine for now, thank you.");
-
- .@idx = select(l("As you want!"),.@menustr$);
-
- if (.@idx == .@i + 1) return; // last choice to quit dialog
-
- switch (@menu)
- {
- case 1:
- do
- {
- // here "- 1" because i don't use the 0 of array
- .@rand_hair = rand(1,(.@hairsizearray - 1));
- } while (.@rand_hair == getlook(LOOK_HAIR));
- setlook LOOK_HAIR, .@rand_hair;
- setlook LOOK_HAIR_COLOR, getlook(LOOK_HAIR_COLOR);
- BarberSayStyle(1);
- break;
- default:
- // and here "- 1" because the first choice is taken by the random
- setlook LOOK_HAIR, (@menu - 1);
- setlook LOOK_HAIR_COLOR, getlook(LOOK_HAIR_COLOR);
- break;
- }
- .@menustr$ = "";
- } while (1);
-}
-function script BarberChangeColor {
- do
- {
- .@get_look = getlook(LOOK_HAIR_COLOR);
- .@hairsizearray = getarraysize($@haircolor$);
-
- for (.@i = 0; .@i < .@hairsizearray; .@i++)
- {
- .@menustr$ = .@menustr$
- + rif(.@get_look != .@i, l("" + $@haircolor$[.@i] + ""))
- + ":";
- }
-
- .@menustr$ = l("Surprise me!") + ":" + .@menustr$ + l("I'm fine for now, thank you.");
-
- .@idx = select(.@menustr$);
-
- if (.@idx == .@i + 2) return;
-
- switch (@menu)
- {
- case 1:
- do
- {
- .@rand_color = rand(0, .@hairsizearray);
- } while (.@rand_color == getlook(LOOK_HAIR_COLOR));
- setlook LOOK_HAIR_COLOR, .@rand_color;
- BarberSayStyle(2);
- break;
- default:
- setlook LOOK_HAIR_COLOR, (@menu - 2);
- break;
- }
- .@menustr$ = "";
- } while (1);
- return;
-}
-function script BarberChangeBodyType {
- mesn("Note");
- mes(b(l("Changing your body type will send you back to the character selection screen.")));
- next();
-
- mes(l("Please select the desired body type:"));
- menuint(
- rif(BodyType == BODYTYPE_1, "► ") + l("Body type %i", 1), BODYTYPE_1,
- rif(BodyType == BODYTYPE_2, "► ") + l("Body type %i", 2), BODYTYPE_2,
- rif(BodyType == BODYTYPE_3, "► ") + l("Body type %i", 3), BODYTYPE_3);
-
- if (BodyType == @menuret) {
- return; // don't kick to char selection when not needed
- }
-
- // FIXME: when manaplus supports seamless changing for evol2, use a simple return;
- closedialog();
- close2();
- BodyType = @menuret;
- close;
-}
+function script Barber {
+ if (getequipid(equip_head) == 647)
+ goto L_Debug;
+ callfunc "getHeadStyles";
+ goto L_Main;
+
+L_Main:
+ @style = getlook(LOOK_HAIR_STYLE);
+ @color = getlook(LOOK_HAIR_COLOR);
+ @style$ = "Unknown";
+ @color$ = "Unknown";
+ if (@style >= 1 && @style <= 20)
+ @style$ = @HairStyles$[(@style - 1)];
+ if (@color == ((HC_WHITE - Class) + 1))
+ @color$ = "Shocked White";
+ @color = (@color - (15 * (Class - 1)));
+ if (@color >= 0 && @color <= 15)
+ @color$ = @HairColors$[@color];
+ mes "Your current style is " + @style$ + " and your current color is " + @color$ + ".";
+ @style$ = "";
+ @color$ = "";
+ menu
+ "Change my style", L_Style,
+ "Change my color", L_Color,
+ "Change my gender", L_Gender,
+ "Nah, I'm fine", L_Done;
+
+L_Gender:
+ menu
+ "Female.", L_Female,
+ "Male.", L_Male,
+ "Non-binary.", L_NonBinary,
+ "Nah, I'm fine", L_Done;
+
+L_Female:
+ @Sex = 0;
+ goto L_Change;
+
+L_Male:
+ @Sex = 1;
+ goto L_Change;
+
+L_NonBinary:
+ @Sex = 3;
+ goto L_Change;
+
+L_Change:
+ if (Sex == @Sex)
+ goto L_Already_Change;
+ Sex = @Sex;
+ return;
-// THIS FUNCTION SHOULD BE USED ONLY AT REBIRTH
-// Unless current game development design changes!
-function script BarberChangeRace {
-
- mes l("What's your race?");
- menuint
- get_race(GETRACE_FULL, KaizeiTalpan), KaizeiTalpan,
- get_race(GETRACE_FULL, ArgaesTalpan), ArgaesTalpan,
- get_race(GETRACE_FULL, TonoriTalpan), TonoriTalpan,
- get_race(GETRACE_FULL, CaveUkar), CaveUkar,
- get_race(GETRACE_FULL, MountainUkar), MountainUkar,
- get_race(GETRACE_FULL, SeaTritan), SeaTritan,
- get_race(GETRACE_FULL, LakeTritan), LakeTritan,
- rif(REBIRTH, get_race(GETRACE_FULL, LightRaijin)), LightRaijin,
- rif(REBIRTH, get_race(GETRACE_FULL, DarkRaijin)), DarkRaijin,
- rif(REBIRTH, get_race(GETRACE_FULL, FireKralog)), FireKralog,
- rif(REBIRTH, get_race(GETRACE_FULL, FrostKralog)), FrostKralog;
-
- mes "";
- // Something went *terribly* wrong
- if (@menuret >= LightRaijin && !REBIRTH) {
- channelmes("#irc", "Illegal operation at BarberChangeRace, sysadmin help required.");
- consolemes(CONSOLEMES_ERROR, "Account %d tried to change race to %d but rebirth is not set. Race not changed.", getcharid(3), @menuret);
- return;
- }
-
- // Change race and we're done
- //Class = @menuret;
- jobchange(@menuret); // STUPID idea, but imposed by Hercules
+L_Already_Change:
+ mes "\"Umm, you are that gender already.\"";
return;
-}
-// Jack of all trades
-// Barber({intro=True})
-function script Barber {
- if (getarg(0, true)) {
- mesn;
- mesq l("Hello.");
- next;
- }
- mesq l("What would you like me to do?");
- next;
- do
- {
- select
- l("What is my current hairstyle and hair color?"),
- l("I'd like to get a different style."),
- l("Can you do something with my color?"),
- l("How about changing my body type?"),
- l("I'm fine for now, thank you.");
-
- switch (@menu)
- {
- case 1:
- BarberSayStyle();
- break;
- case 2:
- BarberChangeStyle;
- speech S_FIRST_BLANK_LINE | S_LAST_NEXT,
- l("Enjoy your new style."),
- l("Anything else?");
- break;
- case 3:
- BarberChangeColor;
- speech S_FIRST_BLANK_LINE | S_LAST_NEXT,
- l("I hope you like this color."),
- l("Anything else?");
- break;
- case 4:
- BarberChangeBodyType();
- speech S_FIRST_BLANK_LINE | S_LAST_NEXT,
- l("You look fantastic."),
- l("Anything else?");
- break;
- case 5:
- speech S_FIRST_BLANK_LINE | S_LAST_NEXT,
- l("Feel free to come visit me another time.");
-
- goodbye;
- }
- } while (true);
+L_Style:
+ if(!@hairOpts) set @HairStyles$[getarraysize(@HairStyles$)], "Surprise me";
+ if(!@hairOpts) set @HairStyles$[getarraysize(@HairStyles$)], "Nah, I'm fine";
+ if(!@hairOpts) set @hairOpts, 1;
+ menu
+ @HairStyles$[0], L_MenuItems,
+ @HairStyles$[1], L_MenuItems,
+ @HairStyles$[2], L_MenuItems,
+ @HairStyles$[3], L_MenuItems,
+ @HairStyles$[4], L_MenuItems,
+ @HairStyles$[5], L_MenuItems,
+ @HairStyles$[6], L_MenuItems,
+ @HairStyles$[7], L_MenuItems,
+ @HairStyles$[8], L_MenuItems,
+ @HairStyles$[9], L_MenuItems,
+ @HairStyles$[10], L_MenuItems,
+ @HairStyles$[11], L_MenuItems,
+ @HairStyles$[12], L_MenuItems,
+ @HairStyles$[13], L_MenuItems,
+ @HairStyles$[14], L_MenuItems,
+ @HairStyles$[15], L_MenuItems,
+ @HairStyles$[16], L_MenuItems,
+ @HairStyles$[17], L_MenuItems,
+ @HairStyles$[18], L_MenuItems,
+ @HairStyles$[19], L_MenuItems,
+ @HairStyles$[20], 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;
+ setlook LOOK_HAIR_STYLE, @menu;
+ goto L_Main;
+
+L_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,
+ "Goodbye", L_Done;
+
+L_SameStyle:
+ mes "Your hair already has that style.";
+ goto L_Main;
+
+L_Color:
+ if(!@colorOpts) set @HairColors$[getarraysize(@HairColors$)], "Surprise me";
+ if(!@colorOpts) set @HairColors$[getarraysize(@HairColors$)], "Nah, I'm fine";
+ if(!@colorOpts) set @colorOpts, 1;
+ menu
+ @HairColors$[0], L_MenuItems1,
+ @HairColors$[1], L_MenuItems1,
+ @HairColors$[2], L_MenuItems1,
+ @HairColors$[3], L_MenuItems1,
+ @HairColors$[4], L_MenuItems1,
+ @HairColors$[5], L_MenuItems1,
+ @HairColors$[6], L_MenuItems1,
+ @HairColors$[7], L_MenuItems1,
+ @HairColors$[8], L_MenuItems1,
+ @HairColors$[9], L_MenuItems1,
+ @HairColors$[10], L_MenuItems1,
+ @HairColors$[11], L_MenuItems1,
+ @HairColors$[12], L_MenuItems1,
+ @HairColors$[13], L_MenuItems1,
+ @HairColors$[14], L_MenuItems1,
+ @HairColors$[15], L_MenuItems1,
+ @HairColors$[16], L_MenuItems1;
+
+L_MenuItems1:
+ if (@menu - 1 == @color)
+ goto L_SameColor;
+ if(@menu == (getarraysize(@HairColors$) - 1)) goto L_RandomColor;
+ if(@menu >= getarraysize(@HairColors$)) goto L_Done;
+ setlook LOOK_HAIR_COLOR, ((@menu - 1) + (15 * (Class - 1)));
+ goto L_Main;
+
+L_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 already have that color.";
+ goto L_Main;
+
+L_Done:
+ // cleanup
+ @menu = 0;
+ @style = 0;
+ @color = 0;
+ cleararray @HairStyles$, "", getarraysize(@HairStyles$);
+ cleararray @HairColors$, "", getarraysize(@HairColors$);
+ @hairOpts = 0;
+ @colorOpts = 0;
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);
+ mes "Gender: " + Sex;
+ menu
+ "edit| Set Class", L_DebugClass,
+ "edit| Set Style", L_DebugStyle,
+ "edit| Set Color", L_DebugColor,
+ "edit| Set Gender", L_DebugGender,
+ "toggle| Simulate logout", L_DebugLogout,
+ "Close", L_Done;
+
+L_DebugLogout:
+ callfunc "fixHeadStyles";
+ goto L_Debug;
+
+L_DebugClass:
+ @dbg_class = 0;
+ mes "input class (0-32767)";
+ input @dbg_class;
+ if (@dbg_class >= 0 && @dbg_class <= 32767)
+ Class = @dbg_class;
+ @dbg_class = 0;
+ goto L_Debug;
+
+L_DebugStyle:
+ @dbg_style = 0;
+ mes "input style (0-255)";
+ input @dbg_style;
+ if (@dbg_style >= 0 && @dbg_style <= 255)
+ setlook LOOK_HAIR_STYLE, @dbg_style;
+ @dbg_style = 0;
+ goto L_Debug;
+
+L_DebugColor:
+ @dbg_color = 0;
+ mes "input color (0-255)";
+ input @dbg_color;
+ if (@dbg_color >= 0 && @dbg_color <= 255)
+ setlook LOOK_HAIR_COLOR, @dbg_color;
+ @dbg_color = 0;
+ goto L_Debug;
+
+L_DebugGender:
+ @dbg_gender = 0;
+ mes "input gender (0-3)";
+ input @dbg_gender;
+ if (@dbg_gender >= 0 && @dbg_gender <= 3)
+ Sex = @dbg_gender;
+ @dbg_gender = 0;
+ goto L_Debug;
+}