Skip to content

Commit

Permalink
Merge pull request #1767 from elanthia-online/revert-1761-sk.lic-v1.2.2
Browse files Browse the repository at this point in the history
Failed for proper backwards compatibility.
Revert "[sk.lic] v1.2.2 refactor for Lich 5.11 namespace change"
  • Loading branch information
mrhoribu authored Feb 1, 2025
2 parents 34d2722 + 0d4bda9 commit b63ca8f
Showing 1 changed file with 16 additions and 20 deletions.
36 changes: 16 additions & 20 deletions scripts/sk.lic
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,8 @@
game: Gemstone
tags: sk, self knowledge
requires: Lich >= 4.6.0
version: 1.2.2
version: 1.2.1
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)
Expand All @@ -24,29 +22,27 @@
- initial release
=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
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

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)
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
end
end

module SK
NAMESPACE = "sk/known"

Vars[NAMESPACE] ||= []

def self.known?(spell)
Expand Down

0 comments on commit b63ca8f

Please sign in to comment.