module RuneRb::Net
Constants
- CONNECTION_COUNTS
- CONNECTION_INTERVAL
- CONNECTION_MAX
- CONNECTION_TIMES
Connection
throttling- LOG
- OPCODE_GAME
The client sends this value when connecting to the game server.
- OPCODE_PLAYERCOUNT
Server
status pages use this to get the number of users online.- OPCODE_UPDATE
The client sends this value when connecting to the update server.
- PACKET_SIZES
Contains sizes for all of the packets. If an index contains a negative number, it is of variable length.
Public Class Methods
handle_packet(player, packet)
click to toggle source
# File app/net/packetloader.rb, line 19 def Net.handle_packet(player, packet) return if !player if PACKETS.include?(packet.opcode) handler = PACKETS[packet.opcode] if handler.instance_of?(Proc) handler.call(player, packet) end else Logging.logger['packets'].warn "Unhandled packet: id = #{packet.opcode}, length = #{packet.buffer.length}, payload = #{Net.hexstr(packet.buffer)}" end end
hexstr(src)
click to toggle source
# File app/net/packetloader.rb, line 33 def Net.hexstr(src) dest = "" src.each_byte {|b| dest << (b < 16 ? "0" : "") + b.to_s(16) + " " } dest.strip end
load_packets()
click to toggle source
# File app/net/packetloader.rb, line 11 def Net.load_packets # Reset old packet handlers PACKETS.clear # Parse files Dir["./plugins/packets/*.rb"].each {|file| load file } end