View Single Post
  #1  
Old 01-08-2010, 02:09 PM
erde
Sarnak
 
Join Date: Sep 2006
Location: Germany
Posts: 82
Default ruby extractor tool

Hello, i am working on a ruby extension to read the packet logs. This is very experimental, currently

I am not sure what structs are important! to extract
What format should the tool output?

Here is some sample output
Log created: 2009-12-19 15:00:29 +0100

Code:
Opcode: 43ac OP_NewZone
Char Name: xxx
Long Name: The Plane of Knowledge
Short Name: PoKnowledge
zone: poknowledge
Type: 0
fog_red: [50, 50, 50, 50]
fog_green: [50, 50, 50, 50]
fog_blue: [155, 155, 150, 150]
fog_minclip: [400.0, 400.0, 400.0, 400.0]
fog_maxclip: [2000.0, 2000.0, 2000.0, 2000.0]
gravity: 0.400000005960464
time_type: 2
Sky: 0
zone_exp_multiplier: 1.0
safe_y: -148.0
safe_x: -285.0
safe_z: -159.0
max_z: 0.0
underworld: -5000.0
minclip: 50.0
maxclip: 2000.0
Short Name2: poknowledge
zone_id: 202
zone_instance: 0
fall_damage: 1

Opcode: 5c85 OP_GroundSpawn
Name: IT10645_ACTORDEF
Linked list [0, 142262936]
Drop Id 21
Zone Id 202
Zone Instance 0
Heading 255.0
Size 1.0
X 538.0
Y -405.0
Z -88.0
Object Type 1
Spawn Id 0
unknown096 [255, 255, 255, 255]
This ist the current source of the tool:
Code:
require 'ext/EQEmu'
require 'Live_Structs'

puts "GroundSpawn Test"

begin
	pfr = PacketFile::RbPacketFileReader.new 
rescue Exception => e
	puts "#{ e } (#{ e.class })!"
end

begin
	pfr.OpenFile( "packetlog-156738727.pf" )
rescue Exception => e
	puts "#{ e } (#{ e.class })!"
end

begin
	puts pfr.GetStamp()
rescue Exception => e
	puts "#{ e } (#{ e.class })!"
end

@op = OpcodeMgr::RegularOpcodeManager.new
@op.LoadOpcodes( "patch_Live.conf" )
begin
	while pfr.ReadPacket()
		opcode = @op.EQToEmu( pfr.getOpCode() )

		if opcode == EmuOpcodes::OP_GroundSpawn
			puts "Opcode: " + pfr.getOpCode().to_s(16) + " " + EmuOpcodes::OpcodeName(@op.EQToEmu(pfr.getOpCode()))
			p = pfr.getPacket()
			begin
			  a = Object_Struct.new
				a.read(p)
				puts "Name: #{a.object_name}"
				puts "Linked list #{a.linked_list_addr}"
				puts "Drop Id #{a.drop_id}"
				puts "Zone Id #{a.zone_id}"
				puts "Zone Instance #{a.zone_instance}"
				puts "Heading #{a.heading}"
				puts "Size #{a.osize}"
				puts "X #{a.x}"
				puts "Y #{a.y}"
				puts "Z #{a.z}"
				puts "Object Type #{a.object_type}"
				puts "Spawn Id #{a.spawn_id}"
				puts "unknown096 #{a.unknown096}"
				puts
			rescue Exception => e
				puts "#{ e } (#{ e.class })!"
			end
		end
		if opcode == EmuOpcodes::OP_NewZone
			puts "Opcode: " + pfr.getOpCode().to_s(16) + " " + EmuOpcodes::OpcodeName(@op.EQToEmu(pfr.getOpCode()))
			p = pfr.getPacket()
			begin
				a = NewZone_Struct.new
				a.read(p)
				puts "Char Name: #{a.char_name}"
				puts "Long Name: #{a.zone_long_name}"
				puts "Short Name: #{a.zone_short_name}"
				puts "zone: #{a.zone_short_name2}"
				puts "Type: #{a.ztype}"
				puts "fog_red: #{a.fog_red}"
				puts "fog_green: #{a.fog_green}"
				puts "fog_blue: #{a.fog_blue}"
				puts "fog_minclip: #{a.fog_minclip}"
				puts "fog_maxclip: #{a.fog_maxclip}"
				puts "gravity: #{a.gravity}"
				puts "time_type: #{a.time_type}"
				puts "Sky: #{a.sky}"
				puts "zone_exp_multiplier: #{a.zone_exp_multiplier}"
				puts "safe_y: #{a.safe_y}"
				puts "safe_x: #{a.safe_x}"
				puts "safe_z: #{a.safe_z}"
				puts "max_z: #{a.max_z}"
				puts "underworld: #{a.underworld}"
				puts "minclip: #{a.minclip}"
				puts "maxclip: #{a.maxclip}"
				puts "Short Name2: #{a.zone_short_name2}"
				puts "zone_id: #{a.zone_id}"
				puts "zone_instance: #{a.zone_instance}"
				puts "fall_damage: #{a.fall_damage}"
				puts
			rescue Exception => e
				puts "#{ e } (#{ e.class })!"
			end
		end
		if opcode == EmuOpcodes::OP_PlayerProfile
		  p = pfr.getPacket()
			begin
				a = CharProfileStruct.new
				a.read(p)
				puts

			rescue Exception => e
				puts "#{ e } (#{ e.class })!"
			end
		end
	end
rescue Exception => e
	puts "#{ e } (#{ e.class })!"
end

pfr.CloseFile()
puts "End"
__________________
"Yes, the artwork is awful. I am an engineer, not an artist " - David H. Eberly
Reply With Quote