Bug in "showeq"

Forum closed. All further discussion to be discussed at https://github.com/OpenKore/

Moderator: Moderators

Message
Author
Kaspy
Halfway to Eternity
Halfway to Eternity
Posts: 398
Joined: 08 Jun 2012, 15:42
Noob?: No
Location: Brazil

Bug in "showeq"

#1 Post by Kaspy »

[EN]
I was trying to fix the bug in showeq, but I could not ...
The equipment account target are as follows:

Code: Select all

topHead        : Solidéu
midHead        : -
lowHead        : -
leftHand       : -
rightHand      : Bíblia [2]
robe           : -
armor          : Robe Puente [1]
shoes          : -
leftAccessory  : Anel de Maçã Verde
rightAccessory : Rosário
arrow          : -
However, while the other BOT will use the showeq it shows this:

Code: Select all

armor          : BROKEN Unknown #26
               : BROKEN None [?8]
               : BROKEN +1 None [?128:?136]
               : BROKEN +6 None [?2*2:?261]
               : BROKEN None [?256*2:?260:Solidéu]
Item           : BROKEN None
Changing this part of the command showeq in ServerType0.pm from

Code: Select all

message sprintf("%-15s: %s\n", $equipSlot_lut{$item->{equipped}}, itemName($item)), "list";
to

Code: Select all

message sprintf("%-15s: %s\n", $item->{equipped}, itemName($item)), "list";
results in

Code: Select all

16             : BROKEN Unknown #26
260            : BROKEN None [?8]
2795           : BROKEN +1 None [?128:?136]
29             : BROKEN +6 None [?2*2:?261]
15             : BROKEN None [?256*2:?260:Solidéu]
0              : BROKEN None
As you can see, the itemName($item) ends resulting in the correct position of the equipment (256 rather than 15, for example).
But the way that it generates is not as readable and equipment are not broken.

I could not fix these bugs...
The only thing that seems certain is that the left ServerType0 changed

Code: Select all

# '0859' => ['show_eq'],
to

Code: Select all

'0859' => ['show_eq', 'v Z24 v8 C', [qw(len name type hair_style lowhead midhead tophead robe hair_color clothes_color sex)]], #type is job
and this is the correct way, as seen in clif.c rAthena emulator.




[PT-BR]
Estava tentando corrigir o bug no showeq, mas não consegui...
Os equipamentos da conta alvo estão assim:

Code: Select all

topHead        : Solidéu
midHead        : -
lowHead        : -
leftHand       : -
rightHand      : Bíblia [2]
robe           : -
armor          : Robe Puente [1]
shoes          : -
leftAccessory  : Anel de Maçã Verde
rightAccessory : Rosário
arrow          : -
Porém, quando o outro BOT vai usar o showeq nele, mostra isso:

Code: Select all

armor          : BROKEN Unknown #26
               : BROKEN None [?8]
               : BROKEN +1 None [?128:?136]
               : BROKEN +6 None [?2*2:?261]
               : BROKEN None [?256*2:?260:Solidéu]
Item           : BROKEN None
Alterando essa parte do comando showeq no ServerType0.pm de

Code: Select all

message sprintf("%-15s: %s\n", $equipSlot_lut{$item->{equipped}}, itemName($item)), "list";
para

Code: Select all

message sprintf("%-15s: %s\n", $item->{equipped}, itemName($item)), "list";
resulta em

Code: Select all

16             : BROKEN Unknown #26
260            : BROKEN None [?8]
2795           : BROKEN +1 None [?128:?136]
29             : BROKEN +6 None [?2*2:?261]
15             : BROKEN None [?256*2:?260:Solidéu]
0              : BROKEN None
Como pode ser visto, o itemName($item) acaba resultando a posição correta do equipamento (256 ao invés de 15, por exemplo).
Porém, a forma que ele gera não é tão legível e os equipamentos não estão quebrado.

Não consegui concertar esses bugs...
O único que aparentemente deixei certo é que no ServerType0 alterei

