![]() |
![]() |
3 Einträge, 1 Seite |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
for (my $i = $args->{RAW_MSG_SIZE} % 106; $i < $args->{RAW_MSG_SIZE}; $i += 106) {
#exp display bugfix - chobit andy 20030129
$num = unpack("C1", substr($args->{RAW_MSG}, $i + 104, 1));
$chars[$num] = new Actor::You;
$chars[$num]{'exp'} = unpack("V1", substr($args->{RAW_MSG}, $i + 4, 4));
$chars[$num]{'zenny'} = unpack("V1", substr($args->{RAW_MSG}, $i + 8, 4));
$chars[$num]{'exp_job'} = unpack("V1", substr($args->{RAW_MSG}, $i + 12, 4));
$chars[$num]{'lv_job'} = unpack("C1", substr($args->{RAW_MSG}, $i + 16, 1));
$chars[$num]{'hp'} = unpack("v1", substr($args->{RAW_MSG}, $i + 42, 2));
$chars[$num]{'hp_max'} = unpack("v1", substr($args->{RAW_MSG}, $i + 44, 2));
$chars[$num]{'sp'} = unpack("v1", substr($args->{RAW_MSG}, $i + 46, 2));
$chars[$num]{'sp_max'} = unpack("v1", substr($args->{RAW_MSG}, $i + 48, 2));
$chars[$num]{'jobID'} = unpack("C1", substr($args->{RAW_MSG}, $i + 52, 1));
$chars[$num]{'ID'} = substr($args->{RAW_MSG}, $i, 4);
$chars[$num]{'lv'} = unpack("C1", substr($args->{RAW_MSG}, $i + 58, 1));
$chars[$num]{'hair_color'} = unpack("C1", substr($args->{RAW_MSG}, $i + 70, 1));
($chars[$num]{'name'}) = substr($args->{RAW_MSG}, $i + 74, 24) =~ /([\s\S]*?)\000/;
$chars[$num]{'str'} = unpack("C1", substr($args->{RAW_MSG}, $i + 98, 1));
$chars[$num]{'agi'} = unpack("C1", substr($args->{RAW_MSG}, $i + 99, 1));
$chars[$num]{'vit'} = unpack("C1", substr($args->{RAW_MSG}, $i + 100, 1));
$chars[$num]{'int'} = unpack("C1", substr($args->{RAW_MSG}, $i + 101, 1));
$chars[$num]{'dex'} = unpack("C1", substr($args->{RAW_MSG}, $i + 102, 1));
$chars[$num]{'luk'} = unpack("C1", substr($args->{RAW_MSG}, $i + 103, 1));
$chars[$num]{'sex'} = $accountSex2;
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/perl
use strict;
use warnings;
use vars qw(@chars);
# Beispieldatensatz
my $msg = '1111' . '2222' . '3333' . '4444' . 'A' . '_' x 25 .
'55' . '66' . '77' . '88' . '_' x 2 .
'B' . '_' x 5 . 'C' . '_' x 11 .
'D' . '_' x 3 . 'E' x 24 .
'F' . 'G' . 'H' . 'I' . 'J' . 'K' . 'L' . '_';
print("Ein Datensatz: $msg\n\n");
# den gleichen Datensatz noch 2mal anghaengen
$msg .= $msg x 2;
# --- Begin interessanter Teil
# String in Datensaetze splitten
my(@records) = $msg =~ /(\w{106})/g;
foreach my $record ( @records ) {
my(%fields, $num);
(@fields{qw(ID exp zenny exp_job lv_job hp hp_max sp sp_max
jobID lv hair_color name str agi vit int dex luk )}, $num)
= unpack("V V V V C x25 v v v v x2 C x5 C x11 C x3 Z24 C C C C C C C", $record );
$chars[$num] = \%fields;
}
# --- Ende interessanter Teil
# Datensatz mit Index 76 ausgeben
foreach my $key ( keys %{ $chars[76] } ) {
printf("%s\t%s\n", $key, $chars[76]->{$key} );
}
unpack("V V V V C x25 v v v v x2 C x5 C x11 C x3 A24 C C C C C C C", $record );
1
2
my $x = int (length($msg) / 106);
unpack("x2 (V V V V C x25 v v v v x2 C x5 C x11 C x3 Z24 C C C C C C C)$x", $msg )
![]() |
![]() |
3 Einträge, 1 Seite |