Advertisement
finaltidus

synthgreed.ash

Oct 2nd, 2019
40
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.93 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. foreach i in complexCandy{
  22. foreach j in complexCandy{
  23. if((i.to_int() + j.to_int()) % 5 == 0){
  24. if(item_amount(i) < 1 && !is_tradeable(i)){
  25. continue;
  26. }
  27. if(item_amount(j) <= 1 && !is_tradeable(j)){
  28. continue;
  29. }
  30. mallprice1 = historical_age(i) > 3.0 ? mall_price(i) : historical_price(i);
  31. mallprice2 = historical_age(j) > 3.0 ? mall_price(j) : historical_price(j);
  32.  
  33. if(sugarBreak contains i && item_amount(i) < 1){
  34. mallprice1 = mall_price($item[sugar sheet]);
  35. }
  36. if(sugarBreak contains j && item_amount(j) < 1){
  37. mallprice2 = mall_price($item[sugar sheet]);
  38. }
  39. if (mallPrice1.to_int() <= 0){
  40. mallPrice1 = 10000;
  41. }
  42. if (mallPrice2.to_int() <= 0){
  43. mallPrice2 = 10000;
  44. }
  45. totalPrice = mallPrice1 + mallPrice2;
  46. if(totalPrice < currentPrice){
  47. currentPrice = totalPrice;
  48. candy1 = i;
  49. candy2 = j;
  50. }
  51. }
  52. }
  53. }
  54.  
  55. //dont want to synth for over 6000 meat if I ran out of cheap candy for whatever reason.
  56. if(currentPrice < 6000){
  57. print("Best: " + candy1 + " + " + candy2 + ". Price: " + currentPrice);
  58. sweet_synthesis(candy1.to_item(), candy2.to_item());
  59. }else{
  60. print("Best: " + candy1 + " + " + candy2 + ". Price: " + currentPrice);
  61. abort("Too expensive.");
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement