[iRO::Valkyrie] incorrect forged item name generation

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

Moderators: Moderators, Developers

Message
Author
obsc
Noob
Noob
Posts: 18
Joined: 11 Sep 2009, 03:58
Noob?: Yes

[iRO::Valkyrie] incorrect forged item name generation

#1 Post by obsc »

[iRO::Valkyrie]

i got forged "<name>'s Damascus" - yes, NO element and NO starcrumbs.

"i" command lists it as following:

Code: Select all

-- Equipment (Not Equipped) --
15   Main Gauche [Santa Poring*4] [4] (Weapon)            
16   VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVS Holy Damascus (Weapon)  
22   Earth Damascus (Weapon)   
...
packet:

Code: Select all

D0 02 
EE 00 
16 00 B8 04 05 01 22 00 00 00 00 00 A5 0F A5 0F A5 0F A5 0F 00 00 00 00 00 00 
18 00 C6 04 05 01 22 00 00 00 00 00 FF 00 00 00 16 C2 0A 00 00 00 00 00 00 00   <-- this one
25 00 C6 04 05 01 22 00 00 00 00 00 FF 00 03 00 3D 47 08 00 00 00 00 00 00 00 
26 00 B8 04 05 01 22 00 00 00 00 00 DC 0F DC 0F DC 0F DC 0F 00 00 00 00 00 00 
27 00 51 15 04 01 00 01 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
28 00 23 09 04 01 10 00 10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
29 00 DA 09 04 01 04 00 04 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
2A 00 C6 04 05 01 22 00 02 00 00 00 FF 00 02 00 16 C2 0A 00 00 00 00 00 00 00 
2B 00 B8 04 05 01 22 00 20 00 00 00 DF 0F DF 0F DF 0F DF 0F 00 00 00 00 00 00
sems like problem lies in src/Misc.pm's itemName function. here's possibly faulty code branch (with inserted debug logging code):

Code: Select all

...
        } elsif ($cards[0] == 255) {
                # Forged weapon
                #
                # Display e.g. "VVS Earth" or "Fire"
                my $elementID = $cards[1] % 10;
                my $elementName = $elements_lut{$elementID};
                my $starCrumbs = ($cards[1] >> 8) / 5;
# [-sinny-]
message TF("[dbg] ~~~ cards[1](%d) elem(%d->%s) starCrumbs(%d) ~~~ \n", $cards[1], $elementID, $elementName, $starCrumbs), "info";
                $prefix .= ('V'x$starCrumbs)."S " if $starCrumbs;
                $prefix .= "$elementName " if ($elementName ne "");
        } elsif (@cards) {
...
for my weird damascus inserted logging would print:

Code: Select all

[info] [dbg] ~~~ cards[1](49686) elem(6->Holy) starCrumbs(38) ~~~  
my common coding sense gets screwed up trying to get how "$cards[1]" could expand to "49686" (insufficient perl knowledge?) so i can make no further progress on this on my own...

User avatar
kLabMouse
Administrator
Administrator
Posts: 1301
Joined: 24 Apr 2008, 12:02

Re: [iRO::Valkyrie] incorrect forged item name generation

#2 Post by kLabMouse »

Could be caused that 0x02D0, 0x02D1, 0x02D2 packets internals changed a bit.
We know 2 types of internal: len 26 and 28.
the bug could be caused by trying to parse Internals with wrong struct len.


P.S. Just finished the HEX pattern to check that:
Check EQUIPMENTITEM_EXTRAINFO3 len (packets: 0x02d0, 0x02d1, 0x02d2):
EQUIPMENTITEM_EXTRAINFO3 Struct [0x02d0, 0x02d1, 0x02d2] (Extended, len 28):
8B 45 08 83 C6 1C 48 89 5D C4 89 5D C8 89 5D ?? 89 45 08 0F ?? ?? ?? ?? ?? 5F

EQUIPMENTITEM_EXTRAINFO3 Struct [0x02d0, 0x02d1, 0x02d2] (Normal, len 26):
8B 45 08 83 C6 1A 48 89 5D C8 89 5D CC 89 5D ?? 89 45 08 0F ?? ?? ?? ?? ?? 5F

User avatar
kLabMouse
Administrator
Administrator
Posts: 1301
Joined: 24 Apr 2008, 12:02

Re: [iRO::Valkyrie] incorrect forged item name generation

#3 Post by kLabMouse »

Hmm.. nope.
I think, OpenKore supports Item Type somehow Wrong:

Code: Select all

typedef enum <unnamed-tag> {
  TYPE_HEAL =  0x0,
  TYPE_SCHANGE =  0x1,
  TYPE_SPECIAL =  0x2,
  TYPE_EVENT =  0x3,
  TYPE_ARMOR =  0x4,
  TYPE_WEAPON =  0x5,
  TYPE_CARD =  0x6,
  TYPE_QUEST =  0x7,
  TYPE_BOW =  0x8,
  TYPE_BOTHHAND =  0x9,
  TYPE_ARROW =  0xa,
  TYPE_ARMORTM =  0xb,
  TYPE_ARMORTB =  0xc,
  TYPE_ARMORMB =  0xd,
  TYPE_ARMORTMB =  0xe,
  TYPE_GUN =  0xf,
  TYPE_AMMO =  0x10,
  TYPE_THROWWEAPON =  0x11,
  TYPE_CASH_POINT_ITEM =  0x12,
  TYPE_CANNONBALL =  0x13,
  TYPE_COSTUME =  0x14,
  TYPE_LAST =  0x15,
} <unnamed-tag>;


typedef enum enumInventoryItemType {
  INVENTORYITEMTYPE_ITEM =  0x0,
  INVENTORYITEMTYPE_NORMALITEM =  0x1,
  INVENTORYITEMTYPE_NORMALARROWITEM =  0x2,
  INVENTORYITEMTYPE_EQUIPITEM =  0x3,
  INVENTORYITEMTYPE_MONEYITEM =  0x4,
  INVENTORYITEMTYPE_SKILL =  0x5,
  INVENTORYITEMTYPE_UNNONE =  0x6,
  INVENTORYITEMTYPE_QUESTITEM =  0x7,
  INVENTORYITEMTYPE_CASHPOINTITEM =  0x8,
} enumInventoryItemType;

obsc
Noob
Noob
Posts: 18
Joined: 11 Sep 2009, 03:58
Noob?: Yes

Re: [iRO::Valkyrie] incorrect forged item name generation

#4 Post by obsc »

seems to me like the problem is purely in the code branch i quoted at the very beginning.

i can confirm the following being displayed as it should:
- forged elemental with NO starcrumbs.

it should be laid out absolutely the same way in packet as non-elemental non-starcrumb forged weapon in question.

UPD:
to be more precise, i get the following debug output in openkore:

Code: Select all

[info] [dbg] ~~~ cards[1](49686) elem(6->Holy) starCrumbs(38) ~~~ 
[info] [dbg] ~~~ cards[1](3) elem(3->Fire) starCrumbs(0) ~~~ 
[info] [dbg] ~~~ cards[1](2) elem(2->Earth) starCrumbs(0) ~~~ 
"<name>'s Earth Damascus" and "<name>'s Fire Damascus" are actually present in inventory. the problem is only with forged "<name>'s Damascus" (non-starcrumb and non-elemental) - it get named weirdly.
Last edited by obsc on 15 Aug 2010, 18:52, edited 1 time in total.

User avatar
kLabMouse
Administrator
Administrator
Posts: 1301
Joined: 24 Apr 2008, 12:02

Re: [iRO::Valkyrie] incorrect forged item name generation

#5 Post by kLabMouse »

Found it.
near the

Code: Select all

next unless $card;
push(@cards, $card);
($cards{$card} ||= 0) += 1;
Break all Special Items data.

Upd:
the thing is, that ZERO data is ignored, and does not get into the array.

EternalHarvest
Developers
Developers
Posts: 1798
Joined: 05 Dec 2008, 05:42
Noob?: Yes

Re: [iRO::Valkyrie] incorrect forged item name generation

#6 Post by EternalHarvest »

What's the status on this?

User avatar
kLabMouse
Administrator
Administrator
Posts: 1301
Joined: 24 Apr 2008, 12:02

Re: [iRO::Valkyrie] incorrect forged item name generation

#7 Post by kLabMouse »

Donno.
Someone Tried to Support it with StarCrumb patch.

Locked