2024-10-21 16:03:58 -07:00
|
|
|
# We replace Neopets::CustomPets methods with a mocked implementation.
|
|
|
|
|
module Neopets::CustomPets
|
2024-10-24 14:42:05 -07:00
|
|
|
DATA_DIR = Pathname.new(__dir__) / "custom_pets"
|
|
|
|
|
|
2024-10-21 16:03:58 -07:00
|
|
|
def self.fetch_viewer_data(pet_name, ...)
|
2026-01-20 18:23:52 -08:00
|
|
|
# NOTE: Windows doesn't support `@` in filenames, so we use a `scis` directory instead.
|
|
|
|
|
path = if pet_name.start_with?('@')
|
|
|
|
|
DATA_DIR / "scis" / "#{pet_name[1..]}.json"
|
|
|
|
|
else
|
|
|
|
|
DATA_DIR / "#{pet_name}.json"
|
2024-10-21 16:03:58 -07:00
|
|
|
end
|
2026-01-20 18:23:52 -08:00
|
|
|
|
|
|
|
|
File.open(path) { |f| HashWithIndifferentAccess.new JSON.load(f) }
|
2024-10-21 16:03:58 -07:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def self.fetch_metadata(...)
|
|
|
|
|
raise NotImplementedError
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def self.fetch_image_hash(pet_name, ...)
|
2024-10-21 16:46:10 -07:00
|
|
|
"m:#{pet_name}"[0, 8] # A mock hash, like `m:thyass` for "thyassa".
|
2024-10-21 16:03:58 -07:00
|
|
|
end
|
|
|
|
|
end
|