Code: Select all

# '0859' => ['show_eq'],
para

Code: Select all

'0859' => ['show_eq', 'v Z24 v8 C', [qw(len name type hair_style lowhead midhead tophead robe hair_color clothes_color sex)]], #type is job
sendo essa a forma correta, conforme vi no clif.c do emulador rAthena.
Image

Kaspy
Halfway to Eternity
Halfway to Eternity
Posts: 398
Joined: 08 Jun 2012, 15:42
Noob?: No
Location: Brazil

Re: Bug in "showeq"

#2 Post by Kaspy »

[EN]
Looking a little deeper, I believe the problem is that part I have highlighted:

Code: Select all

sub show_eq {	my ($self, $args) = @_;


[b]	my $unpack_string  = "v ";
	   $unpack_string .= "v C2 v2 C2 ";
	   $unpack_string .= "a8 ";
	   $unpack_string .= "a6"; #unimplemented in eA atm[/b]


	message sprintf("------- %s (%s) -------\n", $args->{name}, $jobs_lut{$args->{type}}), "list";


	for (my $i = 43; $i < $args->{RAW_MSG_SIZE}; $i += 26) {
[b]		my ($index,
			$ID, $type, $identified, $type_equip, $equipped, $broken, $upgrade, # typical for nonstackables
			$cards,
			$expire) = unpack($unpack_string, substr($args->{RAW_MSG}, $i));[/b]


		my $item = {};
		$item->{index} = $index;


		$item->{nameID} = $ID;
		$item->{type} = $type;


		$item->{identified} = $identified;
		$item->{type_equip} = $type_equip;
		$item->{equipped} = $equipped;
		$item->{broken} = $broken;
		$item->{upgrade} = $upgrade;


		$item->{cards} = $cards;


		$item->{expire} = $expire;


		message sprintf("%-15s: %s\n", $equipSlot_lut{$item->{equipped}}, itemName($item)), "list";
		debug "$index, $ID, $type, $identified, $type_equip, $equipped, $broken, $upgrade, $cards, $expire\n";
	}
}
In 0859 has one parameter more than the 02D7, the robe. I did not include the $unpack_string because I do not know how. I found it more confusing.
Am I right, or not?

[PT-BR]
Analisando um pouco mais a fundo, acredito que o problema seja nessa parte que destaquei:

Code: Select all

sub show_eq {	my ($self, $args) = @_;


[b]	my $unpack_string  = "v ";
	   $unpack_string .= "v C2 v2 C2 ";
	   $unpack_string .= "a8 ";
	   $unpack_string .= "a6"; #unimplemented in eA atm[/b]


	message sprintf("------- %s (%s) -------\n", $args->{name}, $jobs_lut{$args->{type}}), "list";


	for (my $i = 43; $i < $args->{RAW_MSG_SIZE}; $i += 26) {
[b]		my ($index,
			$ID, $type, $identified, $type_equip, $equipped, $broken, $upgrade, # typical for nonstackables
			$cards,
			$expire) = unpack($unpack_string, substr($args->{RAW_MSG}, $i));[/b]


		my $item = {};
		$item->{index} = $index;


		$item->{nameID} = $ID;
		$item->{type} = $type;


		$item->{identified} = $identified;
		$item->{type_equip} = $type_equip;
		$item->{equipped} = $equipped;
		$item->{broken} = $broken;
		$item->{upgrade} = $upgrade;


		$item->{cards} = $cards;


		$item->{expire} = $expire;


		message sprintf("%-15s: %s\n", $equipSlot_lut{$item->{equipped}}, itemName($item)), "list";
		debug "$index, $ID, $type, $identified, $type_equip, $equipped, $broken, $upgrade, $cards, $expire\n";
	}
}
No 0859 tem um parâmetro a mais que o 02D7, o robe. Eu não inclui no $unpack_string pois não sei como fazer isso. Achei confuso de mais.
Estou certo mesmo ou não?
Image

Locked