Advertisement
johnlol

Master Potion Brewer

Aug 7th, 2023
761
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VeriLog 5.04 KB | Gaming | 0 0
  1. //===== rAthena Script ======================================
  2. //= Master Potion Brewer
  3. //===== By: ==================================================
  4. //= Cretino
  5. //= maken06 (NPC Idea)
  6. //===== Current Version: =====================================
  7. //= 1.0 Initial version [Cretino]
  8. //===== Description: =========================================
  9. //= You can produce potions of many types. (Configurable by array)
  10. //= You can produce a limited amount of potions at time. (Configurable by variable)
  11. //= Go to line '156' to configure.
  12. //===== Additional Comments: =================================
  13. //= 1.0 Initial version [Cretino]
  14. //============================================================
  15.  
  16. prontera,164,154,4  script  Master Potion Brewer#1  4_M_ALCHE_B,{
  17.     .@npc_name$ = "[" + strnpcinfo(1) + "]";
  18.  
  19.     mes .@npc_name$;
  20.     mes "Hello "+(Sex?"Mr":"Ms")+", ^228B22"+strcharinfo(0)+"^000000, you want to produce some potions?";
  21.  
  22.     .@selected = select("Yes:No");
  23.  
  24.     next;
  25.     mes .@npc_name$;
  26.  
  27.     if (.@selected == 2)
  28.     {
  29.         mes "Ok, come back later!";
  30.         close;
  31.     }
  32.     else
  33.     {
  34.         mes "Select what you want to produce:";
  35.  
  36.         .@menu$ = "";
  37.         .@menu_size = 0;
  38.         .@potion_idx = 0;
  39.         .@potion_req_count = .@potion_idx + 1;
  40.  
  41.         while(true)
  42.         {
  43.             .@menu$ += getitemname(.potions_array[.@potion_idx]) + ":";
  44.             .@potion_idx += 2 + (.potions_array[.@potion_req_count] * 2);
  45.             .@potion_req_count = .@potion_idx + 1;
  46.             .@menu_size++;
  47.  
  48.             if (getarraysize(.potions_array) == (.@potion_idx + (.potions_array[.@potion_req_count] * 2)))
  49.                 break;
  50.         }
  51.  
  52.         .@menu$ += "Cancel";
  53.  
  54.         .@selected = select(.@menu$);
  55.  
  56.         next;
  57.         mes .@npc_name$;
  58.  
  59.         if (.@selected == (.@menu_size + 1))
  60.         {
  61.             mes "Ok, come back later!";
  62.             close;
  63.         }
  64.         else
  65.         {
  66.             .@i = .@selected - 1;
  67.             .@potion_idx = 0;
  68.             .@potion_req_count = .@potion_idx + 1;
  69.  
  70.             for(.@j = 0; .@j < .@i; .@j++)
  71.             {
  72.                 .@potion_idx += 2 + (.potions_array[.@potion_req_count] * 2);
  73.                 .@potion_req_count = .@potion_idx + 1;
  74.             }
  75.  
  76.             mes "How many " + getitemname(.potions_array[.@potion_idx]) + " you want to produce?";
  77.             mes "Input '0' to cancel.";
  78.             mes "You can produce " + .potion_produce_limit + " at time.";
  79.             input(.@potion_amount, 0, .potion_produce_limit);
  80.             next;
  81.             mes .@npc_name$;
  82.  
  83.             if (.@potion_amount <= 0)
  84.             {
  85.                 mes "Ok, come back later!";
  86.                 close;
  87.             }
  88.  
  89.             mes "To produce ^FF0000" + .@potion_amount + "^000000x ^FF0000" + getitemname(.potions_array[.@potion_idx]) + "^000000 you will need:";
  90.            
  91.             for(.@j = 0; .@j < .potions_array[.@potion_req_count]; .@j++)
  92.             {
  93.                 mes "^FF0000" + (.potions_array[(.@potion_idx + 2 + (.@j * 2)) + 1] * .@potion_amount) + "^000000x ^FF0000" + getitemname(.potions_array[(.@potion_idx + 2 + (.@j * 2))]) + "^000000.";
  94.             }
  95.  
  96.             mes " ";
  97.             mes "You want to produce?";
  98.  
  99.             .@selected = select("Yes:No");
  100.  
  101.             next;
  102.             mes .@npc_name$;
  103.  
  104.             if (.@selected == 2)
  105.             {
  106.                 mes "Ok, come back later!";
  107.                 close;
  108.             }
  109.             else
  110.             {
  111.                 if (checkweight(.potions_array[.@potion_idx], .@potion_amount) == false)
  112.                 {
  113.                     mes "You can't carry ^FF0000" + .@potion_amount + "^000000x ^FF0000" + getitemname(.potions_array[.@potion_idx]) + "^000000.";
  114.                     close;
  115.                 }
  116.  
  117.                 .@have_reqs = true;
  118.  
  119.                 for(.@j = 0; .@j < .potions_array[.@potion_req_count]; .@j++)
  120.                 {
  121.                     if (countitem(.potions_array[(.@potion_idx + 2 + (.@j * 2))]) < (.potions_array[(.@potion_idx + 2 + (.@j * 2)) + 1] * .@potion_amount))
  122.                     {
  123.                         .@have_reqs = false;
  124.  
  125.                         mes "You don't have ^FF0000" + (.potions_array[(.@potion_idx + 2 + (.@j * 2)) + 1] * .@potion_amount) + "^000000x ^FF0000" + getitemname(.potions_array[(.@potion_idx + 2 + (.@j * 2))]) + "^000000.";
  126.                     }
  127.                 }
  128.  
  129.                 if (.@have_reqs == false)
  130.                 {
  131.                     close;
  132.                 }
  133.                 else
  134.                 {
  135.                     for(.@j = 0; .@j < .potions_array[.@potion_req_count]; .@j++)
  136.                     {
  137.                         delitem .potions_array[(.@potion_idx + 2 + (.@j * 2))], (.potions_array[(.@potion_idx + 2 + (.@j * 2)) + 1] * .@potion_amount);
  138.                     }
  139.  
  140.                     progressbar "ffff00", 5;
  141.                     specialeffect EF_PHARMACY_OK, AREA;
  142.  
  143.                     mes "Here are your potions.";
  144.                     mes "Come back if you need more.";
  145.                     getitem .potions_array[.@potion_idx], .@potion_amount;
  146.                     close;
  147.                 }
  148.             }
  149.         }
  150.     }
  151.  
  152.     end;
  153.  
  154.     OnInit:
  155.         // How many potions you can produce at time.
  156.         .potion_produce_limit = 100;
  157.  
  158.         // ONLY CHANGE IF YOU KNOW WHAT YOU'RE DOING !!
  159.         // Array structure: PotionID, ReqCount, ReqItemID, ReqItemAmount
  160.  
  161.         setarray .potions_array[0], 7135, 3, 970, 1, 1059, 1, 713, 1, // Bottle Grenade
  162.                                     7136, 2, 713, 1, 929, 1, // Acid Bottle
  163.                                     7137, 2, 713, 1, 1032, 2, // Plant Bottle
  164.                                     7138, 3, 713, 1, 1050, 1, 1051, 1, // Marine Sphere Bottle
  165.                                     545, 3, 501, 1, 1092, 1, 952, 1, // Condensed Red Potion
  166.                                     546, 3, 503, 1, 1092, 1, 1017, 1, // Condensed Yellow Potion
  167.                                     547, 3, 504, 1, 1092, 1, 1061, 1, // Condensed White Potion
  168.                                     7139, 4, 970, 1, 950, 1, 1044, 1, 713, 1, // Glistening Coat
  169.                                     678, 7, 937, 1, 952, 1, 939, 1, 7033, 1, 972, 1, 657, 1, 713, 1; // Poison Bottle
  170.  
  171.     end;
  172. }
  173.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement