Jump to content
  • 0

Checking a player's job?


michaelsoftman

Question


  • Group:  Members
  • Topic Count:  48
  • Topics Per Day:  0.01
  • Content Count:  410
  • Reputation:   29
  • Joined:  04/04/12
  • Last Seen:  

I was just wondering if there's an easier way to check a player's job in the source than what I've been using, which is this, for example, to determine if they're 3rd classes:

if( bl->type == BL_PC && pc_mapid2jobid(((TBL_PC*)bl)->class_, ((TBL_PC*)bl)->status.sex) >= JOB_RUNE_KNIGHT )

But I would like to know if there's an easier way to just determine a single class, or will I have to write this statement out for every class I plan to check for?

Edited by michaelsoftman
Link to comment
Share on other sites

4 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  46
  • Topics Per Day:  0.01
  • Content Count:  228
  • Reputation:   33
  • Joined:  11/15/12
  • Last Seen:  

check jobs for what? if its an npc theres an easy way.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  48
  • Topics Per Day:  0.01
  • Content Count:  410
  • Reputation:   29
  • Joined:  04/04/12
  • Last Seen:  

It's not an NPC, it's a source edit.

I'm messing around with the Dark Collector class (turning it into a usable class out of boredom) and so I configuring class specific drops for them. I could do

if( bl->type == BL_PC && pc_mapid2jobid(((TBL_PC*)bl)->class_, ((TBL_PC*)bl)->status.sex) == JOB_DARK_COLLECTOR )

I just want to know if this is the most efficient way or not. I'm not too familiar with some of the source code commands.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  36
  • Reputation:   5
  • Joined:  02/01/12
  • Last Seen:  

I was just wondering if there's an easier way to check a player's job in the source than what I've been using, which is this, for example, to determine if they're 3rd classes:

if( bl->type == BL_PC && pc_mapid2jobid(((TBL_PC*)bl)->class_, ((TBL_PC*)bl)->status.sex) >= JOB_RUNE_KNIGHT )

But I would like to know if there's an easier way to just determine a single class, or will I have to write this statement out for every class I plan to check for?

Try this?

if((sd->class_&MAPID_BASEMASK) == MAPID_DARK_COLLECTOR)

or this

if(sd->class_ == MAPID_DARK_COLLECTOR)

Saw lot's of those in skill.c checks.

Edited by CandyCandy
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  48
  • Topics Per Day:  0.01
  • Content Count:  410
  • Reputation:   29
  • Joined:  04/04/12
  • Last Seen:  

if(sd->class_ == MAPID_DARK_COLLECTOR)

Seems to be working perfectly for me, thanks a lot!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...