Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

WZ Item Gender Flag?

Experienced Elementalist
Joined
Apr 29, 2016
Messages
269
Reaction score
4
Having some trouble finding the item gender flag, maybe I'm blind. I'm trying to make the Pink Strapless Bikini CS item genderless as a test, and I can't seem to find the dang flag for M/F.
 
Experienced Elementalist
Joined
Sep 27, 2016
Messages
217
Reaction score
68
According to the client, all overalls beginning with 01050xxx are male, 01051xxx are female, and anything 01052xxx and above, are neither/multi-gender. I'm not too sure about client edits, but I don't think there's a way to make an exception for 1 item. The only way to make it multi-gender would be to put it at a 01052xxx or above ID (basically just make a new item, copy/pasted in the wz)
 
Upvote 0
Experienced Elementalist
Joined
Apr 29, 2016
Messages
269
Reaction score
4
According to the client, all overalls beginning with 01050xxx are male, 01051xxx are female, and anything 01052xxx and above, are neither/multi-gender. I'm not too sure about client edits, but I don't think there's a way to make an exception for 1 item. The only way to make it multi-gender would be to put it at a 01052xxx ID (basically just make a new item, copy/pasted in the wz)

My goal is to remove the gender restriction on everything, so perhaps it's possible for me to make an edit in the client for it to read any item as any gender... If not, I have a lot of copying to do!
 
Upvote 0
Newbie Spellweaver
Joined
Jan 31, 2019
Messages
50
Reaction score
18
There's this function in the v95 PDB.
Code:
int __cdecl get_gender_from_id(int nItemID)
{
  int result; // eax
  if ( nItemID / 1000000 != 1 )
    return 2;
  switch ( nItemID / 1000 % 10 )  {
    case 0:
      result = 0;
      break;
    case 1:
      result = 1;
      break;
    default:
      return 2;
  }
  return result;
}

You can go to its first instruction and write:
Code:
mov eax,2
ret
To make it always return 2 (gender neutral result). Might require a slightly different edit if the calling convention changed across versions but I don't think it would change much.
 
Upvote 0
Experienced Elementalist
Joined
Apr 29, 2016
Messages
269
Reaction score
4
Since this has become more of a client editing question, I might want to move it somewhere else, but I'll ask here for now:

I've found the same lines you pointed out in the v95 PDB, but it seems the clients are pretty different and I'm having a hard time trying to piece some method together of potentially locating that same or similar segment in the v90 client. If anyone has any suggestions, I'll try whatever. I've been mostly searching strings/text from the IDA view and hex bytes with no luck. Could it be that the two clients are too different for much of any comparison?
 
Upvote 0
Newbie Spellweaver
Joined
Jan 31, 2019
Messages
50
Reaction score
18
The compiled code does look pretty different across versions (I tried this on v83) but functionally it's identical. One thing you could do is look at functions that reference get_gender_from_id and try to find those in your version. Looking at get_body_part_from_item might be helpful since it's kinda small and has specific int values which you could run a search on. Look at the specific instructions that access those ints ;)
 
Upvote 0
Custom Title Activated
Loyal Member
Joined
Jan 18, 2010
Messages
3,109
Reaction score
1,139
Since this has become more of a client editing question, I might want to move it somewhere else, but I'll ask here for now:

I've found the same lines you pointed out in the v95 PDB, but it seems the clients are pretty different and I'm having a hard time trying to piece some method together of potentially locating that same or similar segment in the v90 client. If anyone has any suggestions, I'll try whatever. I've been mostly searching strings/text from the IDA view and hex bytes with no luck. Could it be that the two clients are too different for much of any comparison?

Code:
signed int __cdecl get_gender_from_id(signed int nItemID)
{
  signed int result; // eax@2
  int nItemGender; // edx@3

  if ( nItemID / 1000000 != 1 )
    return 2;
  nItemGender = nItemID / 1000 % 10;
  if ( nItemGender )
  {
    if ( nItemGender != 1 )
      return 2;
    result = 1;
  }
  else
  {
    result = 0;
  }
  return result;
}

Code:
004700D0     mov eax, 2
004700D4     ret
 
Upvote 0
Custom Title Activated
Loyal Member
Joined
Jan 18, 2010
Messages
3,109
Reaction score
1,139
Beat me to it, thank you! I need to get better at cross referencing.

Yeah, I don't blame you here. Very rarely at times (but it can happen), the compiled code will differ. Usually I would just suggest you to use an AoB because the division done and integers moved into the registers typically remain static. However, in this case, the entire function's assembly had changed, so the only way to find it is through xrefs.

The easiest way to find things is by knowing which methods are called from packets, and then tracing them back. For this function, one of the easier xrefs was CShopDlg::SetShopDlg, and finding it on v90 is rather simple: CField::OnPacket => CShopDlg::OnPacket => CShopDlg::SetShopDlg => get_gender_from_id.

You should also note that while sometimes v95 will have get_xxx and is_xxx functions, that these functions usually don't exist in older clients (often pre-89). Instead, the code itself is contained within the function and would have to be changed in various locations.
 
Upvote 0
Back
Top