Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
190 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -335,4 +335,7 @@ engineering_belt: | |
- carving knife | ||
- shaper | ||
- drawknife | ||
- rasp | ||
- rasp | ||
|
||
performance_monitor_weapons: | ||
- cutlass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |