Add player info snap obj
This commit is contained in:
parent
d4ccfc24e1
commit
0bcd7bb960
|
@ -1,6 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require_relative '../../packer'
|
||||
require_relative '../snap_item_base'
|
||||
|
||||
class NetObj
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require_relative '../../packer'
|
||||
require_relative '../snap_item_base'
|
||||
|
||||
class NetObj
|
||||
|
|
22
lib/snapshot/items/player_info.rb
Normal file
22
lib/snapshot/items/player_info.rb
Normal file
|
@ -0,0 +1,22 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require_relative '../snap_item_base'
|
||||
|
||||
class NetObj
|
||||
class PlayerInfo < SnapItemBase
|
||||
attr_accessor :player_flags, :score, :latency
|
||||
|
||||
def initialize(hash_or_raw)
|
||||
@field_names = %i[
|
||||
player_flags
|
||||
score
|
||||
latency
|
||||
]
|
||||
super
|
||||
end
|
||||
|
||||
def self.match_type?(type)
|
||||
type == NETOBJTYPE_PLAYERINFO
|
||||
end
|
||||
end
|
||||
end
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
require_relative 'items/game_data'
|
||||
require_relative 'items/character'
|
||||
require_relative 'items/player_info'
|
||||
require_relative '../packer'
|
||||
|
||||
class SnapshotUnpacker
|
||||
|
@ -147,16 +148,15 @@ class SnapshotUnpacker
|
|||
obj = nil
|
||||
if NetObj::GameData.match_type?(item_type)
|
||||
obj = NetObj::GameData.new(u)
|
||||
notes += obj.notes
|
||||
# p obj
|
||||
elsif NetObj::Character.match_type?(item_type)
|
||||
obj = NetObj::Character.new(u)
|
||||
notes += obj.notes
|
||||
# p obj
|
||||
elsif NetObj::PlayerInfo.match_type?(item_type)
|
||||
obj = NetObj::PlayerInfo.new(u)
|
||||
elsif @verbose
|
||||
puts "no match #{item_type}"
|
||||
end
|
||||
if obj
|
||||
notes += obj.notes
|
||||
notes.push([
|
||||
:green,
|
||||
id_parsed[:pos],
|
||||
|
|
Loading…
Reference in a new issue