Jump to content
  • 0
Sign in to follow this  
evilpuncker

Class check trouble

Question

Okay, I'm with a kind of a newbie issue, wanted to edit the pc_has_second_costume to include soul linker and star gladiator too, but its not working, seems my logic is failed :(

 

static bool pc_has_second_costume(struct map_session_data *sd)
{
	nullpo_retr(false, sd);

//	FIXME: JOB_SUPER_NOVICE_E(4190) is not supposed to be 3rd Job. (Issue#2383)
	if ((sd->job & JOBL_THIRD) != 0 && (sd->job & MAPID_BASEMASK) != MAPID_NOVICE || (sd->job & MAPID_UPPERMASK) != MAPID_SOUL_LINKER || (sd->job & MAPID_UPPERMASK) != MAPID_STAR_GLADIATOR)
		return true;
	return false;
}

same with my script:

.@choose = select( "Hair Style", "Hair Color", "Cloth Color", (!(eaclass() & EAJL_THIRD) || BaseJob == Job_SuperNovice || Class != Job_Star_Gladiator || Class != Job_Soul_Linker )? "": _("Body Style") ) -1;

 

btw why don't we have an official has_second_costume script command though, so we don't need to repeat code :P 

Share this post


Link to post
Share on other sites

1 answer to this question

Recommended Posts

  • 1

yes this is indeed confusing

 

the one in the source code

source <----> script

(sd->job & JOBL_THIRD) != 0 <----> (eaclass() & EAJ_THIRD) != 0

(sd->job & MAPID_BASEMASK) != MAPID_NOVICE <----> (eaclass() & EAJ_BASEMASK) != EAJ_NOVICE

 

now assuming that your script has correct logic

script <----> source

!(eaclass() & EAJL_THIRD)  <----> !(sd->job & JOBL_THIRD)

BaseJob == Job_SuperNovice <----> (sd->job & MAPID_UPPERMASK) == MAPID_NOVICE (note there are no basejob in source code) (do not confuse EAJL_UPPER - EAJ_UPPERMASK)

Class != Job_Star_Gladiator <----> sd->status.class != Job_Star_Gladiator

Class != Job_Soul_Linker <----> sd->status.class != Job_Soul_Linker

 

 

I think what you want is

1. all 3rd jobs can access this npc

2. super novice entended (4190 - Job_Super_Novice_E) cannot use this npc

3. also allow Job_Star_Gladiator and Job_Soul_Linker to access the npc

 

prontera,155,185,5	script	debug_test_job	1_F_MARIA,{
	mes "select a few job to test the condition";
	next;
	switch(select(
		"Job_Novice - NO",
		"Job_SuperNovice - NO",
		"Job_Novice_High - NO",
		"Job_Super_Novice_E - NO",
		"Job_Super_Baby - NO",
		"Job_Super_Baby_E - NO",
		"Job_Acolyte - NO",
		"Job_Priest - NO",
		"Job_High_Priest - NO",
		"Job_Baby_Priest - NO",
		"Job_Arch_Bishop - YES",
		"Job_Arch_Bishop_T - YES",
		"Job_Baby_Bishop - YES",
		"Job_Soul_Linker - YES",
		"Job_Star_Gladiator - YES")) {
	case 1: jobchange Job_Novice; break;
	case 2: jobchange Job_SuperNovice; break;
	case 3: jobchange Job_Novice_High; break;
	case 4: jobchange Job_Super_Novice_E; break;
	case 5: jobchange Job_Super_Baby; break;
	case 6: jobchange Job_Super_Baby_E; break;
	case 7: jobchange Job_Acolyte; break;
	case 8: jobchange Job_Priest; break;
	case 9: jobchange Job_High_Priest; break;
	case 10: jobchange Job_Baby_Priest; break;
	case 11: jobchange Job_Arch_Bishop; break;
	case 12: jobchange Job_Arch_Bishop_T; break;
	case 13: jobchange Job_Baby_Bishop; break;
	case 14: jobchange Job_Soul_Linker; break;
	case 15: jobchange Job_Star_Gladiator; break;
	default: mes "go die"; close;
	}
	message getcharid(CHAR_ID_ACCOUNT), jobname(Class);
	close;
OnInit:
	bindatcmd "@test2", strnpcinfo(NPC_NAME_UNIQUE)+"::Onaaa";
	end;
Onaaa:
	.@eaclass = eaclass();
	if (((.@eaclass & EAJL_THIRD) != 0 && (.@eaclass & EAJ_BASEMASK) != EAJ_NOVICE) || Class == Job_Soul_Linker || Class == Job_Star_Gladiator) // this line you want
		dispbottom "Yes";
	else
		dispbottom "No";
	end;
}

 

#include "common/hercules.h"
#include "map/pc.h"
#include "map/clif.h"
#include "plugins/HPMHooking.h"
#include "common/HPMDataCheck.h"

HPExport struct hplugin_info pinfo = {
	"test",
	SERVER_TYPE_MAP,
	"",
	HPM_VERSION,
};

ACMD(test) {
	if (((sd->job & JOBL_THIRD) != 0 && (sd->job & MAPID_BASEMASK) != MAPID_NOVICE) || sd->status.class == JOB_SOUL_LINKER || sd->status.class == JOB_STAR_GLADIATOR)
		clif->message(sd->fd, "Correct");
	else
		clif->message(sd->fd, "Wrong");
	return true;
}

HPExport void plugin_init (void) {
	addAtcommand("test", test);
}

 

 

8 hours ago, evilpuncker said:

btw why don't we have an official has_second_costume script command though, so we don't need to repeat code :P 

not a popular script command ?

I even feel lazy to make a plugin for this script command, just return true/false

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.