forked from elanthia-online/dr-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbootstrap.lic
36 lines (31 loc) · 1.42 KB
/
bootstrap.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
# quiet
=begin
Documentation: https://elanthipedia.play.net/Lich_script_development#bootstrap
=end
class_defs = { 'equipmanager' => :EquipmentManager, 'common' => :DRC, 'common-travel' => :DRCT, 'common-crafting' => :DRCC, 'common-summoning' => :DRCS, 'common-money' => :DRCM, 'common-arcana' => :DRCA, 'common-items' => :DRCI, 'common-healing' => :DRCH, 'common-validation' => :CharacterValidator }
arg_definitions = [[{ name: 'wipe_constants', regex: /wipe_constants/i, optional: true }]]
args = parse_args(arg_definitions, true)
if args.wipe_constants
class_defs.values.each { |symb| Scripting.send(:remove_const, symb) if Scripting.constants.include?(symb) }
exit
end
scripts_to_run = args.flex
echo scripts_to_run.to_s if UserVars.bootstrap_debug
until scripts_to_run.empty?
script_to_run = scripts_to_run.shift
respond("BS:#{script_to_run}:#{scripts_to_run}") if UserVars.bootstrap_debug
next if Script.running?(script_to_run) || (class_defs[script_to_run] && Scripting.constants.include?(class_defs[script_to_run]))
respond("BS:Running #{script_to_run}") if UserVars.bootstrap_debug
exit unless verify_script(scripts_to_run)
start_script(script_to_run)
pause 0.05
snapshot = Time.now
if class_defs[script_to_run]
pause 0.05 until Scripting.constants.include?(class_defs[script_to_run])
pause 0.05
else
until !Script.running?(script_to_run) || Time.now - snapshot > 0.25
pause 0.05
end
end
end