From 7f071c6ae8c165d2953240908a11b674ee05bade Mon Sep 17 00:00:00 2001 From: Mahtra <93822896+MahtraDR@users.noreply.github.com> Date: Wed, 13 Nov 2024 12:35:28 +1300 Subject: [PATCH 01/19] [scripts][dependency] Cleanup backup repo config --- dependency.lic | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/dependency.lic b/dependency.lic index c60737e984..fd0b943060 100644 --- a/dependency.lic +++ b/dependency.lic @@ -10,7 +10,7 @@ require 'ostruct' require 'digest/sha1' require 'monitor' -$DEPENDENCY_VERSION = '1.7.6' +$DEPENDENCY_VERSION = '1.7.7' $MIN_RUBY_VERSION = '3.2.2' DRINFOMON_IN_CORE_LICH ||= false @@ -206,7 +206,7 @@ class ScriptManager @paste_bin_url = 'https://pastebin.com/api/api_post.php' @firebase_url = 'https://dr-scripts.firebaseio.com/' @status_repo = Settings['status_repo'] || 'rpherbig/dr-scripts' - @status_branch = Settings['status_branch'] || 'master' + @status_branch = Settings['status_branch'] || 'main' update_status_url # Gating setting lich_url on lich version @@ -244,11 +244,11 @@ class ScriptManager def update_status_url defaulturl = 'https://api.github.com/repos/' + @status_repo + '/git/trees/' + @status_branch mainurl = 'https://api.github.com/repos/rpherbig/dr-scripts/git/trees/main' - fallbackurl = 'https://api.github.com/repos/rpherbig/dr-scripts/git/trees/master' + fallbackurl = 'https://api.github.com/repos/rpherbig/dr-scripts/git/trees/main' eo_drscripts = 'https://api.github.com/repos/elanthia-online/dr-scripts/git/trees/main' unless url_exist?(defaulturl) - _respond Lich::Messaging.monsterbold("Default URL #{defaulturl} not responding. Using an alternate repo+branch combindation.") + _respond Lich::Messaging.monsterbold("Default URL #{defaulturl} not responding. Using an alternate repo+branch combination.") _respond Lich::Messaging.monsterbold("Unsetting custom repo settings, if any.") Settings['status_repo'] = nil if Settings['status_repo'] Settings['status_branch'] = nil if Settings['status_branch'] @@ -295,7 +295,7 @@ class ScriptManager def unset_custom_status @status_repo = 'rpherbig/dr-scripts' - @status_branch = 'master' + @status_branch = 'main' update_status_url end @@ -1713,7 +1713,7 @@ def stop_autostart(script_names) end end -def set_custom_status_repo(repo, branch = 'master') +def set_custom_status_repo(repo, branch = 'main') $manager.set_custom_status_repo(repo, branch) end From 171bab5e22a1323fdf44bd6e58aa41427bfc1db5 Mon Sep 17 00:00:00 2001 From: Mahtra <93822896+MahtraDR@users.noreply.github.com> Date: Wed, 13 Nov 2024 13:12:57 +1300 Subject: [PATCH 02/19] [scripts][dependency] Tweaks and futureproofing --- dependency.lic | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/dependency.lic b/dependency.lic index fd0b943060..bc07f24ff6 100644 --- a/dependency.lic +++ b/dependency.lic @@ -10,7 +10,7 @@ require 'ostruct' require 'digest/sha1' require 'monitor' -$DEPENDENCY_VERSION = '1.7.7' +$DEPENDENCY_VERSION = '1.7.8' $MIN_RUBY_VERSION = '3.2.2' DRINFOMON_IN_CORE_LICH ||= false @@ -244,7 +244,6 @@ class ScriptManager def update_status_url defaulturl = 'https://api.github.com/repos/' + @status_repo + '/git/trees/' + @status_branch mainurl = 'https://api.github.com/repos/rpherbig/dr-scripts/git/trees/main' - fallbackurl = 'https://api.github.com/repos/rpherbig/dr-scripts/git/trees/main' eo_drscripts = 'https://api.github.com/repos/elanthia-online/dr-scripts/git/trees/main' unless url_exist?(defaulturl) @@ -260,9 +259,6 @@ class ScriptManager elsif url_exist?(mainurl) _respond Lich::Messaging.monsterbold("Using alternate Status URL. #{mainurl}") @status_url = mainurl - elsif url_exist?(fallbackurl) - _respond Lich::Messaging.monsterbold("Using fallback Status URL. #{fallbackurl}") - @status_url = fallbackurl elsif url_exist?(eo_drscripts) _respond Lich::Messaging.monsterbold("Using Elanthia Online Status URL. #{eo_drscripts}") @status_url = eo_drscripts @@ -1602,13 +1598,14 @@ def format_yaml_name(name) end def custom_require + if DRINFOMON_IN_CORE_LICH + echo("DRInfomon in core lich detected. Skipping loading drinfomon and commons.") if UserVars.bootstrap_debug + return + end + lambda do |script_names| script_names = [script_names] unless script_names.is_a?(Array) respond("CR:starting:#{script_names}") if UserVars.bootstrap_debug - if DRINFOMON_IN_CORE_LICH - echo("DRInfomon in core lich detected. Skipping loading drinfomon.lic") if UserVars.bootstrap_debug - script_names -= ['drinfomon'] - end bootstrapper = force_start_script('bootstrap', script_names) pause 0.05 while Script.running.include?(bootstrapper) @@ -1734,6 +1731,7 @@ def setup_profiles end def setup_data + echo("Force checking scripts/data files.") $manager.setup_data end @@ -1783,7 +1781,7 @@ end def update_d echo('Restarting Dependency in 2 seconds...') - force_start_script('bootstrap', ['wipe_constants']) + force_start_script('bootstrap', ['wipe_constants']) unless DRINFOMON_IN_CORE_LICH before_dying do sleep 2 force_start_script('dependency') @@ -1833,7 +1831,7 @@ end full_install if install -force_start_script('bootstrap', ['wipe_constants']) +force_start_script('bootstrap', ['wipe_constants']) unless DRINFOMON_IN_CORE_LICH # Proactively starting DRinfomon as script zero to prevent # race conditions involving this script which so many other @@ -1849,7 +1847,7 @@ end if DRINFOMON_IN_CORE_LICH Lich::Util.issue_command("exp all 0", /^Circle: \d+/, /^Rested EXP Stored|Unlock Rested Experience|type: AWAKEN/, quiet: true) Lich::Util.issue_command("info", /^Name/, /^ Date: Wed, 13 Nov 2024 13:19:24 +1300 Subject: [PATCH 03/19] tweak --- dependency.lic | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependency.lic b/dependency.lic index bc07f24ff6..359dfa160f 100644 --- a/dependency.lic +++ b/dependency.lic @@ -1599,7 +1599,7 @@ end def custom_require if DRINFOMON_IN_CORE_LICH - echo("DRInfomon in core lich detected. Skipping loading drinfomon and commons.") if UserVars.bootstrap_debug + echo("DRInfomon in core lich detected. Skipping loading drinfomon and commons.") return end From fff412c17a4e02ab267aa7fb388de0f150ff58f9 Mon Sep 17 00:00:00 2001 From: Mahtra <93822896+MahtraDR@users.noreply.github.com> Date: Wed, 13 Nov 2024 13:26:23 +1300 Subject: [PATCH 04/19] tweak --- dependency.lic | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependency.lic b/dependency.lic index 359dfa160f..4ab089126c 100644 --- a/dependency.lic +++ b/dependency.lic @@ -1847,7 +1847,7 @@ end if DRINFOMON_IN_CORE_LICH Lich::Util.issue_command("exp all 0", /^Circle: \d+/, /^Rested EXP Stored|Unlock Rested Experience|type: AWAKEN/, quiet: true) Lich::Util.issue_command("info", /^Name/, /^ Date: Wed, 13 Nov 2024 13:49:26 +1300 Subject: [PATCH 05/19] tweak --- dependency.lic | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dependency.lic b/dependency.lic index 4ab089126c..65dcc92edd 100644 --- a/dependency.lic +++ b/dependency.lic @@ -251,6 +251,7 @@ class ScriptManager _respond Lich::Messaging.monsterbold("Unsetting custom repo settings, if any.") Settings['status_repo'] = nil if Settings['status_repo'] Settings['status_branch'] = nil if Settings['status_branch'] + Settings.save end if url_exist?(defaulturl) @@ -1850,8 +1851,8 @@ if DRINFOMON_IN_CORE_LICH Lich::Util.issue_command("ability", /^You (know the Berserks|recall the spells you have learned from your training)/, /^You (recall that you have \d+ training sessions|can use SPELL STANCE \[HELP\]|have \d+ available slot)/, quiet: true) end -$manager.check_base_files -$manager.check_data_files +# $manager.check_base_files +# $manager.check_data_files $manager.start_scripts $manager.make_map_edits From a1b5e9ad038a8c3bc8949283b0965acebc7fe69e Mon Sep 17 00:00:00 2001 From: Mahtra <93822896+MahtraDR@users.noreply.github.com> Date: Wed, 13 Nov 2024 13:50:40 +1300 Subject: [PATCH 06/19] tweak --- dependency.lic | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dependency.lic b/dependency.lic index 65dcc92edd..e61c413cc9 100644 --- a/dependency.lic +++ b/dependency.lic @@ -1851,8 +1851,8 @@ if DRINFOMON_IN_CORE_LICH Lich::Util.issue_command("ability", /^You (know the Berserks|recall the spells you have learned from your training)/, /^You (recall that you have \d+ training sessions|can use SPELL STANCE \[HELP\]|have \d+ available slot)/, quiet: true) end -# $manager.check_base_files -# $manager.check_data_files +$manager.check_base_files +$manager.check_data_files $manager.start_scripts $manager.make_map_edits From 61e4d769ec9110a2a66a7a687bfa7165ecae3631 Mon Sep 17 00:00:00 2001 From: Mahtra <93822896+MahtraDR@users.noreply.github.com> Date: Wed, 13 Nov 2024 13:54:04 +1300 Subject: [PATCH 07/19] tweak --- dependency.lic | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/dependency.lic b/dependency.lic index e61c413cc9..96d0f3148a 100644 --- a/dependency.lic +++ b/dependency.lic @@ -1599,14 +1599,13 @@ def format_yaml_name(name) end def custom_require - if DRINFOMON_IN_CORE_LICH - echo("DRInfomon in core lich detected. Skipping loading drinfomon and commons.") - return - end - lambda do |script_names| script_names = [script_names] unless script_names.is_a?(Array) respond("CR:starting:#{script_names}") if UserVars.bootstrap_debug + if DRINFOMON_IN_CORE_LICH + echo("DRInfomon in core lich detected. Skipping loading drinfomon and commons") if UserVars.bootstrap_debug + script_names -= %W(drinfomon common common-arcana common-crafting common-healing common-healing-data common-items common-money common-moonmage common-summoning common-theurgy common-travel common-validation events slackbot equipmanager spellmonitor) + end bootstrapper = force_start_script('bootstrap', script_names) pause 0.05 while Script.running.include?(bootstrapper) From bb34244cef8ad9548adc7a63315adb714501dfe2 Mon Sep 17 00:00:00 2001 From: Mahtra <93822896+MahtraDR@users.noreply.github.com> Date: Wed, 13 Nov 2024 09:19:35 +0800 Subject: [PATCH 08/19] Revert "[scripts][dependency] Tweaks and futureproofing" --- dependency.lic | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/dependency.lic b/dependency.lic index 96d0f3148a..fd0b943060 100644 --- a/dependency.lic +++ b/dependency.lic @@ -10,7 +10,7 @@ require 'ostruct' require 'digest/sha1' require 'monitor' -$DEPENDENCY_VERSION = '1.7.8' +$DEPENDENCY_VERSION = '1.7.7' $MIN_RUBY_VERSION = '3.2.2' DRINFOMON_IN_CORE_LICH ||= false @@ -244,6 +244,7 @@ class ScriptManager def update_status_url defaulturl = 'https://api.github.com/repos/' + @status_repo + '/git/trees/' + @status_branch mainurl = 'https://api.github.com/repos/rpherbig/dr-scripts/git/trees/main' + fallbackurl = 'https://api.github.com/repos/rpherbig/dr-scripts/git/trees/main' eo_drscripts = 'https://api.github.com/repos/elanthia-online/dr-scripts/git/trees/main' unless url_exist?(defaulturl) @@ -251,7 +252,6 @@ class ScriptManager _respond Lich::Messaging.monsterbold("Unsetting custom repo settings, if any.") Settings['status_repo'] = nil if Settings['status_repo'] Settings['status_branch'] = nil if Settings['status_branch'] - Settings.save end if url_exist?(defaulturl) @@ -260,6 +260,9 @@ class ScriptManager elsif url_exist?(mainurl) _respond Lich::Messaging.monsterbold("Using alternate Status URL. #{mainurl}") @status_url = mainurl + elsif url_exist?(fallbackurl) + _respond Lich::Messaging.monsterbold("Using fallback Status URL. #{fallbackurl}") + @status_url = fallbackurl elsif url_exist?(eo_drscripts) _respond Lich::Messaging.monsterbold("Using Elanthia Online Status URL. #{eo_drscripts}") @status_url = eo_drscripts @@ -1603,8 +1606,8 @@ def custom_require script_names = [script_names] unless script_names.is_a?(Array) respond("CR:starting:#{script_names}") if UserVars.bootstrap_debug if DRINFOMON_IN_CORE_LICH - echo("DRInfomon in core lich detected. Skipping loading drinfomon and commons") if UserVars.bootstrap_debug - script_names -= %W(drinfomon common common-arcana common-crafting common-healing common-healing-data common-items common-money common-moonmage common-summoning common-theurgy common-travel common-validation events slackbot equipmanager spellmonitor) + echo("DRInfomon in core lich detected. Skipping loading drinfomon.lic") if UserVars.bootstrap_debug + script_names -= ['drinfomon'] end bootstrapper = force_start_script('bootstrap', script_names) pause 0.05 @@ -1731,7 +1734,6 @@ def setup_profiles end def setup_data - echo("Force checking scripts/data files.") $manager.setup_data end @@ -1781,7 +1783,7 @@ end def update_d echo('Restarting Dependency in 2 seconds...') - force_start_script('bootstrap', ['wipe_constants']) unless DRINFOMON_IN_CORE_LICH + force_start_script('bootstrap', ['wipe_constants']) before_dying do sleep 2 force_start_script('dependency') @@ -1831,7 +1833,7 @@ end full_install if install -force_start_script('bootstrap', ['wipe_constants']) unless DRINFOMON_IN_CORE_LICH +force_start_script('bootstrap', ['wipe_constants']) # Proactively starting DRinfomon as script zero to prevent # race conditions involving this script which so many other @@ -1847,7 +1849,7 @@ end if DRINFOMON_IN_CORE_LICH Lich::Util.issue_command("exp all 0", /^Circle: \d+/, /^Rested EXP Stored|Unlock Rested Experience|type: AWAKEN/, quiet: true) Lich::Util.issue_command("info", /^Name/, /^ Date: Wed, 13 Nov 2024 14:34:47 +1300 Subject: [PATCH 09/19] [scripts][dependency} Fixes bad status_url --- dependency.lic | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/dependency.lic b/dependency.lic index fd0b943060..0ab1b50804 100644 --- a/dependency.lic +++ b/dependency.lic @@ -10,7 +10,7 @@ require 'ostruct' require 'digest/sha1' require 'monitor' -$DEPENDENCY_VERSION = '1.7.7' +$DEPENDENCY_VERSION = '1.7.9' $MIN_RUBY_VERSION = '3.2.2' DRINFOMON_IN_CORE_LICH ||= false @@ -244,14 +244,16 @@ class ScriptManager def update_status_url defaulturl = 'https://api.github.com/repos/' + @status_repo + '/git/trees/' + @status_branch mainurl = 'https://api.github.com/repos/rpherbig/dr-scripts/git/trees/main' - fallbackurl = 'https://api.github.com/repos/rpherbig/dr-scripts/git/trees/main' eo_drscripts = 'https://api.github.com/repos/elanthia-online/dr-scripts/git/trees/main' unless url_exist?(defaulturl) _respond Lich::Messaging.monsterbold("Default URL #{defaulturl} not responding. Using an alternate repo+branch combination.") _respond Lich::Messaging.monsterbold("Unsetting custom repo settings, if any.") - Settings['status_repo'] = nil if Settings['status_repo'] - Settings['status_branch'] = nil if Settings['status_branch'] + @status_repo = 'rpherbig/dr-scripts' + @status_branch = 'main' + Settings['status_repo'] = @status_repo + Settings['status_branch'] = @status_branch + Settings.save end if url_exist?(defaulturl) @@ -260,9 +262,6 @@ class ScriptManager elsif url_exist?(mainurl) _respond Lich::Messaging.monsterbold("Using alternate Status URL. #{mainurl}") @status_url = mainurl - elsif url_exist?(fallbackurl) - _respond Lich::Messaging.monsterbold("Using fallback Status URL. #{fallbackurl}") - @status_url = fallbackurl elsif url_exist?(eo_drscripts) _respond Lich::Messaging.monsterbold("Using Elanthia Online Status URL. #{eo_drscripts}") @status_url = eo_drscripts @@ -1606,8 +1605,8 @@ def custom_require script_names = [script_names] unless script_names.is_a?(Array) respond("CR:starting:#{script_names}") if UserVars.bootstrap_debug if DRINFOMON_IN_CORE_LICH - echo("DRInfomon in core lich detected. Skipping loading drinfomon.lic") if UserVars.bootstrap_debug - script_names -= ['drinfomon'] + echo("DRInfomon in core lich detected. Skipping loading drinfomon and commons") if UserVars.bootstrap_debug + script_names -= %W(drinfomon common common-arcana common-crafting common-healing common-healing-data common-items common-money common-moonmage common-summoning common-theurgy common-travel common-validation events slackbot equipmanager spellmonitor) end bootstrapper = force_start_script('bootstrap', script_names) pause 0.05 @@ -1734,6 +1733,7 @@ def setup_profiles end def setup_data + echo("Force checking scripts/data files.") $manager.setup_data end @@ -1783,7 +1783,7 @@ end def update_d echo('Restarting Dependency in 2 seconds...') - force_start_script('bootstrap', ['wipe_constants']) + force_start_script('bootstrap', ['wipe_constants']) unless DRINFOMON_IN_CORE_LICH before_dying do sleep 2 force_start_script('dependency') @@ -1833,7 +1833,7 @@ end full_install if install -force_start_script('bootstrap', ['wipe_constants']) +force_start_script('bootstrap', ['wipe_constants']) unless DRINFOMON_IN_CORE_LICH # Proactively starting DRinfomon as script zero to prevent # race conditions involving this script which so many other @@ -1849,7 +1849,7 @@ end if DRINFOMON_IN_CORE_LICH Lich::Util.issue_command("exp all 0", /^Circle: \d+/, /^Rested EXP Stored|Unlock Rested Experience|type: AWAKEN/, quiet: true) Lich::Util.issue_command("info", /^Name/, /^ Date: Wed, 13 Nov 2024 14:38:04 +1300 Subject: [PATCH 10/19] forcing --- dependency.lic | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dependency.lic b/dependency.lic index 0ab1b50804..cd9754bda3 100644 --- a/dependency.lic +++ b/dependency.lic @@ -205,8 +205,8 @@ class ScriptManager @paste_bin_token = 'dca351a27a8af501a8d3123e29af7981' @paste_bin_url = 'https://pastebin.com/api/api_post.php' @firebase_url = 'https://dr-scripts.firebaseio.com/' - @status_repo = Settings['status_repo'] || 'rpherbig/dr-scripts' - @status_branch = Settings['status_branch'] || 'main' + @status_repo = 'rpherbig/dr-scripts' + @status_branch = 'main' update_status_url # Gating setting lich_url on lich version From 330ab802c9e4a09b5865bc9d251432616e6c50af Mon Sep 17 00:00:00 2001 From: Mahtra <93822896+MahtraDR@users.noreply.github.com> Date: Wed, 13 Nov 2024 15:03:17 +1300 Subject: [PATCH 11/19] url_escape --- dependency.lic | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dependency.lic b/dependency.lic index cd9754bda3..f7e0f6605f 100644 --- a/dependency.lic +++ b/dependency.lic @@ -205,8 +205,8 @@ class ScriptManager @paste_bin_token = 'dca351a27a8af501a8d3123e29af7981' @paste_bin_url = 'https://pastebin.com/api/api_post.php' @firebase_url = 'https://dr-scripts.firebaseio.com/' - @status_repo = 'rpherbig/dr-scripts' - @status_branch = 'main' + @status_repo = Settings['status_repo'] || 'rpherbig/dr-scripts' + @status_branch = Settings['status_branch'] || 'main' update_status_url # Gating setting lich_url on lich version @@ -271,7 +271,7 @@ class ScriptManager end def url_exist?(url_string) - url = URI.parse(url_string) + url = URI.parse(URI::Parser.new.escape(url_string)) req = Net::HTTP.new(url.host, url.port) req.use_ssl = (url.scheme == 'https') path = url.path From a00a344c1a475bc92f64c40f84765e82a15e3a9d Mon Sep 17 00:00:00 2001 From: Mahtra <93822896+MahtraDR@users.noreply.github.com> Date: Wed, 13 Nov 2024 15:09:30 +1300 Subject: [PATCH 12/19] tweak --- dependency.lic | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/dependency.lic b/dependency.lic index f7e0f6605f..55d5540bbf 100644 --- a/dependency.lic +++ b/dependency.lic @@ -249,10 +249,8 @@ class ScriptManager unless url_exist?(defaulturl) _respond Lich::Messaging.monsterbold("Default URL #{defaulturl} not responding. Using an alternate repo+branch combination.") _respond Lich::Messaging.monsterbold("Unsetting custom repo settings, if any.") - @status_repo = 'rpherbig/dr-scripts' - @status_branch = 'main' - Settings['status_repo'] = @status_repo - Settings['status_branch'] = @status_branch + Settings['status_repo'] = nil if Settings['status_repo'] + Settings['status_branch'] = nil if Settings['status_branch'] Settings.save end From 0ab9023ea25a4740044a770508962f1a4d505277 Mon Sep 17 00:00:00 2001 From: Mahtra <93822896+MahtraDR@users.noreply.github.com> Date: Wed, 13 Nov 2024 16:13:17 +1300 Subject: [PATCH 13/19] [scripts][stack-scrolls] Reconcile local copy --- stack-scrolls.lic | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/stack-scrolls.lic b/stack-scrolls.lic index 11a2e97dcc..5b18f67f7b 100644 --- a/stack-scrolls.lic +++ b/stack-scrolls.lic @@ -85,10 +85,10 @@ class ScrollStack DRC.bput("turn #{DRC.get_noun(target['name'])} to #{query}", /^You turn/) - case DRC.bput("pull my #{target['name']}", 'This was the last copy', 'Carefully') - when /This was the last/i + case DRC.bput("pull my #{target['name']}", /This was the last copy/, /Carefully/) + when /This was the last/ target['contents'][slot] = [] - when /Carefully/i + when /Carefully/ data = target['contents'][slot] data[1] = data[1] - 1 end From 58dfe64c9c66d3e0ebcb328adde5f4c5c06d8d70 Mon Sep 17 00:00:00 2001 From: Mahtra <93822896+MahtraDR@users.noreply.github.com> Date: Wed, 13 Nov 2024 21:02:52 +1300 Subject: [PATCH 14/19] [scripts][dependency][bootstrap] More prep for components in core lich --- bootstrap.lic | 11 ++++++----- dependency.lic | 23 +++++++++++++---------- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/bootstrap.lic b/bootstrap.lic index b97ad75e6f..3b12c87ce4 100644 --- a/bootstrap.lic +++ b/bootstrap.lic @@ -3,8 +3,9 @@ Documentation: https://elanthipedia.play.net/Lich_script_development#bootstrap =end -$BOOTSTRAP_VERSION = '1.0.2' +$BOOTSTRAP_VERSION = '1.0.3' DRINFOMON_IN_CORE_LICH ||= false +DRINFOMON_CORE_LICH_DEFINES ||= [] class_defs = { 'drinfomon' => :DRINFOMON, @@ -54,7 +55,7 @@ $MODERN_LICH = lich_version >= if Regexp.last_match(1) Gem::Version.new('4.6.49') end -if args.wipe_constants +if args.wipe_constants && !DRINFOMON_IN_CORE_LICH class_defs.each_value { |symb| remove_constant(symb) if constant_defined?(symb) } exit end @@ -62,9 +63,9 @@ end scripts_to_run = args.flex || [] echo scripts_to_run.to_s if UserVars.bootstrap_debug -if scripts_to_run.include?("drinfomon") && DRINFOMON_IN_CORE_LICH - scripts_to_run -= ['drinfomon'] - echo("Removing drinfomon from scripts_to_run") if UserVars.bootstrap_debug +if (scripts_to_run & DRINFOMON_CORE_LICH_DEFINES).any? && DRINFOMON_IN_CORE_LICH + scripts_to_run -= DRINFOMON_CORE_LICH_DEFINES + echo("Removing core_lich_defines from scripts_to_run") if UserVars.bootstrap_debug end until scripts_to_run.empty? diff --git a/dependency.lic b/dependency.lic index 55d5540bbf..459be2af98 100644 --- a/dependency.lic +++ b/dependency.lic @@ -10,9 +10,10 @@ require 'ostruct' require 'digest/sha1' require 'monitor' -$DEPENDENCY_VERSION = '1.7.9' +$DEPENDENCY_VERSION = '1.7.10' $MIN_RUBY_VERSION = '3.2.2' DRINFOMON_IN_CORE_LICH ||= false +DRINFOMON_CORE_LICH_DEFINES ||= [] no_pause_all no_kill_all @@ -244,6 +245,7 @@ class ScriptManager def update_status_url defaulturl = 'https://api.github.com/repos/' + @status_repo + '/git/trees/' + @status_branch mainurl = 'https://api.github.com/repos/rpherbig/dr-scripts/git/trees/main' + fallbackurl = 'https://api.github.com/repos/rpherbig/dr-scripts/git/trees/main' eo_drscripts = 'https://api.github.com/repos/elanthia-online/dr-scripts/git/trees/main' unless url_exist?(defaulturl) @@ -251,7 +253,6 @@ class ScriptManager _respond Lich::Messaging.monsterbold("Unsetting custom repo settings, if any.") Settings['status_repo'] = nil if Settings['status_repo'] Settings['status_branch'] = nil if Settings['status_branch'] - Settings.save end if url_exist?(defaulturl) @@ -260,6 +261,9 @@ class ScriptManager elsif url_exist?(mainurl) _respond Lich::Messaging.monsterbold("Using alternate Status URL. #{mainurl}") @status_url = mainurl + elsif url_exist?(fallbackurl) + _respond Lich::Messaging.monsterbold("Using fallback Status URL. #{fallbackurl}") + @status_url = fallbackurl elsif url_exist?(eo_drscripts) _respond Lich::Messaging.monsterbold("Using Elanthia Online Status URL. #{eo_drscripts}") @status_url = eo_drscripts @@ -269,7 +273,7 @@ class ScriptManager end def url_exist?(url_string) - url = URI.parse(URI::Parser.new.escape(url_string)) + url = URI.parse(url_string) req = Net::HTTP.new(url.host, url.port) req.use_ssl = (url.scheme == 'https') path = url.path @@ -1604,7 +1608,7 @@ def custom_require respond("CR:starting:#{script_names}") if UserVars.bootstrap_debug if DRINFOMON_IN_CORE_LICH echo("DRInfomon in core lich detected. Skipping loading drinfomon and commons") if UserVars.bootstrap_debug - script_names -= %W(drinfomon common common-arcana common-crafting common-healing common-healing-data common-items common-money common-moonmage common-summoning common-theurgy common-travel common-validation events slackbot equipmanager spellmonitor) + script_names -= DRINFOMON_CORE_LICH_DEFINES end bootstrapper = force_start_script('bootstrap', script_names) pause 0.05 @@ -1731,7 +1735,6 @@ def setup_profiles end def setup_data - echo("Force checking scripts/data files.") $manager.setup_data end @@ -1781,7 +1784,7 @@ end def update_d echo('Restarting Dependency in 2 seconds...') - force_start_script('bootstrap', ['wipe_constants']) unless DRINFOMON_IN_CORE_LICH + force_start_script('bootstrap', ['wipe_constants']) before_dying do sleep 2 force_start_script('dependency') @@ -1831,7 +1834,7 @@ end full_install if install -force_start_script('bootstrap', ['wipe_constants']) unless DRINFOMON_IN_CORE_LICH +force_start_script('bootstrap', ['wipe_constants']) # Proactively starting DRinfomon as script zero to prevent # race conditions involving this script which so many other @@ -1847,11 +1850,11 @@ end if DRINFOMON_IN_CORE_LICH Lich::Util.issue_command("exp all 0", /^Circle: \d+/, /^Rested EXP Stored|Unlock Rested Experience|type: AWAKEN/, quiet: true) Lich::Util.issue_command("info", /^Name/, /^ Date: Wed, 13 Nov 2024 21:06:49 +1300 Subject: [PATCH 15/19] cleanup --- dependency.lic | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/dependency.lic b/dependency.lic index 459be2af98..49ed669b0c 100644 --- a/dependency.lic +++ b/dependency.lic @@ -245,7 +245,6 @@ class ScriptManager def update_status_url defaulturl = 'https://api.github.com/repos/' + @status_repo + '/git/trees/' + @status_branch mainurl = 'https://api.github.com/repos/rpherbig/dr-scripts/git/trees/main' - fallbackurl = 'https://api.github.com/repos/rpherbig/dr-scripts/git/trees/main' eo_drscripts = 'https://api.github.com/repos/elanthia-online/dr-scripts/git/trees/main' unless url_exist?(defaulturl) @@ -253,6 +252,7 @@ class ScriptManager _respond Lich::Messaging.monsterbold("Unsetting custom repo settings, if any.") Settings['status_repo'] = nil if Settings['status_repo'] Settings['status_branch'] = nil if Settings['status_branch'] + Settings.save end if url_exist?(defaulturl) @@ -261,9 +261,6 @@ class ScriptManager elsif url_exist?(mainurl) _respond Lich::Messaging.monsterbold("Using alternate Status URL. #{mainurl}") @status_url = mainurl - elsif url_exist?(fallbackurl) - _respond Lich::Messaging.monsterbold("Using fallback Status URL. #{fallbackurl}") - @status_url = fallbackurl elsif url_exist?(eo_drscripts) _respond Lich::Messaging.monsterbold("Using Elanthia Online Status URL. #{eo_drscripts}") @status_url = eo_drscripts @@ -273,7 +270,7 @@ class ScriptManager end def url_exist?(url_string) - url = URI.parse(url_string) + url = URI.parse(URI::Parser.new.escape(url_string)) req = Net::HTTP.new(url.host, url.port) req.use_ssl = (url.scheme == 'https') path = url.path @@ -1735,6 +1732,7 @@ def setup_profiles end def setup_data + echo("Force checking scripts/data files.") $manager.setup_data end @@ -1784,8 +1782,8 @@ end def update_d echo('Restarting Dependency in 2 seconds...') - force_start_script('bootstrap', ['wipe_constants']) - before_dying do + force_start_script('bootstrap', ['wipe_constants']) unless DRINFOMON_IN_CORE_LICH + before_dying do sleep 2 force_start_script('dependency') end @@ -1834,7 +1832,7 @@ end full_install if install -force_start_script('bootstrap', ['wipe_constants']) +force_start_script('bootstrap', ['wipe_constants']) unless DRINFOMON_IN_CORE_LICH # Proactively starting DRinfomon as script zero to prevent # race conditions involving this script which so many other @@ -1850,11 +1848,11 @@ end if DRINFOMON_IN_CORE_LICH Lich::Util.issue_command("exp all 0", /^Circle: \d+/, /^Rested EXP Stored|Unlock Rested Experience|type: AWAKEN/, quiet: true) Lich::Util.issue_command("info", /^Name/, /^ Date: Wed, 13 Nov 2024 21:08:24 +1300 Subject: [PATCH 16/19] cleanup --- dependency.lic | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependency.lic b/dependency.lic index 49ed669b0c..551277bb8e 100644 --- a/dependency.lic +++ b/dependency.lic @@ -1783,7 +1783,7 @@ end def update_d echo('Restarting Dependency in 2 seconds...') force_start_script('bootstrap', ['wipe_constants']) unless DRINFOMON_IN_CORE_LICH - before_dying do + before_dying do sleep 2 force_start_script('dependency') end From 8ebda13df4076a39d01be8e0d24183915d256973 Mon Sep 17 00:00:00 2001 From: Mahtra <93822896+MahtraDR@users.noreply.github.com> Date: Wed, 13 Nov 2024 21:13:39 +1300 Subject: [PATCH 17/19] cleanup --- bootstrap.lic | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bootstrap.lic b/bootstrap.lic index 3b12c87ce4..8d8be595ec 100644 --- a/bootstrap.lic +++ b/bootstrap.lic @@ -63,9 +63,9 @@ end scripts_to_run = args.flex || [] echo scripts_to_run.to_s if UserVars.bootstrap_debug -if (scripts_to_run & DRINFOMON_CORE_LICH_DEFINES).any? && DRINFOMON_IN_CORE_LICH +if (scripts_to_run & DRINFOMON_CORE_LICH_DEFINES).any? scripts_to_run -= DRINFOMON_CORE_LICH_DEFINES - echo("Removing core_lich_defines from scripts_to_run") if UserVars.bootstrap_debug + echo("Removing core lich defines from scripts_to_run") if UserVars.bootstrap_debug end until scripts_to_run.empty? From 156cb7c5bc58660d8e4cc9e8eab0ab8b274491dd Mon Sep 17 00:00:00 2001 From: Mahtra <93822896+MahtraDR@users.noreply.github.com> Date: Thu, 14 Nov 2024 10:31:36 +1300 Subject: [PATCH 18/19] [New Script][bard-whistle] Passive loop to train Bardic Lore --- bard-whistle.lic | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 bard-whistle.lic diff --git a/bard-whistle.lic b/bard-whistle.lic new file mode 100644 index 0000000000..cd86fbc748 --- /dev/null +++ b/bard-whistle.lic @@ -0,0 +1,27 @@ +custom_require.call(%w(common drinfomon)) + +no_kill_all + +class Whistle + def initialize + @combat_scripts = ['hunting-buddy', 'combat-trainer'] + exit unless DRStats.guild == 'Bard' && DRSkill.getrank('Bardic Lore') < 1750 + passive_loop + end + + def do_whistle + return if @combat_scripts.any? { |name| Script.running?(name) } + return unless DRSkill.getxp('Bardic Lore') < 32 + + fput('WHISTLE PIERCING') + end + + def passive_loop + loop do + do_whistle + pause 30 + end + end +end + +Whistle.new From 408e0426ae942e049b9fb2980abca1e749a1f25e Mon Sep 17 00:00:00 2001 From: Mahtra <93822896+MahtraDR@users.noreply.github.com> Date: Thu, 14 Nov 2024 10:35:24 +1300 Subject: [PATCH 19/19] Adding circle check --- bard-whistle.lic | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bard-whistle.lic b/bard-whistle.lic index cd86fbc748..55b489ee3b 100644 --- a/bard-whistle.lic +++ b/bard-whistle.lic @@ -5,7 +5,7 @@ no_kill_all class Whistle def initialize @combat_scripts = ['hunting-buddy', 'combat-trainer'] - exit unless DRStats.guild == 'Bard' && DRSkill.getrank('Bardic Lore') < 1750 + exit unless DRStats.guild == 'Bard' && DRSkill.getrank('Bardic Lore') < 1750 && DRStats.circle >= 18 passive_loop end