diff options
Diffstat (limited to 'world/map')
-rw-r--r-- | world/map/npc/002-2/bleacher.txt | 304 | ||||
-rw-r--r-- | world/map/npc/009-2/selim.txt | 73 | ||||
-rw-r--r-- | world/map/npc/functions/DyeConfig.txt | 42 | ||||
-rw-r--r-- | world/map/npc/scripts.conf | 1 |
4 files changed, 130 insertions, 290 deletions
diff --git a/world/map/npc/002-2/bleacher.txt b/world/map/npc/002-2/bleacher.txt index 213c96f8..68bad782 100644 --- a/world/map/npc/002-2/bleacher.txt +++ b/world/map/npc/002-2/bleacher.txt @@ -1,4 +1,4 @@ -// +// IMPORTANT: add your items to DyeConfig, do not edit Candide 002-2,72,92,0|script|Candide|156 { @@ -6,271 +6,88 @@ mes "\"I've figured out how that volcanic ash bleaches cloth."; mes "I could do it for you, but I'll need three piles of ash and 5,000 GP for supplies per item.\""; next; - if (countitem("PileOfAsh") < 3) goto L_no_ash; - if (Zeny < 5000) goto L_no_money; - menu "I'd like to bleach something.", L_bleach_menu, "No thanks.", L_Close; L_bleach_menu: - mes "[Candide]"; - mes "\"What would you like to bleach?\""; - next; - + cleararray @CANDIDE_items,0,getarraysize(@CANDIDE_items); + cleararray @CANDIDE_color,0,getarraysize(@CANDIDE_color); + cleararray @CANDIDE_menu$,"",getarraysize(@CANDIDE_menu$); + set @w, 0; + freeloop 1; // do not check for infinity loop + callsub S_LoopArray; + freeloop 0; // re-enable infinity loop check + set @w, 0; + set @c, 0; + set @p, 0; menu - "Cotton shirt.", L_cottonshirt, - "Contributor shirt.", L_contributor, - "V-Neck sweater.", L_vneck, - "Turtleneck sweater.", L_tneck, - "Cotton shorts.", L_shorts, - "Cotton trousers.", L_trousers, - "Cotton skirt.", L_skirt, - "Miniskirt.", L_miniskirt, - "Tank top .", L_tanktop, - "Short tank top.", L_tanktop_short, - "Silk robe.", L_robe, - "Cotton headband.", L_cotton_headband, - "Desert hat.", L_desert_hat, - "Cotton boots.", L_cotton_boots, - "Cotton gloves.", L_cotton_gloves, - "Rabbit ears.", L_rabbit_ears, - "Wizard hat.", L_wizard_hat, - "Bowler hat.", L_bowler_hat, - "Sorcerer robe.", L_sorcerer_robe, - "Bowler hat (brown).", L_bowler_hat_brown, - "Fine dress.", L_fine_dress, - "Cotton cloth.", L_cotton_cloth, - "Nevermind.", L_Close; - -L_contributor: - set @normal, 1178; - set @dyeBase, 5131; - goto L_choose_color; - -L_cottonshirt: - set @normal, 1202; - set @dyeBase, 2050; - goto L_choose_color; - -L_vneck: - set @normal, 624; - set @dyeBase, 2060; - goto L_choose_color; - -L_tneck: - set @normal, 564; - set @dyeBase, 2070; - goto L_choose_color; - -L_shorts: - set @normal, 586; - set @dyeBase, 2110; - goto L_choose_color; - -L_trousers: - set @normal, 648; - set @dyeBase, 2180; - goto L_choose_color; - -L_skirt: - set @normal, 632; - set @dyeBase, 2100; - goto L_choose_color; - -L_miniskirt: - set @normal, 771; - set @dyeBase, 2170; - goto L_choose_color; - -L_tanktop: - set @normal, 688; - set @dyeBase, 2090; - goto L_choose_color; - -L_tanktop_short: - set @normal, 689; - set @dyeBase, 2120; - goto L_choose_color; - -L_robe: - set @normal, 720; - set @dyeBase, 2080; - goto L_choose_color; - -L_cotton_headband: - set @normal, 724; - set @dyeBase, 2140; - goto L_choose_color; - -L_desert_hat: - set @normal, 723; - set @dyeBase, 2130; - goto L_choose_color; - -L_cotton_boots: - set @normal, 735; - set @dyeBase, 2150; - goto L_choose_color; - -L_cotton_gloves: - set @normal, 741; - set @dyeBase, 2160; - goto L_choose_color; - -L_rabbit_ears: - set @normal, 1255; - set @dyeBase, 2190; - goto L_choose_color; - -L_wizard_hat: - set @normal, 4028; - set @dyeBase, 2200; - goto L_choose_color; - -L_bowler_hat: - set @normal, 4030; - set @dyeBase, 2210; - goto L_choose_color; - -L_sorcerer_robe: - mes "[Candide]"; - mes "\"Which one?\""; - next; - menu - "A red lined one.", L_red_lined, - "A green lined one.", L_green_lined, - "A dark blue lined one.", L_dark_blue_lined, - "A yellow lined one.", L_yellow_lined, - "A light blue lined one.", L_light_blue_lined, - "A pink lined one.", L_pink_lined, - "A black lined one.", L_black_lined, - "An orange lined one.", L_orange_lined, - "A purple lined one.", L_purple_lined, - "A dark green lined one.", L_dark_green_lined, - "A white lined one.", L_white_lined, - "Nevermind.", L_Close; - -L_red_lined: - set @normal, 798; - set @dyeBase, 2220; - goto L_choose_color; - -L_green_lined: - set @normal, 5010; - set @dyeBase, 5000; - goto L_choose_color; - -L_dark_blue_lined: - set @normal, 5021; - set @dyeBase, 5011; - goto L_choose_color; - -L_yellow_lined: - set @normal, 5032; - set @dyeBase, 5022; - goto L_choose_color; - -L_light_blue_lined: - set @normal, 5043; - set @dyeBase, 5033; - goto L_choose_color; - -L_pink_lined: - set @normal, 5054; - set @dyeBase, 5044; - goto L_choose_color; - -L_black_lined: - set @normal, 5065; - set @dyeBase, 5055; - goto L_choose_color; - -L_orange_lined: - set @normal, 5076; - set @dyeBase, 5066; - goto L_choose_color; - -L_purple_lined: - set @normal, 5087; - set @dyeBase, 5077; - goto L_choose_color; - -L_dark_green_lined: - set @normal, 5098; - set @dyeBase, 5088; - goto L_choose_color; - -L_white_lined: - set @normal, 5109; - set @dyeBase, 5099; - goto L_choose_color; - -L_bowler_hat_brown: - set @normal, 800; - set @dyeBase, 2230; - goto L_choose_color; - -L_fine_dress: - set @normal, 870; - set @dyeBase, 2240; - goto L_choose_color; - -L_cotton_cloth: - set @normal, 660; - set @dyeBase, 2250; - goto L_choose_color; - -L_choose_color: - mes "[Candide]"; - mes "\"And the color?\""; - next; - - menu - "Red.", L_MenuItems, - "Green.", L_MenuItems, - "Dark Blue.", L_MenuItems, - "Yellow.", L_MenuItems, - "Light Blue.", L_MenuItems, - "Pink.", L_MenuItems, - "Black.", L_MenuItems, - "Orange.", L_MenuItems, - "Purple.", L_MenuItems, - "Dark Green.", L_MenuItems; + "Nevermind.", L_Close, + @CANDIDE_menu$[0], L_MenuItems, // base array was too big for a dynamic menu so we can't use it + @CANDIDE_menu$[1], L_MenuItems, + @CANDIDE_menu$[2], L_MenuItems, + @CANDIDE_menu$[3], L_MenuItems, + @CANDIDE_menu$[4], L_MenuItems, + @CANDIDE_menu$[5], L_MenuItems, + @CANDIDE_menu$[6], L_MenuItems, + @CANDIDE_menu$[7], L_MenuItems, + @CANDIDE_menu$[8], L_MenuItems, + @CANDIDE_menu$[9], L_MenuItems, + @CANDIDE_menu$[10], L_MenuItems, + @CANDIDE_menu$[11], L_MenuItems, + @CANDIDE_menu$[12], L_MenuItems, + @CANDIDE_menu$[13], L_MenuItems, + @CANDIDE_menu$[14], L_MenuItems, + @CANDIDE_menu$[15], L_MenuItems, + @CANDIDE_menu$[16], L_MenuItems, + @CANDIDE_menu$[17], L_MenuItems; + +S_LoopArray: + set @c, 0; + callsub S_LoopColor; + set @w, @w + 1; + if(@w < getarraysize($@DYE_items$)) goto S_LoopArray; + return; + +S_LoopColor: + if(countitem($@DYE_colors$[@c] + $@DYE_items$[@w]) > 0) + goto L_AddToMenu; + goto L_LoopColor2; + +L_AddToMenu: + set @CANDIDE_items[@p], @w; + set @CANDIDE_color[@p], @c; + set @CANDIDE_menu$[@p], $@DYE_color_names$[@c]+" "+$@DYE_item_names$[@w]; + set @p, @p + 1; + goto L_LoopColor2; + +L_LoopColor2: + set @c, @c + 1; + if(@c < getarraysize($@DYE_colors$)) goto S_LoopColor; + return; L_MenuItems: - set @del, @dyeBase + @menu - 1; - - if (countitem(@del) == 0) goto L_no_item; - if (countitem("PileOfAsh") < 3) goto L_no_ash; - if (Zeny < 5000) goto L_no_money; - - delitem @del, 1; - getitem @normal, 1; + set @m, @menu - 2; + set @it$, $@DYE_colors$[@CANDIDE_color[@m]] + $@DYE_items$[@CANDIDE_items[@m]]; + if(getitemname(@it$) == "Unknown Item") mapexit; + delitem @it$, 1; delitem "PileOfAsh", 3; set Zeny, Zeny - 5000; + getitem $@DYE_items$[@CANDIDE_items[@m]], 1; goto L_again; L_again: mes "[Candide]"; mes "\"Would you like to bleach something else?\""; next; - menu "Yes.", L_bleach_menu, "No.", L_Close; -L_no_item: - mes "[Candide]"; - mes "\"You don't have one of those.\""; - next; - - goto L_again; - L_no_ash: mes "[Candide]"; mes "\"You don't have enough ash for me to bleach anything."; @@ -286,8 +103,5 @@ L_no_money: L_Close: mes "[Candide]"; mes "\"Come again.\""; - set @normal, 0; - set @dyeBase, 0; - set @del, 0; close; } diff --git a/world/map/npc/009-2/selim.txt b/world/map/npc/009-2/selim.txt index 3a1a2a37..80abfdcc 100644 --- a/world/map/npc/009-2/selim.txt +++ b/world/map/npc/009-2/selim.txt @@ -1,46 +1,20 @@ -function|script|SelimDebug -{ - set @w, 0; - mes "[Selim Debug]"; - menu - "Debug item array.", L_DebugArrayExplain, - "Exit debug.", L_Return; - -L_DebugArrayExplain: - mes "[How it works]"; - mes "Click on the link to verify that it is the red variation of the item."; - mes "If, for example, you see [Skirt] then when you click on it you should see Red Skirt."; - next; - goto L_DebugArray; - -L_DebugArray: - mes "[@@" + @items_new[@w] + "|" + @item_names$[@w] + "@@]"; - set @w, @w + 1; - if(@w >= getarraysize(@items_new)) goto L_Return; - menu - "Next.", L_DebugArray, - "Exit debug.", L_Return; - -L_Return: - return; -} - 009-2,32,104,0|script|Selim|326 { - setarray @all_colours$, "red", "green", "dark blue", "yellow", "light blue", "pink", "black", "orange", "purple", "dark green"; - cleararray @items$, "", getarraysize(@items$); cleararray @item_names$, "", getarraysize(@item_names$); - cleararray @items_new, "", getarraysize(@items_new); - setarray @items_new, 2050, 2250, 2060, 2070, 2110, 2180, 2100, 2170, 2090, 2120, 2080, 2140, 2130, 2150, 2160, 2190, 2200, 2210, 2230, 2240, 5131, 2220, 5000, 5011, 5022, 5033, 5044, 5055, 5066, 5077, 5088, 5099; - setarray @items$, "CottonShirt", "CottonCloth", "VNeckSweater", "Turtleneck", "CottonShorts", "CottonTrousers", "CottonSkirt", "Miniskirt", "TankTop", "ShortTankTop", "SilkRobe", "CottonHeadband", "DesertHat", "CottonBoots", "CottonGloves", "RabbitEars", "WizardHat", "BowlerHat", "BowlerHatBrown", "FineDress", "Contributor", "SorcererRed", "SorcererGreen", "SorcererDBlue", "SorcererYellow", "SorcererLBlue", "SorcererPink", "SorcererBlack", "SorcererOrange", "SorcererPurple", "SorcererDGreen", "SorcererWhite"; - setarray @item_names$, "Cotton Shirt", "Cotton Cloth", "V-Neck Sweater", "Turtleneck Sweater", "Cotton Shorts", "Cotton Trousers", "Cotton Skirt", "Miniskirt", "Tank Top", "Short Tank Top", "Silk Robe", "Cotton Headband", "Desert Hat", "Cotton Boots", "Cotton Gloves", "Rabbit Ears", "Wizard Hat", "Bowler Hat", "Bowler Hat (brown)", "Fine Dress", "Contributor Shirt", "Red lined Sorcerer Robe", "Green lined Sorcerer Robe", "Dark Blue lined Sorcerer Robe", "Yellow lined Sorcerer Robe", "Light Blue lined Sorcerer Robe", "Pink lined Sorcerer Robe", "Black lined Sorcerer Robe", "Orange lined Sorcerer Robe", "Purple lined Sorcerer Robe", "Dark Green lined Sorcerer Robe", "White lined Sorcerer Robe"; - if ((getgmlevel() >= 40 || debug) && (getequipid(equip_head) == 647 || getequipid(equip_head) == 725)) goto L_Debug; + set @r, 0; + set @j, getarraysize($@DYE_items$); + goto L_CloneArray; // clone the array from DyeConfig + +L_CloneArray: + set @items$[@r], $@DYE_items$[@r]; + set @item_names$[@r], $@DYE_item_names$[@r]; + set @r, @r + 1; + if(@r < @j) goto L_CloneArray; + set @r, 0; + set @j, 0; goto L_Main; -L_Debug: - callfunc "SelimDebug"; - close; L_Main: mes "[Selim]"; @@ -86,7 +60,6 @@ L_clothes_choice: callfunc "DynamicItemMenu$"; set @default_choice$, ""; set @item_del$, @item$; - set @item_new, @items_new[@index]; set @name$, @item_names$[@index]; cleararray @items$, "", getarraysize(@items$); cleararray @item_names$, "", getarraysize(@item_names$); @@ -114,7 +87,6 @@ L_Next: mes "\"Of course I can help you by dyeing the materials your tailor will want."; mes "All I need is a piece of Cotton Cloth.\""; set @item_del$, "CottonCloth"; - set @item_new, 2250; menu "Sure. Here is one.", L_picked_item, "I have to go pick that.", L_Close; @@ -127,8 +99,9 @@ L_colour: mes "[Selim]"; mes "\"Excellent. Now, what color do you want?\""; next; - setarray @items$, "RedDye", "GreenDye", "DarkBlueDye", "YellowDye", "LightBlueDye", "PinkDye", "BlackDye", "OrangeDye", "PurpleDye", "DarkGreenDye"; - setarray @item_names$, "red", "green", "dark blue", "yellow", "light blue", "pink", "black", "orange", "purple", "dark green"; + set @r, 0; + set @j, getarraysize($@DYE_colors$); + callsub S_CloneColors; set @default_choice$, "I have no dye."; callfunc "DynamicItemMenu$"; cleararray @items$, "", getarraysize(@items$); @@ -136,9 +109,17 @@ L_colour: set @default_choice$, ""; if (@item$ == "") goto L_no_dye; set @colour, @index; - set @vial, 690 + @colour; goto L_finish; +S_CloneColors: + set @items$[@r], $@DYE_colors$[@r] + "Dye"; + set @item_names$[@r], $@DYE_color_names$[@r]; + set @r, @r + 1; + if(@r < @j) goto S_CloneColors; + set @r, 0; + set @j, 0; + return; + L_no_dye: mes "[Selim]"; mes "\"I would love to dye your " + @name$ + " for you, but you will have to bring me some dye first."; @@ -159,11 +140,13 @@ L_explain_dye: goto L_Close; L_finish: - delitem @vial, 1; + if(getitemname($@DYE_colors$[@colour] + @item_del$) == "Unknown Item") mapexit; + if(countitem(@item_del$) < 1) goto L_havenone; + delitem @item$, 1; delitem @item_del$, 1; - getitem @item_new + @colour, 1; + getitem $@DYE_colors$[@colour] + @item_del$, 1; mes "[Selim]"; - mes "\"Here's your " + @all_colours$[@colour] + " " + @name$ + "! Please let dry for a minute.\""; + mes "\"Here's your " + $@DYE_color_names$[@colour] + " " + @name$ + "! Please let dry for a minute.\""; goto L_Close; L_havenone: diff --git a/world/map/npc/functions/DyeConfig.txt b/world/map/npc/functions/DyeConfig.txt new file mode 100644 index 00000000..1da1e734 --- /dev/null +++ b/world/map/npc/functions/DyeConfig.txt @@ -0,0 +1,42 @@ +009-2,32,105,0|script|#DyeChecker|-1 +{ + end; +OnInit: + /****************************** + Config Starts Here + ******************************/ + setarray $@DYE_color_names$, "Red", "Green", "Dark Blue", "Yellow", "Light blue", "Pink", "Black", "Orange", "Purple", "Dark Green"; + setarray $@DYE_colors$, "Red", "Green", "DarkBlue", "Yellow", "LightBlue", "Pink", "Black", "Orange", "Purple", "DarkGreen"; + + setarray $@DYE_items$, "CottonShirt", "CottonCloth", "VNeckSweater", "Turtleneck", "CottonShorts", "CottonTrousers", "CottonSkirt", "Miniskirt", "TankTop", "ShortTankTop", "SilkRobe", "CottonHeadband", "DesertHat", "CottonBoots", "CottonGloves", "RabbitEars", "WizardHat", "BowlerHat", "BowlerHatBrown", "FineDress", "Contributor", "SorcererRed", "SorcererGreen", "SorcererDBlue", "SorcererYellow", "SorcererLBlue", "SorcererPink", "SorcererBlack", "SorcererOrange", "SorcererPurple", "SorcererDGreen", "SorcererWhite"; + setarray $@DYE_item_names$, "Cotton Shirt", "Cotton Cloth", "V-Neck Sweater", "Turtleneck Sweater", "Cotton Shorts", "Cotton Trousers", "Cotton Skirt", "Miniskirt", "Tank Top", "Short Tank Top", "Silk Robe", "Cotton Headband", "Desert Hat", "Cotton Boots", "Cotton Gloves", "Rabbit Ears", "Wizard Hat", "Bowler Hat", "Bowler Hat (brown)", "Fine Dress", "Contributor Shirt", "Sorcerer Robe (Red)", "Sorcerer Robe (Green)", "Sorcerer Robe (Dark Blue)", "Sorcerer Robe (Yellow)", "Sorcerer Robe (Light Blue)", "Sorcerer Robe (Pink)", "Sorcerer Robe (Black)", "Sorcerer Robe (Orange)", "Sorcerer Robe (Purple)", "Sorcerer Robe (Dark Green)", "Sorcerer Robe (White)"; + /****************************** + Config Ends Here + ******************************/ + + set $@w, 0; + freeloop 1; // do not check for infinity loop + callsub S_Array; + freeloop 0; // re-enable infinity loop check + set $@w, 0; + set $@c, 0; + end; + +S_Array: + if(getitemname($@DYE_items$[$@w]) == "Unknown Item") goto L_Fail; + set $@c, 0; + callsub S_Color; + set $@w, $@w + 1; + if($@w < getarraysize($@DYE_items$)) goto S_Array; + return; + +L_Fail: + debugmes "Dye Fail: "+$@DYE_items$[$@w]; + mapexit; + +S_Color: + if(getitemname($@DYE_colors$[$@c] + $@DYE_items$[$@w]) == "Unknown Item") goto L_Fail; + set $@c, $@c + 1; + if($@c < getarraysize($@DYE_colors$)) goto S_Color; + return; +} diff --git a/world/map/npc/scripts.conf b/world/map/npc/scripts.conf index d9fbd64d..1414f681 100644 --- a/world/map/npc/scripts.conf +++ b/world/map/npc/scripts.conf @@ -27,6 +27,7 @@ npc: npc/functions/global_event_handler.txt npc: npc/functions/stat_reset.txt npc: npc/functions/quiz.txt npc: npc/functions/dynamic_menu.txt +npc: npc/functions/DyeConfig.txt // Item Functions npc: npc/items/magic_gm_top_hat.txt |