From 0fd6104766cd7685dc1fc59f16482f4888f77adc Mon Sep 17 00:00:00 2001 From: Robert Uhl Date: Thu, 28 Apr 2016 22:45:44 -0400 Subject: [PATCH] Misc stuff --- crossing-training.lic | 2 +- dependency.lic | 14 ++-- performance-monitor.lic | 154 ++++++++++++++++++++++++++++++++++++++ profiles/Etreu-setup.yaml | 5 +- profiles/Jairne-back.yaml | 24 ++++++ 5 files changed, 190 insertions(+), 9 deletions(-) create mode 100644 performance-monitor.lic create mode 100644 profiles/Jairne-back.yaml diff --git a/crossing-training.lic b/crossing-training.lic index 978cf5137d..d9629610bd 100644 --- a/crossing-training.lic +++ b/crossing-training.lic @@ -187,7 +187,7 @@ class CrossingTraining def focus_runestone bput('get runestone', 'You get') until DRSkill.getxp('Sorcery').to_i >= 32 - bput('focus runestone', 'You focus your magical senses') + bput('focus my runestone', 'You focus your magical senses') waitrt? end bput('stow runestone', 'You put your') diff --git a/dependency.lic b/dependency.lic index e3f682a457..75bbd211f4 100644 --- a/dependency.lic +++ b/dependency.lic @@ -170,8 +170,12 @@ class ScriptManager download_script(filename) if get_versions[filename].nil? || force end + def repo_scripts + $manager.get_status['tree'].map { |element| element['path'] }.select { |file| file.include?('.lic') && !file.include?('-setup') } + end + def start_scripts(force = false) - get_versions.each { |name, _| get_script(name, force) } + repo_scripts.each { |name, _| get_script(name, force) } autostarts.each { |name| run_script(name) } end @@ -427,16 +431,12 @@ def replace_all respond 'Renaming existing scripts to replaced-script.lic.bak' managed_scripts.each { |script| File.rename('./scripts/' + script, './scripts/' + script + '.bak') } respond 'Downloading all scripts' - repo_scripts.each(&method(:get_script)) -end - -def repo_scripts - $manager.get_status['tree'].map { |element| element['path'] }.select { |file| file.include?('.lic') && !file.include?('-setup') } + $manager.repo_scripts.each(&method(:get_script)) end def managed_scripts local_scripts = Dir['./scripts/*.lic'].map { |item| File.basename(item) } - repo_scripts & local_scripts + $manager.repo_scripts & local_scripts end def list_autostarts diff --git a/performance-monitor.lic b/performance-monitor.lic new file mode 100644 index 0000000000..5d879bec0f --- /dev/null +++ b/performance-monitor.lic @@ -0,0 +1,154 @@ + +unless HAVE_GTK + respond + respond 'error: ruby-gtk bindings are not installed or failed to load' + respond + exit +end + +custom_require(%w(drinfomon textsubs)) + +class PerformanceFilter + + def initialize + @settings = get_settings() + @weapon_hits = {} + @weapon_rts = {} + @settings.performance_monitor_weapons.each{|x| @weapon_hits[x] = []; @weapon_rts[x] = [] } + @weapon_stats = [] + @last_weapon = nil + @new_hit = false + @damage_subs = [ + ['a light hit', 'a light hit (1/23)'], + ['a good hit', 'a good hit (2/23)'], + ['a good strike', 'a good strike (3/23)'], + ['a solid hit', 'a solid hit (4/23)'], + ['a hard hit', 'a hard hit (5/23)'], + ['a strong hit', 'a strong hit (6/23)'], + ['a heavy strike', 'a heavy strike (7/23)'], + ['a very heavy hit', 'a very heavy hit (8/23)'], + ['an extremely heavy hit', 'an extremely heavy hit (9/23)'], + ['a powerful strike', 'a powerful strike (10/23)'], + ['a massive strike', 'a massive strike (11/23)'], + ['an awesome strike', 'an awesome strike (12/23)'], + ['a vicious strike', 'a vicious strike (13/23)'], + ['an earth-shaking strike', 'an earth-shaking strike (14/23)'], + ['a demolishing hit', 'a demolishing hit (15/23)'], + ['a spine-rattling strike', 'a spine-rattling strike (16/23)'], + ["a devastating hit(?! \(That'll leave a mark!\))", 'a devastating hit (17/23)'], + ["a devastating hit \(That'll leave a mark!\)", "a devastating hit (That'll leave a mark!) (18/23)"], + ['an overwhelming strike', 'an overwhelming strike (19/23)'], + ['an obliterating hit', 'an obliterating hit (20/23)'], + ['an annihilating strike', 'an annihilating strike (21/23)'], + ['a cataclysmic strike', 'a cataclysmic strike (22/23)'], + ['an apocalyptic strike', 'an apocalyptic strike (23/23)'] + ] + end + + def weapon_list + @settings.performance_monitor_weapons + end + + def process_line(line) + @damage_subs.each{|x| line.gsub!(x.first, x.last) } + @settings.performance_monitor_weapons.each do |weapon_name| + next unless /^\<.*\b#{weapon_name}\b.*\((\d+)\/23\)/ =~ line + @weapon_hits[weapon_name].push($1.to_i) + @last_weapon = weapon_name + @new_hit = true + break + end + if @new_hit && /roundtime.*(\d+)/i =~ line + @new_hit = false + @weapon_rts[@last_weapon].push($1.to_i) + update_stats + true + else + false + end + end + + def update_stats + @weapon_stats = [] + @weapon_hits.each do |weapon, hits| + dmg = hits.inject(&:+) + rt = @weapon_rts[weapon].inject(&:+) + @weapon_stats.push({weapon:weapon, avgrt:rt*1.0/hits.size, avgdps:dmg*1.0/rt}) + end + end + + def weapon_stats + @weapon_stats + end +end + +def update_stat_bar(entry, data) + entry.text = "#{data[:weapon]}:\tavg RT:#{data[:avgrt].round(1)}\tavg DPS:#{data[:avgdps].round(1)}" +end + +filter = PerformanceFilter.new +window = nil +window_done = false +load_window_position = CharSettings['window_position'] || [] +load_window_width = CharSettings['window_width'] || 300 +load_window_height = CharSettings['window_height'] || 100 +window_title = "#{checkname} Performance Monitor" +save_window_position = nil +save_window_width = nil +save_window_height = nil +healthbar_ets = [] + +before_dying do + CharSettings['window_position'] = save_window_position if (save_window_position.class == Array) && (save_window_position[0].to_i >= 0) && (save_window_position[1].to_i >= 0) + CharSettings['window_width'] = save_window_width if (save_window_width.class == Fixnum) && (save_window_width > 100) + CharSettings['window_height'] = save_window_height if (save_window_height.class == Fixnum) && (save_window_height > 100) + Gtk.queue { window.destroy } +end + +begin + weapon_ets = {} + + Gtk.queue do + vbox = Gtk::VBox.new + filter.weapon_list.each do |weapon| + stats_et = Gtk::Entry.new + stats_et.editable = false + display_font = Pango::FontDescription.new + display_font.weight = Pango::FontDescription::WEIGHT_BOLD + stats_et.modify_font(display_font) + weapon_ets[weapon] = stats_et + vbox.pack_start(stats_et) + end + + window = Gtk::Window.new + window.title = window_title + window.keep_above = true + window.border_width = 1 + window.resize(load_window_width, load_window_height) + unless load_window_position.empty? + window.move(load_window_position[0], load_window_position[1]) + end + window.add(vbox) + + window.signal_connect('delete_event') do + save_window_position = window.position + save_window_width = window.allocation.width + save_window_height = window.allocation.height + window_done = true + end + window.show_all + end + + loop do + line = script.gets? + break if window_done + pause 0.05 unless line + next unless line + + if filter.process_line(line) + filter.weapon_stats.each do |data| + update_stat_bar(weapon_ets[data[:weapon]], data) + end + end + end +end diff --git a/profiles/Etreu-setup.yaml b/profiles/Etreu-setup.yaml index d51ff3d1a4..56ab6fe71a 100644 --- a/profiles/Etreu-setup.yaml +++ b/profiles/Etreu-setup.yaml @@ -335,4 +335,7 @@ engineering_belt: - carving knife - shaper - drawknife - - rasp \ No newline at end of file + - rasp + +performance_monitor_weapons: +- cutlass \ No newline at end of file diff --git a/profiles/Jairne-back.yaml b/profiles/Jairne-back.yaml new file mode 100644 index 0000000000..52f5c23b3a --- /dev/null +++ b/profiles/Jairne-back.yaml @@ -0,0 +1,24 @@ +combat_trainer_target_increment: 10 +combat_trainer_action_count: 40 +offensive_spells: +- skill: Debilitation + name: Sleep + abbrev: sleep + mana: 6 +buff_spells: + Moonblade: + abbrev: moonblade + moon: true + recast_every: 600 + mana: 16 +dance_skill: Small Edged +weapon_training: + Staves: moonstaff + Twohanded Edged: moonblade + Large Edged: moonblade + Small Edged: moonblade + summoned_weapons: + - name: Small Edged + - name: Staves + - name: Twohanded Edged + - name: Large Edged \ No newline at end of file