Advertisement
ereinion

best_in_slot

Dec 16th, 2018
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. int get_price(item item_to_check, float acceptable_age) {
  2.     return ((historical_age(item_to_check) <= acceptable_age)? historical_price(item_to_check) : mall_price(item_to_check));
  3. }
  4.  
  5. string to_proper_case(string s) {
  6.     return (to_upper_case(substring(s, 0, 1)) + substring(s, 1));
  7. }
  8.  
  9. void main() {
  10.     int[slot] best_in_slot_value;
  11.     item[slot] best_in_slot_item;
  12.     int current_value;
  13.     slot sl;
  14.    
  15.     foreach it in $items[] {
  16.         if (to_slot(it) != $slot[none]) {
  17.             if (it.discardable && it.tradeable) {
  18.                 if (autosell_price(it) > 0) {
  19.                     current_value = get_price(it, 0.5);
  20.                     sl = to_slot(it);
  21.                     if (best_in_slot_value[sl] < current_value) {
  22.                         best_in_slot_item[sl] = it;
  23.                         best_in_slot_value[sl] = current_value;
  24.                     }
  25.                 }
  26.             }
  27.         }
  28.     }
  29.    
  30.     foreach key in best_in_slot_item {
  31.         print_html("<font color=0000FF>" + to_proper_case(key) + " - " + to_proper_case(best_in_slot_item[key]) + ", " + best_in_slot_value[key] + " meat.</font>");
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement