Advertisement
johnlol

Advance Stylist

Aug 2nd, 2023
956
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VeriLog 5.85 KB | Gaming | 0 0
  1. /* npc/other/Global_Functions.txt#L589
  2. function    script  F_InsertComma   {
  3.     set .@str$, getarg(0);
  4.     for (set .@i,getstrlen(.@str$)-3; .@i>0; set .@i,.@i-3)
  5.         set .@str$, insertchar(.@str$,",",.@i);
  6.     return .@str$;
  7. }
  8. */
  9.  
  10. -   script  Stylist -1,{
  11. OnTalk:
  12.     if (.ignore_secure_npctimeout)
  13.         ignoretimeout 1;
  14.     mes "[^0055FF ::: Adv. Stylist ::: ^000000]";
  15.     mes "I can change your appearance.";
  16.     if (.cost_size){
  17.         mes " ";
  18.         mes "^777777[ SERVICES PAYMENT ]^000000";
  19.         for(.@i = 0; .@i < .menu_size; .@i++)
  20.             if (.npc_mode & (1 << .@i))
  21.                 if (.cost[.@i])
  22.                     mes "^0055FF"+.menu_name$[.@i]+" : ^777777"+F_InsertComma(.cost[.@i])+" "+.currency_name$[.@i]+"^000000";
  23.                 else
  24.                     mes "^0055FF"+.menu_name$[.@i]+" : ^777777Free of Charge^000000";
  25.     }
  26.     next;
  27.     @style = (select(.npc_menu$) - 1);
  28.     @style_value = getlook(.look_type[@style]);
  29.     deletearray .@blacklist;
  30.     switch(@style){
  31.         case 0: .@blacklist$ = ","+getd(".blacklist_hairstyle_"+Sex+"$")+","; break;
  32.         case 1: .@blacklist$ = ","+getd(".blacklist_haircolor_"+Sex+"$")+","; break;
  33.         case 2: .@blacklist$ = ","+getd(".blacklist_cloth_"+Sex+"$")+","; break;
  34.         default: break;
  35.     }
  36.  
  37.     .@style_number = .min_style[@style];
  38.  
  39.     addtimer 1000,strnpcinfo(0)+"::OnPCLogoutEvent";
  40.     do{
  41.         message strcharinfo(0),"Current "+.menu_name$[@style]+" Style : #"+.@style_number;
  42.         .@removed = 0;
  43.         if (compare(.@blacklist$,","+.@style_number+",")){
  44.             message strcharinfo(0),"[ REMOVED ] "+.menu_name$[@style]+" : "+.@style_number+"th";
  45.             .@removed = 1;
  46.         } else {
  47.             setlook .look_type[@style],.@style_number;
  48.         }
  49.        
  50.         .@next = .@style_number + 1;
  51.         .@prev = .@style_number - 1;
  52.         if (.@next > .max_style[@style]) .@next = .min_style[@style];
  53.         if (.@prev < .min_style[@style]) .@prev = .max_style[@style];
  54.        
  55.         @select = prompt(
  56.             ((.@backward)?"Backward":"Forward")+" - [ ^777777"+((.@backward)? .@prev:.@next)+"th "+.menu_name$[@style]+"^000000 ]",
  57.             ((!.@backward)?"Backward":"Forward")+" - [ ^777777"+((!.@backward)? .@prev:.@next)+"th "+.menu_name$[@style]+"^000000 ]",
  58.             "Random "+.menu_name$[@style],
  59.             "Pick a "+.menu_name$[@style],
  60.             (.@removed)?"":"^0055FFOkay, I want this "+.menu_name$[@style]+"^000000");
  61.  
  62.         if (@select == 2) .@backward = !.@backward;
  63.        
  64.         switch(@select){
  65.             case 1:
  66.             case 2:
  67.                 .@style_number = ((.@backward)? .@prev:.@next);
  68.                 break;
  69.             case 3:
  70.                 .@style_number = rand(.min_style[@style], .max_style[@style]);
  71.                 break;
  72.             case 4:
  73.                 message strcharinfo(0),"Available "+.menu_name$[@style]+" : "+.min_style[@style]+" ~ "+.max_style[@style]+".";
  74.                 input .@style_number,.min_style[@style],.max_style[@style];
  75.                 break;
  76.             case 5:
  77.                 .@atoi_currency = atoi(.currency$[@style]);
  78.                 if (@style_value == .@style_number){
  79.                     message strcharinfo(0),"But that is your current "+.menu_name$[@style]+".";
  80.                     break;
  81.                 }
  82.                 else if (.@atoi_currency){
  83.                     if (countitem(.@atoi_currency) >= .cost[@style]){
  84.                         .@success = 1;
  85.                         delitem .@atoi_currency,.cost[@style];
  86.                     }
  87.                 }
  88.                 else {
  89.                     if (getd(""+.currency$[@style]) >= .cost[@style]){
  90.                         .@success = 1;
  91.                         setd(""+.currency$[@style]),(getd(""+.currency$[@style]) - .cost[@style]);
  92.                     }
  93.                 }
  94.                 if (.@success){
  95.                     message strcharinfo(0),"Enjoy your brand new "+.menu_name$[@style]+" !!";
  96.                     @style_value = .@style_number;
  97.                 }
  98.                 else {
  99.                     mes "You dont have enough "+.currency_name$[@style]+" to change this "+.menu_name$[@style]+".";
  100.                     mes "Cost : ^777777"+F_InsertComma(.cost[@style])+" "+.currency_name$[@style]+"^000000";
  101.                     close2;
  102.                 }
  103.  
  104.             default:
  105.                 setlook .look_type[@style],@style_value;
  106.                 break;
  107.         }
  108.     } while (@select != 5 && @select != 255);
  109.     mes "Come back again next time. ^^";
  110.     @select = 0;
  111.     if (.ignore_secure_npctimeout)
  112.         ignoretimeout 0;
  113.     close2;
  114.     deltimer strnpcinfo(0)+"::OnPCLogoutEvent";
  115.  
  116. OnPCLogoutEvent:
  117.     if (@select)
  118.         setlook .look_type[@style],@style_value;
  119.     end;
  120.    
  121. OnInit:
  122.     // NPC Mode (Bitmask)
  123.     //  1 - Enable Hairstyle
  124.     //  2 - Enable Hair Color
  125.     //  4 - Enable Cloth Color
  126.     .npc_mode = 7;
  127.    
  128.     // ignore SECURE_NPCTIMEOUT
  129.     .ignore_secure_npctimeout = 1;
  130.    
  131.     // Menu Name
  132.     setarray .menu_name$,
  133.         "Hair Style",
  134.         "Hair Color",
  135.         "Cloth Color";
  136.    
  137.     // Payment Currency + Cost
  138.     // Can be ITEM ID or Any Variable.
  139.     setarray .currency$,
  140.         "Zeny", //  Hairstyle - Ex. need Zeny
  141.         "Zeny", //  Hair Color - Ex. need Zeny
  142.         "Zeny"; //  Cloth Color - Ex. need Zeny
  143.        
  144.     setarray .cost,
  145.         10000,  //  Hairstyle (10,000 Zeny)
  146.         10000,  //  Hair Color (10,000 Zeny)
  147.         10000;  //  Cloth Color (10,000 Zeny)
  148.        
  149.     // Blacklisted Style for each style and each gender.
  150.     // --- Female ---
  151.     .blacklist_hairstyle_0$ = "2,4,6";
  152.     .blacklist_haircolor_0$ = "1,3,5";
  153.     .blacklist_cloth_0$ = "1,2,3";
  154.     // --- Male ---
  155.     .blacklist_hairstyle_1$ = "3,5,7";
  156.     .blacklist_haircolor_1$ = "2,4,6";
  157.     .blacklist_cloth_1$ = "4,5,6";
  158.  
  159.     // Dont edit
  160.     setarray .min_style,getbattleflag("min_hair_style"),getbattleflag("min_hair_color"),getbattleflag("min_cloth_color");
  161.     setarray .max_style,getbattleflag("max_hair_style"),getbattleflag("max_hair_color"),getbattleflag("max_cloth_color");
  162.     .menu_size = getarraysize(.menu_name$);
  163.     .cost_size = getarraysize(.cost);
  164.     setarray .look_type,LOOK_HAIR,LOOK_HAIR_COLOR,LOOK_CLOTHES_COLOR;
  165.     for(.npc_menu$ = ""; .@i < .menu_size; .@i++)
  166.         .npc_menu$ = .npc_menu$ + ((.npc_mode & (1 << .@i))? .menu_name$[.@i]:"") +":";
  167.     for(.@i = 0; .@i < .cost_size; .@i++){
  168.         .@atoi = atoi(.currency$[.@i]);
  169.         .currency_name$[.@i] = ((!.@atoi || getitemname(.@atoi) == "null")? .currency$[.@i]:getitemname(.@atoi));
  170.     }
  171.     end;
  172.  
  173. }
  174.  
  175.  
  176. // NPC Lists
  177. prontera,170,181,3  script  Adv. Stylist#main   878,{
  178.     doevent "Stylist::OnTalk";
  179. }
  180.  
  181. prontera,115,181,5  duplicate(Adv. Stylist#main)    Adv. Stylist#1  878
  182. prontera,115,181,5  duplicate(Adv. Stylist#main)    Adv. Stylist#2  878
  183. prontera,115,181,5  duplicate(Adv. Stylist#main)    Adv. Stylist#3  878
  184.  
  185.  
  186.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement