summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--world/map/db/const.txt40
-rw-r--r--world/map/npc/commands/_atcommand_local.txt12
-rw-r--r--world/map/npc/functions/announcements.txt5
-rw-r--r--world/map/npc/functions/barber.txt87
-rw-r--r--world/map/npc/functions/global_event_handler.txt2
-rw-r--r--world/map/npc/functions/headstyles.txt120
-rw-r--r--world/map/npc/items/mirror.txt21
-rw-r--r--world/map/npc/items/scissors.txt6
-rw-r--r--world/map/npc/items/shock_sweet.txt2
9 files changed, 184 insertions, 111 deletions
diff --git a/world/map/db/const.txt b/world/map/db/const.txt
index af5cc476..71f1f06c 100644
--- a/world/map/db/const.txt
+++ b/world/map/db/const.txt
@@ -209,26 +209,26 @@ LOOK_MISC2 13
// Hairstyles
HS_Bald 0
-HS_FlatPonytail 1
-HS_BowlCut 2
-HS_CombedBack 3
-HS_Emo 4
-HS_Mohawk 5
-HS_Pompadour 6
-HS_CenterParting 7
-HS_LongAndSlick 8
-HS_ShortAndCurly 9
-HS_Pigtails 10
-HS_LongAndCurly 11
-HS_Parted 12
-HS_PerkyPonytail 13
-HS_Wave 14
-HS_Mane 15
-HS_Bun 16
-HS_ShoulderLengthFlick 17
-HS_Fizzy 18
-HS_LongAndClipped 19
-HS_BaldTwo 20
+HS_BaldTwo 1
+HS_FlatPonytail 2
+HS_BowlCut 3
+HS_CombedBack 4
+HS_Emo 5
+HS_Mohawk 6
+HS_Pompadour 7
+HS_CenterParting 8
+HS_LongAndSlick 9
+HS_ShortAndCurly 10
+HS_Pigtails 11
+HS_LongAndCurly 12
+HS_Parted 13
+HS_PerkyPonytail 14
+HS_Wave 15
+HS_Mane 16
+HS_Bun 17
+HS_ShoulderLengthFlick 18
+HS_Fizzy 19
+HS_LongAndClipped 20
// Hair Colors
HC_LIGHT_BROWN 0
diff --git a/world/map/npc/commands/_atcommand_local.txt b/world/map/npc/commands/_atcommand_local.txt
deleted file mode 100644
index a195d580..00000000
--- a/world/map/npc/commands/_atcommand_local.txt
+++ /dev/null
@@ -1,12 +0,0 @@
--|script|GM|32767
-{
- end;
-
-OnInit:
- // define permissions here
- set .zeny, G_ADMIN;
-
- // permissions for events
- set .killthegm, G_EVENT;
- end;
-}
diff --git a/world/map/npc/functions/announcements.txt b/world/map/npc/functions/announcements.txt
index dd56eadc..0a62e144 100644
--- a/world/map/npc/functions/announcements.txt
+++ b/world/map/npc/functions/announcements.txt
@@ -178,9 +178,8 @@ function|script|getBroadcast
goto L_ReturningPlayer;
L_NewPlayer:
- // todo: show game rules on login (in another PR)
- // ... does not look like it work.. the `menu`
- // builtin behaves weirdly when on login
+ // todo: show game rules on login
+ // FIXME: needs to spawn a 32767 puppet
goto L_Return;
L_ReturningPlayer:
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;
}
diff --git a/world/map/npc/functions/global_event_handler.txt b/world/map/npc/functions/global_event_handler.txt
index 7d380b0c..d5c20b06 100644
--- a/world/map/npc/functions/global_event_handler.txt
+++ b/world/map/npc/functions/global_event_handler.txt
@@ -9,7 +9,7 @@
OnPCLoginEvent:
set @login_event, 1;
- callfunc "getHeadStyles"; // converts class, color and hair
+ callfunc "fixHeadStyles"; // convert headstyles
callfunc "ClearVariables"; // removes / converts old variables
callfunc "DisplayMOTD"; // send the motd to the client, if enabled
callfunc "getBroadcast"; // get the scheduled broadcast, if any
diff --git a/world/map/npc/functions/headstyles.txt b/world/map/npc/functions/headstyles.txt
index 9645d339..4eae0862 100644
--- a/world/map/npc/functions/headstyles.txt
+++ b/world/map/npc/functions/headstyles.txt
@@ -1,46 +1,94 @@
// headstyles config file
// author: meko
+function|script|fixHeadStyles
+{
+ if (Class < 1 || Class > 5) // usable classes
+ set Class, 1; // it is impossible to use custom styling for class 0 in m+ so default is 1
+
+ callfunc "getHeadStyles";
+ set @style, getlook(LOOK_HAIR_STYLE); // FIXME: this needs to be a param in the future
+ set @color, getlook(LOOK_HAIR_COLOR); // FIXME: this needs to be a param in the future
+ if (@style < 1 || @style > getarraysize(@HairStyles$)) // leftover from previous attempt at classes
+ setlook LOOK_HAIR_STYLE, 1; // FIXME: this needs to be a param in the future
+ if (@color == HC_WHITE && Class > 1) // convert shock white
+ set @color, (HC_WHITE - Class) + 1;
+ if (@color < 105 && ((@color - (15 * (Class - 1))) < 0 || @color > ((15 * (Class - 1)) + (getarraysize(@HairColors$) - 1))))
+ set @color, 15 * (Class - 1); // it is possible to style color 0 but not style 0 since style is treated as an item
+ setlook LOOK_HAIR_COLOR, @color; // FIXME: this needs to be a param in the future
+ return;
+}
+
function|script|getHeadStyles
{
- set @HairStyles$, 0;
- set @HairColors$, 0;
- set @BaseClass, 1; // this is the default class
cleararray @HairStyles$, "", getarraysize(@HairStyles$);
cleararray @HairColors$, "", getarraysize(@HairColors$);
- cleararray @ValidClasses, "", getarraysize(@ValidClasses);
- setarray @ValidClasses, 1; // add new classes here
- set @loop, 0;
- goto L_LoopValid;
-
-L_Janitor:
- set @BaldStyle, getarraysize(@HairStyles$); // we set it as a variable because we use it with the barber
- if(getlook(LOOK_HAIR_STYLE) < 1) setlook LOOK_HAIR_STYLE, @BaldStyle; // the last head of any race has no hair/fins/whatever
+
+ if (Class == 2) goto L_Tritan;
+ elif (Class == 3) goto L_Ifriton;
+ elif (Class == 4) goto L_Gispaan;
+ elif (Class == 5) goto L_Sparron;
+ else set Class, 1; // we can not style custom classes, so reset when using the barber
+ goto L_Talpan;
+
+L_Talpan:
+ setarray @HairStyles$[0],
+ "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$[0],
+ "Brunette", "Green", "Dark red", "Light purple", "Gray", "Blonde",
+ "Teal", "Light red", "Blue", "Dark purple", "Black", "Pink",
+ "Brown";//, "(free slot)", "(free slot)";
return;
-L_LoopValid: // here we fix non-existant classes
- if(@ValidClasses[@loop] == Class) goto L_ValidClass;
- set @loop, (@loop + 1);
- if(@loop >= getarraysize(@ValidClasses)) goto L_FixClass;
- goto L_LoopValid;
-
-L_FixClass:
- set Class, @BaseClass;
- goto L_ValidClass;
-
-L_ValidClass:
- if(Class == 1)
- setarray @HairStyles$, // TALPONIAN (human)
- "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", "Bald";
- if(Class == 1)
- setarray @HairColors$, // TALPONIAN (human)
- "Brunette", "Green", "Dark red", "Light purple", "Gray", "Blonde",
- "Teal", "Light red", "Blue", "Dark purple", "Black", "Pink",
- "Brown";//, "(free slot)", "(free slot)";
- // adding a new species is as simple as adding another if(Class == X) and adding the class to @ValidClasses
- goto L_Janitor;
+L_Tritan:
+ setarray @HairStyles$[0],
+ "1", "2", "3", "4", "5",
+ "6", "7", "8", "9", "10",
+ "11", "12", "13", "14", "15",
+ "16", "17", "18", "19", "20";
+ setarray @HairColors$[0],
+ "1", "2", "3", "4", "5",
+ "6", "7", "8", "9", "10",
+ "11", "12", "13", "14", "15";
+ return;
+
+L_Gispaan:
+ setarray @HairStyles$[0],
+ "1", "2", "3", "4", "5",
+ "6", "7", "8", "9", "10",
+ "11", "12", "13", "14", "15",
+ "16", "17", "18", "19", "20";
+ setarray @HairColors$[0],
+ "1", "2", "3", "4", "5",
+ "6", "7", "8", "9", "10",
+ "11", "12", "13", "14", "15";
+ return;
+
+L_Sparron:
+ setarray @HairStyles$[0],
+ "1", "2", "3", "4", "5",
+ "6", "7", "8", "9", "10",
+ "11", "12", "13", "14", "15",
+ "16", "17", "18", "19", "20";
+ setarray @HairColors$[0],
+ "1", "2", "3", "4", "5",
+ "6", "7", "8", "9", "10",
+ "11", "12", "13", "14", "15";
+ return;
+
+L_Ifriton:
+ setarray @HairStyles$[0],
+ "1", "2", "3", "4", "5",
+ "6", "7", "8", "9", "10",
+ "11", "12", "13", "14", "15",
+ "16", "17", "18", "19", "20";
+ setarray @HairColors$[0],
+ "1", "2", "3", "4", "5",
+ "6", "7", "8", "9", "10",
+ "11", "12", "13", "14", "15";
+ return;
}
diff --git a/world/map/npc/items/mirror.txt b/world/map/npc/items/mirror.txt
index dcca9398..c5dc5525 100644
--- a/world/map/npc/items/mirror.txt
+++ b/world/map/npc/items/mirror.txt
@@ -1,20 +1,19 @@
function|script|useMirror
{
- callfunc "getHeadStyles";
- goto L_Rand;
+ callfunc "getHeadStyles";
+ goto L_Rand;
- L_Rand:
- set @style, rand(1,(getarraysize(@HairStyles$) -2));
- set @color, rand((15 * (Class - 1)),((getarraysize(@HairColors$) -2) + (15 * (Class - 1))));
- if((getlook(LOOK_HAIR_STYLE) == @style) || (getlook(LOOK_HAIR_COLOR) == @color))
- goto L_Rand;
- goto L_Proceed;
-
- L_Proceed:
+L_Rand:
+ set @mirror_rnd, @mirror_rnd + 1;
+ set @style, rand(1,getarraysize(@HairStyles$));
+ set @color, rand((15 * (Class - 1)),((15 * (Class - 1)) + (getarraysize(@HairColors$) - 1)));
+ if(((getlook(LOOK_HAIR_STYLE) == @style) || (getlook(LOOK_HAIR_COLOR) == @color)) && @mirror_rnd < 15)
+ goto L_Rand;
if(@fixedMirror)
- setlook LOOK_HAIR_STYLE, @style;
+ setlook LOOK_HAIR_STYLE, @style;
setlook LOOK_HAIR_COLOR, @color;
//if(!@fixedMirror) getitem "SilverMirror", 1; <== this can be used in the future to have a portable hair color changer (like scissors but for the color)
set @fixedMirror, 0;
+ set @mirror_rnd, 0;
return;
}
diff --git a/world/map/npc/items/scissors.txt b/world/map/npc/items/scissors.txt
index 640cc1c5..fbf3b344 100644
--- a/world/map/npc/items/scissors.txt
+++ b/world/map/npc/items/scissors.txt
@@ -1,14 +1,14 @@
function|script|useScissors
{
+ getitem "Scissors", 1;
if (rand(3))
goto L_Change;
message strcharinfo(0), "Whoops!";
heal -20 - rand(Hp >> 1), 0;
- getitem "Scissors", 1;
return;
L_Change:
- setlook LOOK_HAIR_STYLE, rand(20);
- getitem "Scissors", 1;
+ callfunc "getHeadStyles";
+ setlook LOOK_HAIR_STYLE, rand(1,getarraysize(@HairStyles$));
return;
}
diff --git a/world/map/npc/items/shock_sweet.txt b/world/map/npc/items/shock_sweet.txt
index 4de758d1..ea5992c3 100644
--- a/world/map/npc/items/shock_sweet.txt
+++ b/world/map/npc/items/shock_sweet.txt
@@ -7,7 +7,7 @@ function|script|useShockSweet
return;
L_Change:
- setlook LOOK_HAIR_COLOR, HC_WHITE;
+ setlook LOOK_HAIR_COLOR, (HC_WHITE - Class) + 1;
message strcharinfo(0), "Gah! That was some strong stuff!";
sc_start sc_poison, 1, 20;
misceffect 15, strcharinfo(0);