Advertisement
Luxie

Temp Fix to mybounty for GemStoneIV

Aug 2nd, 2021
1,826
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 9.79 KB | None | 0 0
  1. =begin
  2. ;mybounty
  3. by Luxelle
  4.  
  5. GTK setup pulled from Bigshot & Dreavening. All credit goes to Azanoth, SpiffyJr, Tillmen Dreaven for this great code!
  6.  
  7. MyBounty
  8. 18 Sept 2017 ~ 20 Sept 2017
  9. 2 August 2021 ~ temp fix after PSM 3 busted it. You are going to need to babysit your own BOOST BOUNTY
  10.  
  11. Asks for a bounty at the Adventurer's Guild until you get the bounty/bounties you want. Meant for use with BOOST BOUNTY and especially handy for Lumnis Contest weeks.
  12.  
  13.     author: Luxelle
  14.     game: Gemstone
  15.     tags: bounty, gems, herbs, specific, lumnis, contest, boost bounty, bounty boost, exclude bounties, bounties, skins, limit
  16.     version: 2.1 - cleaned up testing errors from 2.0  oops!
  17.     Tested in: Ta'Illistim, Ta'Vaalor, Wehnimer's
  18.  
  19.     Notes: to keep the bounties you want you need to first use:  ;mybounty setup
  20.  
  21.     Thanks: Mice, Selandriel, Atanamir, Ondrein, and Pukk
  22.             and a big thanks to Pukk for adding the GUI Setup <3
  23.  
  24.     Usage: ;mybounty
  25. =end
  26.  
  27. def message(message)
  28.     if $fake_stormfront then puts("\034GSL\r\n") else puts("<pushBold\/>") end
  29.     puts("" + message)
  30.     if $fake_stormfront then puts("\034GSM\r\n") else puts("<popBold\/>") end
  31. end
  32.  
  33. setup = proc{
  34.     Gtk.queue {
  35.         $MB_WINDOW = Gtk::Window.new
  36.         $MB_WINDOW.title = "Mybounty Setup"
  37.         $MB_WINDOW.set_border_width(10)
  38.         $MB_BOX = Gtk::VBox.new(false)
  39.         $MB_BOX.set_border_width(5)
  40.  
  41.         $MB_VERTICAL_BOX1 = Gtk::VBox.new(false, 0)
  42.  
  43.         $MB_WINDOW.add($MB_BOX)
  44.         $MB_NOTEBOOK = Gtk::Notebook.new
  45.         $MB_NOTEBOOK.set_show_border(true)
  46.         $MB_BOX.add($MB_NOTEBOOK)
  47.         $MB_NOTEBOOK.append_page($MB_VERTICAL_BOX1, Gtk::Label.new('Bounties'))
  48.  
  49.         $MB_ENTRY = Hash.new
  50.         $MB_TABLE_SIZE = Hash.new
  51.     }
  52.  
  53.     Gtk.queue {
  54.         $MB_TABLE1 = Gtk::Table.new(6, 3, false)
  55.         $MB_TABLE1.row_spacings=3
  56.         $MB_TABLE1.column_spacings=3
  57.         $MB_VERTICAL_BOX1.pack_start($MB_TABLE1, false, false, 0)
  58.  
  59.     }
  60.  
  61.     def self.add_label_entry(table, label, variable)
  62.         size = $MB_TABLE_SIZE[table] || 0
  63.  
  64.         label = Gtk::Label.new(label)
  65.         align = Gtk::Alignment.new 1, 0, 0, 0
  66.         align.set_padding(4, 0, 3, 4)
  67.         align.add(label)
  68.         table.attach(align, 0, 1, size, size + 1)
  69.  
  70.         entry = Gtk::Entry.new
  71.         entry.text = UserVars.mybounty[variable].to_s
  72.         entry.set_width_request(157)
  73.         table.attach(entry, 1, 2, size, size + 1)
  74.  
  75.         $MB_ENTRY[variable] = entry
  76.         $MB_TABLE_SIZE[table] += 1
  77.     end
  78.  
  79.     Gtk.queue {
  80.         $MB_ENTRY = Hash.new
  81.         add_label_entry($MB_TABLE1, "Gems:", 'gems_setup')
  82.         add_label_entry($MB_TABLE1, "Forage:", 'forage_setup')
  83.         add_label_entry($MB_TABLE1, "Furrier:", 'furrier_setup')
  84.         add_label_entry($MB_TABLE1, "Rescue Child:", 'kidrescue_setup')
  85.         add_label_entry($MB_TABLE1, "creature Problem:", 'creature_setup')
  86.         add_label_entry($MB_TABLE1, "Bandits:", 'bandit_setup')
  87.         add_label_entry($MB_TABLE1, "Escorts:", 'escort_setup')
  88.         add_label_entry($MB_TABLE1, "Heirloom:", 'heirloom_setup')
  89.  
  90.     }
  91.  
  92.        
  93.     Gtk.queue {
  94.         $MB_WINDOW.signal_connect("delete_event") {
  95.             $MB_SETUP_COMPLETED = true
  96.         }
  97.     }
  98.        
  99.     Gtk.queue {
  100.         $MB_TOOLTIPS = Gtk::Tooltips.new
  101.         $MB_TOOLTIPS.enable
  102.  
  103.         label = Gtk::Label.new
  104.         label.set_markup("Leave blank if you don't want to do that bounty, otherwise enter <b>YES</b>")
  105.         align = Gtk::Alignment.new(1, 0, 0, 0)
  106.         align.set_padding(5, 0, 0, 25)
  107.         align.add(label)
  108.         $MB_TABLE1.attach(align, 1, 2, 9, 10)
  109.  
  110.         $MB_WINDOW.show_all
  111.     }
  112.        
  113.     $MB_SETUP_COMPLETED = false
  114.     until($MB_SETUP_COMPLETED)
  115.         sleep 1
  116.     end
  117.        
  118.     UserVars.mybounty ||= Hash.new
  119.     $MB_ENTRY.keys.each { |key|
  120.         if( $MB_ENTRY[key].class.to_s =~ /CheckButton/ )
  121.             value = $MB_ENTRY[key].active?
  122.             UserVars.mybounty[key] = $MB_ENTRY[key].active?
  123.         else
  124.             if(key == 'wounded_eval')
  125.                 UserVars.mybounty[key] = $MB_ENTRY[key].text
  126.             else
  127.                 UserVars.mybounty[key] = $MB_ENTRY[key].text.strip.downcase
  128.             end
  129.         end
  130.     }
  131.     UserVars.save()
  132.        
  133.     Gtk.queue {
  134.         $MB_WINDOW.destroy
  135.     }
  136. }
  137.  
  138.  
  139. ################
  140. ## Help
  141. ################################################
  142.  
  143. def usage
  144.         respond ""
  145.         respond "Start this script at the Adventurer's Guild Taskmaster and it will ask for bounties until you get the one/s you want."
  146.         respond "Remember to use BOUNTY BOOST for the script to continue. ;mybounty will remove your current bounty, no matter what it is, but not use a boost or move you."
  147.         respond ""
  148.         respond "Set your desired bounty/bounties first with: ;mybounty setup"
  149.         respond ""
  150.         respond "Usage, at the Adventurer's Guild: ;mybounty"
  151.         respond ""
  152.         exit
  153. end
  154.  
  155.  
  156. if script.vars[1] == "setup"
  157.     setup.call
  158.     exit
  159. elsif script.vars[1] == "help"
  160.     usage
  161. elsif script.vars[1] == "?"
  162.     usage
  163. elsif script.vars[1] =~ /(.*)/
  164.     message("Usage is:
  165. ;mybounty setup
  166. ;mybounty help
  167. ;mybounty ?")
  168.     exit
  169. end
  170.  
  171. unless Room.current.tags.include? 'advguild'
  172.     echo "Wrong place, get thee to the advguild."
  173.     exit
  174. end
  175.  
  176. echo = false
  177. gems = false   
  178. forage = false
  179. furrier = false
  180. kidrescue = false
  181. creature = false
  182. bandit = false
  183. escort = false
  184. heirloom = false
  185.  
  186. if UserVars.mybounty["gems_setup"] =~ /yes/i
  187.     gems = true
  188.     message("Gems: Yes")
  189.     setup = true
  190. else
  191.     gems = false
  192. end
  193.  
  194. if UserVars.mybounty["forage_setup"] =~ /yes/i
  195.     forage = true
  196.     message("Forage: Yes")
  197.     setup = true
  198. else
  199.     forage = false
  200. end
  201.  
  202. if UserVars.mybounty["furrier_setup"] =~ /yes/i
  203.     furrier = true
  204.     message("Furrier: Yes")
  205.     setup = true
  206. else
  207.     furrier = false
  208. end
  209.  
  210. if UserVars.mybounty["kidrescue_setup"] =~ /yes/i
  211.     kidrescue = true
  212.     message("Kidrescue: Yes")
  213.     setup = true
  214. else
  215.     kidrescue = false
  216. end
  217.  
  218. if UserVars.mybounty["creature_setup"] =~ /yes/i
  219.     creature = true
  220.     message("Creature: Yes")
  221.     setup = true
  222. else
  223.     creature = false
  224. end
  225.  
  226. if UserVars.mybounty["bandit_setup"] =~ /yes/i
  227.     bandit = true
  228.     message("Bandit: Yes")
  229.     setup = true
  230. else
  231.     bandit = false
  232. end
  233.  
  234. if UserVars.mybounty["escort_setup"] =~ /yes/i
  235.     escort = true
  236.     message("Escort: Yes")
  237.     setup = true
  238. else
  239.     escort = false
  240. end
  241.  
  242. if UserVars.mybounty["heirloom_setup"] =~ /yes/i
  243.     heirloom = true
  244.     message("Heirloom: Yes")
  245.     setup = true
  246. else
  247.     heirloom = false
  248. end
  249.  
  250. if gems == false && forage == false && furrier == false && kidrescue == false && creature == false && bandit == false && escort == false && heirloom == false
  251.     message("You have nothing setup! Exiting!")
  252.     exit
  253. end
  254.  
  255. ##############
  256. # HERE WE GO! Look for just the bounty/ties you want
  257. # Check for current bounty and remove it if it is found, make sure Boost is going
  258. ################################################
  259. if XMLData.bounty_task != "You are not currently assigned a task."
  260. fput "ask taskmaster for remov"
  261. fput "ask taskmaster for remov"
  262. end
  263.  
  264. # if XMLData.active_spells.count {|spell| spell[0] =~ /Bounty Boost/ } > 0
  265. #   echo "Bounty Boost Active ... continuing..."
  266. # else
  267. # echo "Use a BOOST BOUNTY and call me back, kay?"
  268. # exit
  269. # end
  270. ##############
  271. # Get the right bounty here!
  272. ################################################
  273.  
  274. if setup == true
  275.     fput "ask taskmaster for bounty"
  276.  
  277.     while line = get
  278.         if line =~ /bandit/ and bandit == true
  279.           echo "Got Your Bandits Right here!"
  280.           break
  281.         elsif line =~ /bandit/ and bandit == false
  282.           echo "Refusing this bounty ..."
  283.           sleep 0.2
  284.           fput "ask taskmaster for remov"
  285.           fput "ask taskmaster for remov"
  286.           sleep 4
  287.           fput "ask taskmaster for bounty"
  288.         end
  289.  
  290.         if line =~ /creature problem/ and creature == true
  291.           echo "Got Your Creatures Right here!"
  292.           break
  293.         elsif line =~ /creature problem/ and creature == false
  294.               echo "Refusing this bounty ..."
  295.           sleep 0.2
  296.           fput "ask taskmaster for remov"
  297.           fput "ask taskmaster for remov"
  298.           sleep 4
  299.           fput "ask taskmaster for bounty"
  300.         end
  301.  
  302.         if line =~ /urgently needs/ and kidrescue == true
  303.           echo "Got your rescue right here!"
  304.           break
  305.         elsif line =~ /urgently needs/ and kidrescue == false
  306.           echo "Refusing this bounty ..."
  307.           sleep 0.2
  308.           fput "ask taskmaster for remov"
  309.           fput "ask taskmaster for remov"
  310.           sleep 4
  311.           fput "ask taskmaster for bounty"
  312.         end
  313.  
  314.         if line =~ /lost heirloom/ and heirloom == true
  315.           echo "Got your heirloom right here!"
  316.           break
  317.         elsif line =~ /lost heirloom/ and heirloom == false
  318.           echo "Refusing this bounty ..."
  319.           sleep 0.2
  320.           fput "ask taskmaster for remov"
  321.           fput "ask taskmaster for remov"
  322.           sleep 4
  323.           fput "ask taskmaster for bounty"
  324.         end
  325.  
  326.         if line =~ /local herbalist|local healer|local alchemist/ and forage == true
  327.           echo "Got your foraging task right here!"
  328.           break
  329.         elsif line =~ /local herbalist|local healer|local alchemist/ and forage == false
  330.           echo "Refusing this bounty ..."
  331.           sleep 0.2
  332.           fput "ask taskmaster for remov"
  333.           fput "ask taskmaster for remov"
  334.           sleep 4
  335.           fput "ask taskmaster for bounty"
  336.         end
  337.  
  338.         if line =~ /local furrier/ and furrier == true
  339.           echo "Got your skinning task right here!"
  340.           break
  341.         elsif line =~ /local furrier/ and furrier == false
  342.           echo "Refusing this bounty ..."
  343.           sleep 0.2
  344.           fput "ask taskmaster for remov"
  345.           fput "ask taskmaster for remov"
  346.           sleep 4
  347.           fput "ask taskmaster for bounty"
  348.         end
  349.  
  350.         if line =~ /gem dealer/ and gems == true
  351.          echo "Got your gem task right here!"
  352.           break
  353.         elsif line =~ /gem dealer/ and gems == false
  354.           echo "Refusing this bounty ..."
  355.           sleep 0.2
  356.           fput "ask taskmaster for remov"
  357.           fput "ask taskmaster for remov"
  358.           sleep 4
  359.           fput "ask taskmaster for bounty"
  360.         end
  361.  
  362.         if line =~ /protective escort/ and escort == true
  363.           echo "Got your escort task right here!"
  364.           break
  365.         elsif line =~ /protective escort/ and escort == false
  366.           echo "Refusing this bounty ..."
  367.           sleep 0.2
  368.           fput "ask taskmaster for remov"
  369.           fput "ask taskmaster for remov"
  370.           sleep 4
  371.           fput "ask taskmaster for bounty"
  372.         end
  373.  
  374.         if line =~ /annoyed and says/
  375.           sleep 2
  376.           fput "ask taskmaster for bounty"
  377.         end
  378.  
  379.     end
  380. else
  381.     exit
  382. end
  383.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement