Advertisement
Guest User

Untitled

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