eidolon 0.1.3 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/README.md +21 -15
- data/lib/eidolon.rb +73 -72
- data/lib/eidolon/rgss/loader.rb +2 -1
- data/lib/eidolon/rgss2/loader.rb +2 -1
- data/lib/eidolon/rgss3/loader.rb +2 -1
- data/lib/eidolon/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
OGMzNDAyODEyMGZmOTQwYmJmNzc4NDNiZmU4MWU5MDRhY2Q1NGJlMg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NTNjMDMxMGYwNjliMGI5MDc4YjE0ZjIwODdkZDk4NzA2ZjUxNmZlMA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YzEwZjc1MTVmNDhjNmYzNWNlZGNhMzk2ZWFmNjQzZjdlN2JlMjgzZGExODhl
|
10
|
+
MmNlZDRjOGQzNDIyNTQ2N2Y5NGUwNGI3MGNiODYwNzg3MTJmOGRmMmNjMjE0
|
11
|
+
NjU0NjEzMmRlZWU1MjAxZjcyYzM4NTE4MTExYjRkYTBlNWM0NGY=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NjcxZWE5YWM3OTMyODg5MDc2OThmMTE1YmUxOWI0OWFmNmNiNjgxNjY3MTEz
|
14
|
+
MDgzZGM1MTMxZTYxN2IxNzdiZTYyYWUzOTk4MjA5ZDEzZmFlNzBkODFhZDdm
|
15
|
+
Yjg1NTgwMWFhMWRmOTE2NjQzN2JmNmFiYWZlOTM0YmE0ZDk1Mjg=
|
data/README.md
CHANGED
@@ -23,31 +23,37 @@ require 'eidolon/rgss2'
|
|
23
23
|
require 'eidolon/rgss3'
|
24
24
|
```
|
25
25
|
|
26
|
-
Note that only one version may be required this way: attempting to require more than one version of the RGSS data structures will result in superclass mismatches. For this reason, if you potentially need to operate with more than one of the RGSS versions, you should use the core Eidolon module; essentially, the usage of this module allows you to dynamically create and destroy the needed RPG data structures whenever they are required. See the included documentation for more detailed information about the usage of the Eidolon module.
|
26
|
+
Note that only one version may be required this way: attempting to `require` more than one version of the RGSS data structures will result in superclass mismatches. For this reason, if you potentially need to operate with more than one of the RGSS versions, you should use the core Eidolon module instead; essentially, the usage of this module allows you to dynamically create and destroy the needed RPG data structures whenever they are required. See the included documentation for more detailed information about the usage of the Eidolon module.
|
27
27
|
|
28
28
|
```ruby
|
29
29
|
require 'eidolon'
|
30
30
|
|
31
|
+
# Equivalent to the RGSSx +load_data+ method.
|
31
32
|
def load_data(filename)
|
32
|
-
File.open(filename, 'rb')
|
33
|
-
return Marshal.load(file)
|
34
|
-
end
|
33
|
+
File.open(filename, 'rb') { |data| Marshal.load(data) }
|
35
34
|
end
|
36
35
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
@rgss_data.push(load_data(rxdata))
|
36
|
+
# Build the RGSS data structures and return RMXP project data.
|
37
|
+
Eidolon.build('RGSS') do
|
38
|
+
data = []
|
39
|
+
Dir.glob('**/*.rxdata') { |rxdata| data << load_data(rxdata) }
|
40
|
+
data
|
43
41
|
end
|
42
|
+
```
|
44
43
|
|
45
|
-
|
44
|
+
## Local Extensions
|
45
|
+
Eidolon has been written in a way that allows developers to easily extend or modify the RGSSx data that it loads. This feature was primarily included to allow newer versions of RGSSx to be easily added to Eidolon in case of their release.
|
46
46
|
|
47
|
-
Eidolon.
|
48
|
-
|
49
|
-
|
50
|
-
|
47
|
+
Essentially, Eidolon looks through a defined path for specific files to load RGSS data dependent on the RGSS version you request. For RGSS, it looks for `eidolon/rgss/loader.rb`, RGSS2 looks for `eidolon/rgss2/loader.rb`, and so on. In order to create RGSS4, for example, you simply need to recreate this structure locally -- and Eidolon will allow you to use it.
|
48
|
+
|
49
|
+
```
|
50
|
+
$ cat eidolon/rgss4/loader.rb
|
51
|
+
# Load all of your needed modifications here.
|
52
|
+
load 'eidolon/rgssx/loader.rb'
|
53
|
+
load 'eidolon/rgss4/rpg/example.rb'
|
54
|
+
|
55
|
+
$ cat rgss4_application.rb
|
56
|
+
Eidolon.build(:RGSS4) { ... }
|
51
57
|
```
|
52
58
|
|
53
59
|
## Installation
|
data/lib/eidolon.rb
CHANGED
@@ -1,94 +1,99 @@
|
|
1
1
|
require 'eidolon/version'
|
2
2
|
|
3
3
|
# == Eidolon
|
4
|
-
# This module provides methods for
|
5
|
-
# Maker series of game development programs so that
|
6
|
-
# loaded into an external Ruby implementation. The methods used are
|
7
|
-
# and dependency agnostic.
|
4
|
+
# This module provides methods for creating and destroying the data structures
|
5
|
+
# used by the RPG Maker series of game development programs so that their data
|
6
|
+
# may be loaded into an external Ruby implementation. The methods used are
|
7
|
+
# platform and dependency agnostic.
|
8
8
|
#
|
9
9
|
# == Usage
|
10
10
|
# It is recommended that you explicitly declare which RGSS version Eidolon
|
11
11
|
# should use before building the RGSSx data structures required; this is done
|
12
12
|
# through the +Eidolon.rgss_version=+ method. This method accepts both integer
|
13
|
-
# and representative string values -- for example, passing it an
|
14
|
-
# 1 or
|
15
|
-
#
|
13
|
+
# and representative string or symbol values -- for example, passing it an
|
14
|
+
# argument of 1, 'RGSS2', or :rgss3 will set the Eidolon RGSS version to the
|
15
|
+
# appropriate value.
|
16
16
|
#
|
17
17
|
# After explicitly requesting the desired RGSS version, you will want to build
|
18
18
|
# the desired data structures with the +Eidolon.build+ method. This will create
|
19
19
|
# the data structures for the specified RGSS version for use by the currently
|
20
20
|
# running Ruby implementation. Note that the +Eidolon.build+ method will only
|
21
|
-
# build data structures *once*.
|
21
|
+
# build data structures *once*. You may also explicitly pass an RGSS version to
|
22
|
+
# build as an argument to this method.
|
22
23
|
#
|
23
|
-
#
|
24
|
-
# than one RGSS version in a single Ruby session. On their own, the
|
25
|
-
# structures are inherently incompatible with one another
|
26
|
-
#
|
27
|
-
# does for you.
|
24
|
+
# Be aware that you will need to use the +Eidolon.destroy!+ method if you wish
|
25
|
+
# to use more than one RGSS version in a single Ruby session. On their own, the
|
26
|
+
# RGSSx data structures are inherently incompatible with one another (raising
|
27
|
+
# superclass mismatch errors) -- as such, the previous data structures must be
|
28
|
+
# destroyed, which the +Eidolon.destroy!+ method does for you.
|
28
29
|
#
|
29
|
-
#
|
30
|
+
# In addition to this, you may pass a block to the +Eidolon.build+ method which
|
31
|
+
# automatically creates and destroys the data structures for the passed RGSS
|
32
|
+
# version. The specified RGSS version is available inside of the block and
|
33
|
+
# destroyed immediately after the block returns. Using a block will also return
|
34
|
+
# the value of the *block* rather than the usual +true+ or +false+ value.
|
35
|
+
#
|
36
|
+
# == Examples
|
30
37
|
# require 'eidolon'
|
31
38
|
#
|
32
|
-
# #
|
39
|
+
# # Equivalent to the RGSSx method of the same name.
|
40
|
+
# def load_data(filename)
|
41
|
+
# File.open(filename, 'rb') { |data| Marshal.load(data) }
|
42
|
+
# end
|
43
|
+
#
|
44
|
+
# # Build the RGSS3 (VX Ace) data structures and obtain the project data of
|
45
|
+
# # an unencrypted RMVX Ace game.
|
33
46
|
# Eidolon.rgss_version = 'RGSS3'
|
34
|
-
# Eidolon.
|
35
|
-
# Eidolon.
|
36
|
-
# Eidolon.built? # => true
|
47
|
+
# Eidolon.build # => true
|
48
|
+
# Eidolon.built? # => true
|
37
49
|
#
|
38
|
-
# #
|
39
|
-
#
|
40
|
-
#
|
50
|
+
# # Initialize an array for storing the data, then fill it.
|
51
|
+
# @rgss3_data = []
|
52
|
+
# Dir.glob('**/*.rvdata2') { |data| @rgss3_data << load_data(data) }
|
53
|
+
# @rgss3_data # => [[nil, #<RPG::Actor...> ... ] ... ]
|
41
54
|
#
|
42
|
-
# #
|
43
|
-
# Eidolon.
|
55
|
+
# # Destroy the previously built RGSS3 data structures.
|
56
|
+
# Eidolon.destroy! # => true
|
57
|
+
# Eidolon.built? # => false
|
44
58
|
#
|
45
|
-
# #
|
46
|
-
#
|
59
|
+
# # Now we can build the RGSS (XP) data structures with a block and return
|
60
|
+
# # the project data for an unencrypted RMXP game.
|
61
|
+
# Eidolon.build(1) do
|
62
|
+
# # Initialize an array for storing the data, fill it, then use it as the
|
63
|
+
# # block's return value.
|
64
|
+
# @xp_data = []
|
65
|
+
# Dir.glob('**/*.rxdata') { |data| @xp_data << load_data(data) }
|
66
|
+
# @xp_data
|
67
|
+
# end # => [[nil, #<RPG::Actor...> ... ] ... ]
|
68
|
+
# Eidolon.built? # => false
|
47
69
|
module Eidolon
|
48
70
|
class << self
|
49
|
-
# The
|
50
|
-
#
|
51
|
-
|
52
|
-
|
53
|
-
# An array of the RGSS versions which have had their data structures built
|
54
|
-
# by Eidolon.
|
55
|
-
attr_reader :built
|
56
|
-
end
|
57
|
-
|
58
|
-
# Initialize the array of built RGSS versions.
|
59
|
-
@built = []
|
60
|
-
|
61
|
-
# Set the RGSS version used by Eidolon to the passed value. May be set to an
|
62
|
-
# integer or representative string value for the desired RGSS version.
|
63
|
-
#
|
64
|
-
# Examples:
|
65
|
-
# Eidolon.rgss_version = "RGSS3" # Sets the version to "rgss3".
|
66
|
-
# Eidolon.rgss_version = 1 # Sets the version to "rgss".
|
67
|
-
def self.rgss_version=(value)
|
68
|
-
return unless valid?(value)
|
69
|
-
@rgss_version = transform(value)
|
71
|
+
# The default RGSS version for Eidolon to build if no argument is given to
|
72
|
+
# the +Eidolon.build+ method. This is +nil+ by default.
|
73
|
+
attr_accessor :rgss_version
|
70
74
|
end
|
71
75
|
|
72
76
|
# Builds the data structures for the desired RGSS version. Returns +true+ if
|
73
77
|
# the data structures were built, +false+ otherwise. This is a safe method,
|
74
78
|
# ensuring that only the data structures from a single RGSS version will be
|
75
79
|
# built.
|
80
|
+
#
|
81
|
+
# If a block is given, the data structures are built before the block is
|
82
|
+
# executed and then automatically destroyed. This is particularly useful for
|
83
|
+
# temporarily accessing RGSSx data, and returns the return value of the given
|
84
|
+
# block.
|
76
85
|
def self.build(version = @rgss_version)
|
77
|
-
return false if version.nil?
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
@built.push(@rgss_version).compact.sort!.uniq!
|
87
|
-
load 'eidolon/rgssx/loader.rb'
|
88
|
-
load "eidolon/#{@rgss_version}/loader.rb"
|
89
|
-
rescue LoadError
|
86
|
+
return false if version.nil? || built?
|
87
|
+
begin
|
88
|
+
load "eidolon/#{transform(version)}/loader.rb"
|
89
|
+
return true unless block_given?
|
90
|
+
rescue ArgumentError, LoadError
|
91
|
+
destroy!
|
92
|
+
return false
|
93
|
+
end
|
94
|
+
return_value = yield
|
90
95
|
destroy!
|
91
|
-
|
96
|
+
return_value
|
92
97
|
end
|
93
98
|
|
94
99
|
# Destroys the currently built RGSS data structures. Returns +true+ if the
|
@@ -108,22 +113,18 @@ module Eidolon
|
|
108
113
|
class << self
|
109
114
|
private
|
110
115
|
# Transforms the given value into an applicable string used to find the
|
111
|
-
# appropriate RGSS version.
|
116
|
+
# appropriate RGSS version. Returns the transformed string. Raises an
|
117
|
+
# +ArgumentError+ if the string could not be transformed.
|
112
118
|
def transform(version)
|
119
|
+
return version if version == (string = 'rgss')
|
113
120
|
if version =~ /^rgss(\d?)/i
|
114
|
-
|
115
|
-
'rgss' << $1
|
121
|
+
string << $1 unless $1.empty?
|
116
122
|
else
|
117
|
-
|
118
|
-
'rgss' << version.to_s
|
123
|
+
string << version.to_s unless version.between?(0, 1)
|
119
124
|
end
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
# +false+ otherwise.
|
124
|
-
def valid?(version)
|
125
|
-
fn = File.dirname(__FILE__) << "/eidolon/#{transform(version)}/loader.rb"
|
126
|
-
File.file?(fn)
|
125
|
+
string
|
126
|
+
rescue
|
127
|
+
raise ArgumentError.new("'#{version}' is an invalid RGSS version.")
|
127
128
|
end
|
128
129
|
end
|
129
130
|
end
|
data/lib/eidolon/rgss/loader.rb
CHANGED
@@ -6,7 +6,8 @@
|
|
6
6
|
# be loaded -- the actual order of loading them is unimportant (unlike the data
|
7
7
|
# structures used by VX and VX Ace, which require some specific ordering).
|
8
8
|
|
9
|
-
|
9
|
+
# Load the generic RGSSx data structures.
|
10
|
+
load 'eidolon/rgssx/loader.rb'
|
10
11
|
|
11
12
|
load 'eidolon/rgss/rpg/actor.rb'
|
12
13
|
load 'eidolon/rgss/rpg/armor.rb'
|
data/lib/eidolon/rgss2/loader.rb
CHANGED
@@ -2,7 +2,8 @@
|
|
2
2
|
# Essentially, requiring this file will build a generic copy of the VX data
|
3
3
|
# structures for use in a Ruby installation outside of VX itself.
|
4
4
|
|
5
|
-
|
5
|
+
# Load the generic RGSSx data structures.
|
6
|
+
load 'eidolon/rgssx/loader.rb'
|
6
7
|
|
7
8
|
# Audio data structures.
|
8
9
|
load 'eidolon/rgss2/rpg/bgm.rb'
|
data/lib/eidolon/rgss3/loader.rb
CHANGED
@@ -2,7 +2,8 @@
|
|
2
2
|
# Ace. Essentially, requiring this file will build a generic copy of the VX Ace
|
3
3
|
# data structures for use in a Ruby installation outside of Ace itself.
|
4
4
|
|
5
|
-
|
5
|
+
# Load the generic RGSSx data structures.
|
6
|
+
load 'eidolon/rgssx/loader.rb'
|
6
7
|
|
7
8
|
# Audio data structures.
|
8
9
|
load 'eidolon/rgss3/rpg/bgm.rb'
|
data/lib/eidolon/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eidolon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Solistra
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-04-
|
11
|
+
date: 2014-04-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: yard
|