Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Finds cheapest combo to create synthesis greed and treats untradables
- //as zero cost(as long as you own some) because I have no idea how to change
- //their price in mafia and that is the entire reason I wrote this garbage.
- boolean [item] complexCandy;
- foreach it in $items[]{
- if (!it.candy){ continue; }
- if (it.candy_type == "complex"){
- complexCandy[it] = true;
- }
- }
- static boolean [item] sugarBreak = $items[sugar chapeau,sugar shank,sugar shirt,sugar shorts,sugar shotgun,sugar shillelagh,sugar shield];
- int currentPrice = 10000;
- int totalPrice;
- int mallPrice1;
- int mallPrice2;
- string candy1;
- string candy2;
- foreach i in complexCandy{
- foreach j in complexCandy{
- if((i.to_int() + j.to_int()) % 5 == 0){
- if(item_amount(i) < 1 && !is_tradeable(i)){
- continue;
- }
- if(item_amount(j) < 1 && !is_tradeable(j)){
- continue;
- }
- mallprice1 = historical_age(i) > 3.0 ? mall_price(i) : historical_price(i);
- mallprice2 = historical_age(j) > 3.0 ? mall_price(j) : historical_price(j);
- if(sugarBreak contains i && item_amount(i) < 1){
- mallprice1 = mall_price($item[sugar sheet]);
- }
- if(sugarBreak contains j && item_amount(j) < 1){
- mallprice2 = mall_price($item[sugar sheet]);
- }
- totalPrice = mallPrice1 + mallPrice2;
- if(totalPrice < currentPrice){
- currentPrice = totalPrice;
- candy1 = i;
- candy2 = j;
- }
- }
- }
- }
- //dont want to synth for over 3000 meat if I ran out of cheap candy for whatever reason.
- if(currentPrice < 3000){
- sweet_synthesis(candy1.to_item(), candy2.to_item());
- }else{
- print("Best: " + candy1 + " + " + candy2 + ". Price: " + currentPrice);
- abort("Too expensive.");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement