Advertisement
finaltidus

synthGreed.ash

Mar 14th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.67 KB | None | 0 0
  1. //Finds cheapest combo to create synthesis greed and treats untradables
  2. //as zero cost(as long as you own some) because I have no idea how to change
  3. //their price in mafia and that is the entire reason I wrote this garbage.
  4.  
  5. boolean [item] complexCandy;
  6.  
  7. foreach it in $items[]{
  8. if (!it.candy){ continue; }
  9. if (it.candy_type == "complex"){
  10. complexCandy[it] = true;
  11. }
  12. }
  13. static boolean [item] sugarBreak = $items[sugar chapeau,sugar shank,sugar shirt,sugar shorts,sugar shotgun,sugar shillelagh,sugar shield];
  14.  
  15. int currentPrice = 10000;
  16. int totalPrice;
  17. int mallPrice1;
  18. int mallPrice2;
  19. string candy1;
  20. string candy2;
  21.  
  22. foreach i in complexCandy{
  23. foreach j in complexCandy{
  24. if((i.to_int() + j.to_int()) % 5 == 0){
  25. if(item_amount(i) < 1 && !is_tradeable(i)){
  26. continue;
  27. }
  28. if(item_amount(j) < 1 && !is_tradeable(j)){
  29. continue;
  30. }
  31. mallprice1 = historical_age(i) > 3.0 ? mall_price(i) : historical_price(i);
  32. mallprice2 = historical_age(j) > 3.0 ? mall_price(j) : historical_price(j);
  33.  
  34. if(sugarBreak contains i && item_amount(i) < 1){
  35. mallprice1 = mall_price($item[sugar sheet]);
  36. }
  37. if(sugarBreak contains j && item_amount(j) < 1){
  38. mallprice2 = mall_price($item[sugar sheet]);
  39. }
  40.  
  41. totalPrice = mallPrice1 + mallPrice2;
  42. if(totalPrice < currentPrice){
  43. currentPrice = totalPrice;
  44. candy1 = i;
  45. candy2 = j;
  46. }
  47. }
  48. }
  49. }
  50.  
  51. //dont want to synth for over 3000 meat if I ran out of cheap candy for whatever reason.
  52. if(currentPrice < 3000){
  53. sweet_synthesis(candy1.to_item(), candy2.to_item());
  54. }else{
  55. print("Best: " + candy1 + " + " + candy2 + ". Price: " + currentPrice);
  56. abort("Too expensive.");
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement