rrb 0.0.4 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,105 @@
1
+ # The IO module provides objects, modules, and functions to handle input/output operations.
2
+ module RuneRb::IO
3
+
4
+ # A module used for validating data operations performed on buffer objects.
5
+ module Validation
6
+ class << self
7
+ include RuneRb::Utils::Logging
8
+
9
+ # Validates the passed parameters according to the options.
10
+ # @param buffer [Buffer] the buffer to validate against.
11
+ # @param operation [String] the operation to validate.
12
+ # @param params [Hash] a map of parameters to validate.
13
+ # @todo implement a ValidationError type to be raised when a validation fails.
14
+ def validate(buffer, operation, params = {})
15
+ return false unless valid_mode?(buffer, operation)
16
+ return false if buffer.mode.include?('w') && params[:bit_access] && !valid_access?(buffer, params[:bit_access])
17
+ return false if params[:mutation] && !valid_mutation?(params[:mutation])
18
+ return false if params[:order] && !valid_order?(params[:order])
19
+
20
+ true
21
+ end
22
+
23
+ # Reads data directly from an IO stream.
24
+ # @param io [Socket, IO] the IO object to read from.
25
+ # @param length [Integer] the amount of data to read
26
+ # @param buffer [Buffer] the buffer to read to.
27
+ def from_io(io, length, buffer)
28
+ raise 'Closed IO' if io.closed?
29
+
30
+ io.read_nonblock(length, buffer.data)
31
+ end
32
+
33
+ private
34
+
35
+ # Validates the current access mode for the write channel.
36
+ # @param buffer [Buffer] the buffer to validate against.
37
+ # @param required [Boolean] the access type required for the operation.
38
+ def valid_access?(buffer, required)
39
+ unless buffer.bit_access == required
40
+ err "Invalid access for operation! #{required} access is required for operation!"
41
+ return false
42
+ end
43
+ true
44
+ end
45
+
46
+ # Validates the operation with the current mode of the message.
47
+ # @param buffer [Buffer] the buffer to validate against.
48
+ # @param operation [String] the operation to validate.
49
+ def valid_mode?(buffer, operation)
50
+ return false if buffer.mode == 'r' && /(?i)\bpeek_write|write/.match?(operation)
51
+ return false if buffer.mode == 'w' && /(?i)\bpeek_read|read/.match?(operation)
52
+
53
+ true
54
+ end
55
+
56
+ # Validates the byte mutation for the operation
57
+ # @param mutation [String] the mutation that will be applied in the operation.
58
+ def valid_mutation?(mutation)
59
+ unless RuneRb::IO::BYTE_MUTATIONS.include?(mutation)
60
+ err "Unrecognized mutation! #{mutation}"
61
+ return false
62
+ end
63
+ true
64
+ end
65
+
66
+ # Validates the byte order to read for the operation
67
+ # @param order [String] the order in which to read bytes in the operation.
68
+ def valid_order?(order)
69
+ unless RuneRb::IO::BYTE_ORDERS.match?(order)
70
+ err "Unrecognized byte order! #{order}"
71
+ return false
72
+ end
73
+ true
74
+ end
75
+ end
76
+ end
77
+ end
78
+
79
+ # Copyright (c) 2022, Patrick W.
80
+ # All rights reserved.
81
+ #
82
+ # Redistribution and use in source and binary forms, with or without
83
+ # modification, are permitted provided that the following conditions are met:
84
+ #
85
+ # * Redistributions of source code must retain the above copyright notice, this
86
+ # list of conditions and the following disclaimer.
87
+ #
88
+ # * Redistributions in binary form must reproduce the above copyright notice,
89
+ # this list of conditions and the following disclaimer in the documentation
90
+ # and/or other materials provided with the distribution.
91
+ #
92
+ # * Neither the name of the copyright holder nor the names of its
93
+ # contributors may be used to endorse or promote products derived from
94
+ # this software without specific prior written permission.
95
+ #
96
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
97
+ # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
98
+ # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
99
+ # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
100
+ # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
101
+ # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
102
+ # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
103
+ # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
104
+ # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
105
+ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,236 @@
1
+ # The IO module provides objects, modules, and functions to handle input/output operations.
2
+ module RuneRb::IO
3
+
4
+ module Writeable
5
+ # Write data to the payload.
6
+ # @param type [Symbol] the type of value to write.
7
+ # @param value [Integer, String, Message, Array] the value to write.
8
+ def write(value, type: :byte, mutation: :STD, order: 'BIG', options: {})
9
+ return unless RuneRb::IO::Validation.validate(self, 'write', { mutation: mutation, order: order })
10
+
11
+ case type
12
+ when :bits then write_bits(value, options[:amount] || 1)
13
+ when :bit then write_bit(value)
14
+ when :byte then write_byte(value, mutation: mutation)
15
+ when :bytes then write_bytes(value)
16
+ when :short then write_short(value, mutation: mutation, order: order)
17
+ when :medium then write_medium(value, mutation: mutation, order: order)
18
+ when :int then write_int(value, mutation: mutation, order: order)
19
+ when :long then write_long(value, mutation: mutation, order: order)
20
+ when :smart then write_smart(value, mutation: mutation, signed: options[:signed] || false)
21
+ when :string then write_string(value)
22
+ when :reverse_bytes then write_reverse_bytes(value)
23
+ else raise "Unrecognized write type! #{type}"
24
+ end
25
+
26
+ self
27
+ end
28
+
29
+ # Enables or Disables bit writing by setting the {Buffer#bit_access} variable.
30
+ def switch_access
31
+ @bit_access = !@bit_access
32
+ end
33
+
34
+ def finish_access
35
+ @bit_position = (@bit_position + 7) / 8
36
+ switch_access
37
+ end
38
+
39
+ private
40
+
41
+ # Write a byte value to the payload.
42
+ # @param value [Integer] the byte value to write.
43
+ # @param mutation [String] mutations made to the byte.
44
+ def write_byte(value, mutation: :STD)
45
+ @data.concat([mutate(value, mutation)].pack('C'))
46
+ end
47
+
48
+ # Write a short value to the payload.
49
+ # @param value [Integer] the short value to write.
50
+ # @param mutation [String] the type of byte to write.
51
+ # @param order [String] the order in which bytes will be written.
52
+ def write_short(value, mutation: :STD, order: 'BIG')
53
+ case order
54
+ when 'BIG'
55
+ write_byte(value >> 8)
56
+ write_byte(value, mutation: mutation)
57
+ when 'LITTLE'
58
+ write_byte(value, mutation: mutation)
59
+ write_byte(value >> 8)
60
+ else raise "Unrecognized bit order: #{order}"
61
+ end
62
+ end
63
+
64
+ # Write a medium value to the payload.
65
+ # @param value [Integer] the medium value to write.
66
+ # @param mutation [String] the mutation made to the byte.
67
+ # @param order [String] the order in which bytes will be written.
68
+ def write_medium(value, mutation: :STD, order: 'BIG')
69
+ case order
70
+ when 'BIG'
71
+ write_byte(value >> 16)
72
+ write_byte(value >> 8)
73
+ write_byte(value, mutation: mutation)
74
+ when 'MIDDLE'
75
+ write_byte(value >> 8)
76
+ write_byte(value, mutation: mutation)
77
+ write_byte(value >> 16)
78
+ when 'LITTLE'
79
+ write_byte(value, mutation: mutation)
80
+ write_byte(value >> 8)
81
+ write_byte(value >> 16)
82
+ else raise "Unrecognized bit order: #{order}"
83
+ end
84
+ end
85
+
86
+ # Write a integer value to the payload.
87
+ # @param value [Integer] the integer value to write.
88
+ # @param mutation [String] the type of byte to write.
89
+ # @param order [String] the order in which bytes will be written.
90
+ def write_int(value, mutation: :STD, order: 'BIG')
91
+ case order
92
+ when 'BIG'
93
+ write_byte(value >> 24)
94
+ write_byte(value >> 16)
95
+ write_byte(value >> 8)
96
+ write_byte(value, mutation: mutation)
97
+ when 'MIDDLE'
98
+ write_byte(value >> 8)
99
+ write_byte(value, mutation: mutation)
100
+ write_byte(value >> 24)
101
+ write_byte(value >> 16)
102
+ when 'INVERSE_MIDDLE'
103
+ write_byte(value >> 16)
104
+ write_byte(value >> 24)
105
+ write_byte(value, mutation: mutation)
106
+ write_byte(value >> 8)
107
+ when 'LITTLE'
108
+ write_byte(value, mutation: mutation)
109
+ write_byte(value >> 8)
110
+ write_byte(value >> 16)
111
+ write_byte(value >> 24)
112
+ else raise "Unrecognized bit order: #{order}"
113
+ end
114
+ end
115
+
116
+ # Write a long value to the payload.
117
+ # @param value [Integer] the long value to write.
118
+ # @param mutation [String] the type of byte to write.
119
+ # @param order [String] the order in which bytes will be written.
120
+ def write_long(value, mutation: :STD, order: 'BIG')
121
+ case order
122
+ when 'BIG'
123
+ (RuneRb::IO::BYTE_SIZE * 7).downto(0) { |div| ((div % 8).zero? and div.positive?) ? write_byte(value >> div) : next }
124
+ write_byte(value, mutation: mutation)
125
+ when 'LITTLE'
126
+ write_byte(value, mutation: mutation)
127
+ (0).upto(RuneRb::IO::BYTE_SIZE * 7) { |div| ((div % 8).zero? and div.positive?) ? write_byte(value >> div) : next }
128
+ else raise "Unrecognized bit order: #{order}"
129
+ end
130
+ end
131
+
132
+ # Write a string value to the payload. This will be escaped/terminated with a \n[10] value.
133
+ # @param string [String] the byte to write to the payload.
134
+ def write_string(string)
135
+ @data.concat(string.force_encoding(Encoding::BINARY))
136
+ write_byte(10)
137
+ end
138
+
139
+ # Write a 'smart' value to the payload.
140
+ #
141
+ # @param value [Integer] the smart value to write.
142
+ # @param mutation [String] an optional mutation to apply to the written smart value.
143
+ def write_smart(value, mutation: :STD, signed: false)
144
+ case signed
145
+ when true
146
+ value > 128 ? write_byte(value, mutation: mutation) + 64 : write_short(value, mutation: mutation) + 49_152
147
+ when false
148
+ value > 128 ? write_byte(value, mutation: mutation) : write_short(value, mutation: mutation) + 32_768
149
+ end
150
+ end
151
+
152
+ # Writes multiple bytes to the payload.
153
+ # @param values [String, Array, RuneRb::IO::Buffer] the values whose bytes will be written.
154
+ def write_bytes(values)
155
+ case values
156
+ when Array then values.each { |byte| write_byte(byte.to_i) }
157
+ when RuneRb::IO::Message then @data.concat(values.body.data)
158
+ when RuneRb::IO::Buffer then @data.concat(values.data)
159
+ when String then @data.concat(values)
160
+ end
161
+ end
162
+
163
+ # Write a collection of bytes in reverse. *Not sure if I did this right.
164
+ # @param values [Array, String] the values to write.
165
+ def write_reverse_bytes(values)
166
+ case values
167
+ when Array then write(values.reverse, type: :bytes)
168
+ when String then write(values.bytes.reverse, type: :bytes)
169
+ end
170
+ end
171
+
172
+ # Write a single bit with a value of 1 or 0 depending on the flag parameter.
173
+ # @param flag [Boolean] the flag
174
+ def write_bit(flag)
175
+ write_bits(flag == true ? 1 : 0, 1)
176
+ self
177
+ end
178
+
179
+ # Write multiple bits to the payload
180
+ # @param amount [Integer] the amount of bits to occupy.
181
+ # @param value [Integer] the value to write.
182
+ def write_bits(value, amount)
183
+ byte_pos = @bit_position >> 3
184
+ bit_offset = 8 - (@bit_position & 7)
185
+ @bit_position += amount
186
+
187
+ while amount > bit_offset
188
+ @data[byte_pos] = [0].pack('c') if @data[byte_pos].nil?
189
+ @data[byte_pos] = [(@data[byte_pos].unpack1('c') & ~RuneRb::IO::BIT_MASK_OUT[bit_offset])].pack('c')
190
+ @data[byte_pos] = [(@data[byte_pos].unpack1('c') | (value >> (amount - bit_offset)) & RuneRb::IO::BIT_MASK_OUT[bit_offset])].pack('c')
191
+ byte_pos += 1
192
+ amount -= bit_offset
193
+ bit_offset = 8
194
+ end
195
+
196
+ @data[byte_pos] = [0].pack('c') if @data[byte_pos].nil?
197
+
198
+ if amount == bit_offset
199
+ @data[byte_pos] = [(@data[byte_pos].unpack1('c') & ~RuneRb::IO::BIT_MASK_OUT[bit_offset])].pack('c')
200
+ @data[byte_pos] = [(@data[byte_pos].unpack1('c') | (value & RuneRb::IO::BIT_MASK_OUT[bit_offset]))].pack('c')
201
+ else
202
+ @data[byte_pos] = [(@data[byte_pos].unpack1('c') & ~(RuneRb::IO::BIT_MASK_OUT[amount] << (bit_offset - amount)))].pack('c')
203
+ @data[byte_pos] = [(@data[byte_pos].unpack1('c') | ((value & RuneRb::IO::BIT_MASK_OUT[amount]) << (bit_offset - amount)))].pack('c')
204
+ end
205
+ end
206
+ end
207
+ end
208
+
209
+
210
+ # Copyright (c) 2022, Patrick W.
211
+ # All rights reserved.
212
+ #
213
+ # Redistribution and use in source and binary forms, with or without
214
+ # modification, are permitted provided that the following conditions are met:
215
+ #
216
+ # * Redistributions of source code must retain the above copyright notice, this
217
+ # list of conditions and the following disclaimer.
218
+ #
219
+ # * Redistributions in binary form must reproduce the above copyright notice,
220
+ # this list of conditions and the following disclaimer in the documentation
221
+ # and/or other materials provided with the distribution.
222
+ #
223
+ # * Neither the name of the copyright holder nor the names of its
224
+ # contributors may be used to endorse or promote products derived from
225
+ # this software without specific prior written permission.
226
+ #
227
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
228
+ # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
229
+ # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
230
+ # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
231
+ # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
232
+ # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
233
+ # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
234
+ # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
235
+ # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
236
+ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
File without changes
File without changes
File without changes
@@ -0,0 +1,146 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rrb_data'
4
+ require 'rrb_game'
5
+ require 'rrb_net'
6
+
7
+ # Utility objects and modules.
8
+ module RuneRb::Utils
9
+
10
+ # The Controller instance facilitates the deployment of game world and server instances.
11
+ class Controller
12
+ using RuneRb::Patches::IntegerRefinements
13
+
14
+ include RuneRb::Utils::Logging
15
+
16
+ include Singleton
17
+
18
+ # @!attribute [r] sessions
19
+ # @return [Hash] a collection of sessions.
20
+ attr :sessions
21
+
22
+ # @!attribute [r] servers
23
+ # @return [Hash] a collection of server objects and signatures.
24
+ attr :servers
25
+
26
+ # @!attribute [r] worlds
27
+ # @return [Array] a map of World instances.
28
+ attr :worlds
29
+
30
+ # Constructs a new Controller object
31
+ def initialize
32
+ @worlds = {}
33
+ @start = { time: Process.clock_gettime(Process::CLOCK_MONOTONIC), stamp: Time.now }
34
+ end
35
+
36
+ def autorun
37
+ # Setup signal trapping
38
+ setup_trapping
39
+
40
+ # Deploy server process
41
+ deploy_server
42
+
43
+ # Deploy Game world
44
+ deploy_world
45
+
46
+ # Deploy Console
47
+ deploy_console
48
+ ensure
49
+ shutdown
50
+ end
51
+
52
+ # Logs information about the worlds, servers, and session states.
53
+ def about
54
+ log COLORS.cyan("[Server]:\n#{@server_pid.nil? ? COLORS.green.bold(@server_pid) : COLORS.red.bold('nil')}")
55
+ log COLORS.cyan("[World]:\n#{@world_pid.nil? ? COLORS.green.bold(@world_pid) : COLORS.red.bold('nil')}")
56
+ end
57
+
58
+ # Deploy a console session.
59
+ def deploy_console
60
+ Pry.start(self)
61
+ end
62
+
63
+ # Deploys a single TCP Socket Server.
64
+ # @return [Integer, NilClass] the process ID for the server process.
65
+ def deploy_server
66
+ @server_pid ||= Process.fork { RuneRb::Network::Server.instance.autorun }
67
+ end
68
+
69
+ # Deploys a single instance of {RuneRb::Game::World::Instance}
70
+ # @return [Integer, NilClass] the constructed World
71
+ def deploy_world
72
+ @world_pid ||= Process.fork { RuneRb::Game::World::Instance.instance }
73
+ end
74
+
75
+ # Stop all server instances and close all connected sessions.
76
+ def shutdown(graceful: true)
77
+ # Kill server process
78
+ Process.kill(graceful ? 'INT' : 'TERM', @server_pid) unless @server_pid.nil?
79
+
80
+ # Kill World processes
81
+ Process.kill(graceful ? 'INT' : 'TERM', @world_pid) unless @world_pid.nil?
82
+
83
+ # Log up-time
84
+ log! COLORS.blue.bold("Total Controller Up-time: #{up_time.to_i.to_ftime}")
85
+ ensure
86
+ exit!
87
+ end
88
+
89
+ # The current up-time for the server.
90
+ def up_time
91
+ (Process.clock_gettime(Process::CLOCK_MONOTONIC) - @start[:time]).round(3)
92
+ end
93
+
94
+ private
95
+
96
+ def setup_trapping
97
+ # Trap Interrupt (INT) signals.
98
+ Signal.trap('INT') do
99
+ Thread.new do
100
+ log! COLORS.red('Caught INTERRUPT!')
101
+ log! COLORS.red.bold('Shutting Down...')
102
+ ensure
103
+ shutdown
104
+ end.join
105
+ end
106
+
107
+ # Trap Termination (TERM) signals.
108
+ Signal.trap('TERM') do
109
+ Thread.new do
110
+ log! COLORS.red('Caught TERMINATION!')
111
+ log! COLORS.red.bold('Shutting Down...')
112
+ ensure
113
+ shutdown
114
+ end.join
115
+ end
116
+ end
117
+ end
118
+ end
119
+
120
+ # Copyright (c) 2021, Patrick W.
121
+ # All rights reserved.
122
+ #
123
+ # Redistribution and use in source and binary forms, with or without
124
+ # modification, are permitted provided that the following conditions are met:
125
+ #
126
+ # * Redistributions of source code must retain the above copyright notice, this
127
+ # list of conditions and the following disclaimer.
128
+ #
129
+ # * Redistributions in binary form must reproduce the above copyright notice,
130
+ # this list of conditions and the following disclaimer in the documentation
131
+ # and/or other materials provided with the distribution.
132
+ #
133
+ # * Neither the name of the copyright holder nor the names of its
134
+ # contributors may be used to endorse or promote products derived from
135
+ # this software without specific prior written permission.
136
+ #
137
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
138
+ # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
139
+ # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
140
+ # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
141
+ # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
142
+ # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
143
+ # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
144
+ # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
145
+ # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
146
+ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
File without changes
File without changes
File without changes
data/{app → lib}/rrb.rb RENAMED
@@ -5,7 +5,6 @@ $LOAD_PATH.unshift File.dirname(__FILE__)
5
5
 
6
6
  require 'dotenv'
7
7
  require 'druuid'
8
- require 'eventmachine'
9
8
  require 'logger'
10
9
  require 'oj'
11
10
  require 'open-uri'
@@ -14,7 +13,6 @@ require 'pry'
14
13
  require 'singleton'
15
14
  require 'set'
16
15
 
17
- ##
18
16
  # RuneRb -
19
17
  # A gameserver framework written in Ruby targeting the 2006 era (or the 317-377 protocols) of the popular MMORPG, RuneScape.
20
18
  #
@@ -22,6 +20,35 @@ require 'set'
22
20
  # @since 0.0.1
23
21
  module RuneRb
24
22
 
23
+ # The IO module provides objects, modules, and functions to handle input/output operations.
24
+ module IO
25
+ # Acceptable byte orders in which multi-byte values can be read.
26
+ # @return [Array] the orders.
27
+ BYTE_ORDERS = /(?i)\bBIG|MIDDLE|INVERSE_MIDDLE|LITTLE/.freeze
28
+
29
+ # The size of a byte
30
+ # @type [Integer] the size
31
+ BYTE_SIZE = 8
32
+
33
+ # Valid byte mutations
34
+ # @return [Hash]
35
+ BYTE_MUTATIONS = %i[ADD NEG SUB STD].freeze
36
+
37
+ # Types that can be read.
38
+ RW_TYPES = %i[bits bit byte bytes medium int long reverse_bytes short smart string].freeze
39
+
40
+ # Bit masks for bit packing
41
+ # @return [Array]
42
+ BIT_MASK_OUT = (0...32).collect { |bit| (1 << bit) - 1 }
43
+
44
+ autoload :Buffer, 'rrb/io/buffer'
45
+ autoload :Message, 'rrb/io/message'
46
+ autoload :NativeReadable, 'rrb/io/native_readable'
47
+ autoload :Readable, 'rrb/io/readable'
48
+ autoload :Writeable, 'rrb/io/writeable'
49
+ autoload :Validation, 'rrb/io/validation'
50
+ end
51
+
25
52
  # Utility objects and modules.
26
53
  module Utils
27
54
  autoload :Controller, 'rrb/utils/controller'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rrb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Patrick W.
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-03-11 00:00:00.000000000 Z
11
+ date: 2022-03-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dotenv
@@ -50,26 +50,6 @@ dependencies:
50
50
  - - ">="
51
51
  - !ruby/object:Gem::Version
52
52
  version: 1.0.2
53
- - !ruby/object:Gem::Dependency
54
- name: eventmachine
55
- requirement: !ruby/object:Gem::Requirement
56
- requirements:
57
- - - "~>"
58
- - !ruby/object:Gem::Version
59
- version: '1.2'
60
- - - ">="
61
- - !ruby/object:Gem::Version
62
- version: 1.2.7
63
- type: :runtime
64
- prerelease: false
65
- version_requirements: !ruby/object:Gem::Requirement
66
- requirements:
67
- - - "~>"
68
- - !ruby/object:Gem::Version
69
- version: '1.2'
70
- - - ">="
71
- - !ruby/object:Gem::Version
72
- version: 1.2.7
73
53
  - !ruby/object:Gem::Dependency
74
54
  name: logger
75
55
  requirement: !ruby/object:Gem::Requirement
@@ -190,43 +170,49 @@ dependencies:
190
170
  - - ">="
191
171
  - !ruby/object:Gem::Version
192
172
  version: 13.0.0
193
- description:
173
+ description:
194
174
  email: Sickday@pm.me
195
175
  executables: []
196
176
  extensions: []
197
177
  extra_rdoc_files: []
198
178
  files:
199
- - app/rrb.rb
200
- - app/rrb/patches/integer.rb
201
- - app/rrb/patches/set.rb
202
- - app/rrb/patches/string.rb
203
- - app/rrb/utils/controller.rb
204
- - app/rrb/utils/environment.rb
205
- - app/rrb/utils/logging.rb
206
- - app/rrb/utils/version.rb
207
- homepage: https://git.repos.pw/rune.rb/app
179
+ - lib/rrb.rb
180
+ - lib/rrb/io/buffer.rb
181
+ - lib/rrb/io/message.rb
182
+ - lib/rrb/io/native_readable.rb
183
+ - lib/rrb/io/readable.rb
184
+ - lib/rrb/io/validation.rb
185
+ - lib/rrb/io/writeable.rb
186
+ - lib/rrb/patches/integer.rb
187
+ - lib/rrb/patches/set.rb
188
+ - lib/rrb/patches/string.rb
189
+ - lib/rrb/utils/controller.rb
190
+ - lib/rrb/utils/environment.rb
191
+ - lib/rrb/utils/logging.rb
192
+ - lib/rrb/utils/version.rb
193
+ homepage: https://git.repos.pw/rune.rb/lib
208
194
  licenses:
209
195
  - BSD-3-Clause
210
196
  metadata:
211
- source_code_uri: https://git.repos.pw/rune.rb/app
212
- post_install_message:
197
+ source_code_uri: https://git.repos.pw/rune.rb/lib
198
+ post_install_message:
213
199
  rdoc_options: []
214
200
  require_paths:
215
- - app
216
- - app/rrb
201
+ - lib
202
+ - lib/rrb
217
203
  required_ruby_version: !ruby/object:Gem::Requirement
218
204
  requirements:
219
205
  - - ">="
220
206
  - !ruby/object:Gem::Version
221
- version: 3.0.1
207
+ version: 2.7.5
222
208
  required_rubygems_version: !ruby/object:Gem::Requirement
223
209
  requirements:
224
210
  - - ">="
225
211
  - !ruby/object:Gem::Version
226
212
  version: '0'
227
213
  requirements: []
228
- rubygems_version: 3.3.3
229
- signing_key:
214
+ rubygems_version: 3.3.7
215
+ signing_key:
230
216
  specification_version: 4
231
217
  summary: A gameserver framework written in Ruby targeting the 2006 era (or the 317-377
232
218
  protocols) of the popular MMORPG, RuneScape.