-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathinactivespells.lic
88 lines (76 loc) · 2.36 KB
/
inactivespells.lic
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
=begin
Shows all your inactive spells in a window.
author: Tillmen ([email protected])
game: Gemstone
tags: magic
version: 0.1
=end
no_kill_all
no_pause_all
hide_me
Settings.load
window_width = Settings['window_width'] || 120
window_height = Settings['window_height'] || 25
window_position = Settings['window_position']
bars = Hash.new
duration = Hash.new
window = bar_box = done = window_close = last_stamina = nil
Gtk.queue {
window = Gtk::Window.new
window.title = 'inactive spells'
window.signal_connect('delete_event') { window_close = true }
bar_box = Gtk::VBox.new
window.add(bar_box)
window.show_all
window.resize(window_width.to_i, window_height.to_i)
window_position[0] = [[0, window_position[0].to_i].max, (Gdk.screen_width-window_width.to_i)].min
window_position[1] = [[0, window_position[1].to_i].max, (Gdk.screen_height-window_height.to_i)].min
window.move(window_position[0].to_i, window_position[1].to_i)
window.keep_above = true
done = true
}
wait_until { done }
before_dying {
done = false
Gtk.queue {
window_width = window.allocation.width
window_height = window.allocation.height
window_position = window.position
window.destroy
done = true
}
wait_until { done }
Settings['window_width'] = window_width
Settings['window_height'] = window_height
Settings['window_position'] = window_position if (window_position.class == Array) and (window_position[0].to_i > -5) and (window_position[1].to_i > -5)
Settings.save
}
until window_close
Spell.active.each { |spell|
Gtk.queue {
unless bars[spell.num]
duration[spell.num] = proc { eval(spell.duration).to_f }.call unless spell.stacks
bars[spell.num] = Gtk::ProgressBar.new
bars[spell.num].height_request = 17
#bars[spell.num].width_request = 200
bar_box.pack_end(bars[spell.num], false, false, 0)
bars[spell.num].show
end
if spell.stacks
if (spell.num == 9710) or (spell.num == 9711) or (spell.num == 9719)
bars[spell.num].fraction = spell.timeleft/3.0
else
bars[spell.num].fraction = spell.timeleft/250.0
end
else
bars[spell.num].fraction = spell.timeleft/duration[spell.num]
end
bars[spell.num].text = "#{spell.name} #{spell.remaining}"
}
}
active = Spell.active.collect { |spell| spell.num }
bars.each_pair { |num,bar|
Gtk.queue { bar.destroy; bars.delete(num) } unless active.include?(num)
}
sleep 3
end