diff --git a/scripts/sk.lic b/scripts/sk.lic index 74c8b98af..8973a9eb4 100644 --- a/scripts/sk.lic +++ b/scripts/sk.lic @@ -9,8 +9,10 @@ game: Gemstone tags: sk, self knowledge requires: Lich >= 4.6.0 - version: 1.2.1 + version: 1.2.2 + v1.2.2(2025-01-26) + - Refactored for non-breaking inclusion for Lich 5.11+ v1.2.1 (2024-08-24) - Fix to use old time_per calc if exists and < 10mins v1.2.0 (2024-02-22) @@ -22,27 +24,29 @@ - initial release =end -module Games - module Gemstone - class Spell - OLD_KNOWN_METHOD ||= Spell.instance_method(:known?) - def known? - SK.known?(self) or OLD_KNOWN_METHOD.bind(self).call() - end +class Spell + if defined?(Games::Gemstone::Spell) + OLD_KNOWN_METHOD ||= Games::Gemstone::Spell.instance_method(:known?) + OLD_TIME_PER_METHOD ||= Games::Gemstone::Spell.instance_method(:time_per) + elsif defined?(Lich::Common::Spell) + OLD_KNOWN_METHOD ||= Spell.instance_method(:known?) + OLD_TIME_PER_METHOD ||= Spell.instance_method(:time_per) + else + fail("sk.lic not currently equipped to handle your version of Lich, exiting!") + end + def known? + SK.known?(self) or OLD_KNOWN_METHOD.bind(self).call() + end - OLD_TIME_PER_METHOD ||= Spell.instance_method(:time_per) - def time_per(arg = nil) - # dumb time per of 10m because lots of things break otherwise - return 10.0 if SK.known?(self) && (OLD_TIME_PER_METHOD.bind(self).call(arg).nil? || OLD_TIME_PER_METHOD.bind(self).call(arg) < 10) - return OLD_TIME_PER_METHOD.bind(self).call(arg) - end - end + def time_per(arg = nil) + # dumb time per of 10m because lots of things break otherwise + return 10.0 if SK.known?(self) && (OLD_TIME_PER_METHOD.bind(self).call(arg).nil? || OLD_TIME_PER_METHOD.bind(self).call(arg) < 10) + return OLD_TIME_PER_METHOD.bind(self).call(arg) end end module SK NAMESPACE = "sk/known" - Vars[NAMESPACE] ||= [] def self.known?(spell)