Jump to content
  • 0

How to remove class/lvl limitation from costume


Rain408

Question


  • Group:  Members
  • Topic Count:  30
  • Topics Per Day:  0.01
  • Content Count:  77
  • Reputation:   0
  • Joined:  05/23/15
  • Last Seen:  

-	script	Costume Clown	-1,{
	mes "[Clown]";
	mes "^FF0000Costumes give no Stats.^000000";
	mes "Here you can convert your headgears into a Costume Headgear for 5 donation ticket or restore to its Original form.";
	switch(select("I want to convert.:I want to restore.:No thanks.")) {
	case 1:
			next;
			if(countitem(7146)<5)	goto L_NoMake;
			mes "Please, select what to convert.";
			mes "Remember, cards and refine will be removed.";
			next;
				setarray .@Position$[1],"Top","Mid","Low";
				setarray .@Position[1],     1,    9,   10;
				set .@Menu$,"";
			for( set .@i, 1; .@i < 5; set .@i, .@i + 1 )
			{
				if( getequipisequiped(.@Position[.@i]) )
				set .@Menu$, .@Menu$ + .@Position$[.@i] + "-" + "[" + getequipname(.@Position[.@i]) + "]";
				set .@Menu$, .@Menu$ + ":";
			}
			set .@Part, .@Position[ select(.@Menu$) ];
			if( !getequipisequiped(.@Part) )
			{
				mes "[Clown]";
				mes "Your not wearing anything there...";
				close;
			}
			mes "[Clown]";
			mes "You want to Costume your " + getitemname(getequipid(.@Part)) + "?";
			next;
			if( select("Yes, proceed:No, I am sorry.") == 2 )
			{
				mes "[Clown]";
				mes "Need some time to think about it, huh?";
				mes "Alright, I can understand.";
				close;
			}
	
			costume .@Part; // Convert the Headgear

			mes "[Costume-IT]";
			mes "Done, enjoy your costume headgear.";
			delitem 7146,5;
			end;
	case 2:
			next;
			mes "Please, select what to restore.";
			mes "Remember, I will only restore it back without refine and cards.";
			next;
				setarray .@Position$[1],"Top","Mid","Low";
				setarray .@Position[1],     13,    12,   11;
				set .@Menu$,"";
			for( set .@i, 1; .@i < 5; set .@i, .@i + 1 )
			{
				if( getequipisequiped(.@Position[.@i]) )
				set .@Menu$, .@Menu$ + .@Position$[.@i] + "-" + "[" + getequipname(.@Position[.@i]) + "]";
				set .@Menu$, .@Menu$ + ":";
			}
			set .@Part, .@Position[ select(.@Menu$) ];
			if( !getequipisequiped(.@Part) )
			{
				mes "[Clown]";
				mes "Your not wearing anything there...";
				close;
			}
			mes "[Clown]";
			mes "You want to restore your " + getitemname(getequipid(.@Part)) + "?";
			next;
			if( select("Yes, proceed:No, I am sorry.") == 2 )
			{
				mes "[Clown]";
				mes "Need some time to think about it, huh?";
				mes "Alright, I can understand.";
				close;
			}
			a = getequipid(.@Part);			
			delitem a,1;
			getitem a,1;
			
			mes "[Clown]";
			mes "Done, enjoy your restored headgear.";
			end;
	case 3:
		mes "[Clown]";
		mes "Very well. Return at once if you seek my services.";
		end;
	}
L_NoMake:
	mes " You don't have tickets, sorry.";
	close;
}
// --------------------------------------------------------------------------
// Use duplicates to put your npc on different cities
//

So that's the script, Provide by sehrentos

His script pretty much converts headgear items to headgear costumes, but i found a flaw in game.

 

The costume retains the level & class restriction. Is there a way to remove it?

 

 

Link to comment
Share on other sites

11 answers to this question

Recommended Posts

  • 0

  • Group:  Content Moderator
  • Topic Count:  22
  • Topics Per Day:  0.00
  • Content Count:  639
  • Reputation:   596
  • Joined:  11/25/11
  • Last Seen:  

Ok, forget all I did before, please revert the diffs.

The problem is, after reading part of the source, I was led to believe that that 'signature' with the name of the char was read by the checks as an EQP_COSTUME_HEAD_TOP, EQP_COSTUME_HEAD_MID, EQP_COSTUME_HEAD_LOW or EQP_COSTUME_GARMENT. That's not true.

So, let's do it pretty easily.
First of all, there's the case of WHICH diff are you using. I'm currently using rAmod, but I'll assume you're using this diff.

If so, yet on src/map/pc.c, find the function pc_isequip, I'll guide myself by the one Fantastik posted.

/*=================================================
 * Checks if the player can equip the item at index n in inventory.
 * @param sd
 * @param n Item index in inventory
 * @return ITEM_EQUIP_ACK_OK(0) if can be equipped, or ITEM_EQUIP_ACK_FAIL(1)/ITEM_EQUIP_ACK_FAILLEVEL(2) if can't
 *------------------------------------------------*/
uint8 pc_isequip(struct map_session_data *sd,int n)
{
	struct item_data *item;

	nullpo_retr(ITEM_EQUIP_ACK_FAIL, sd);

	item = sd->inventory_data[n];

	if(pc_has_permission(sd, PC_PERM_USE_ALL_EQUIPMENT))
		return ITEM_EQUIP_ACK_OK;

	if(item == NULL)
		return ITEM_EQUIP_ACK_FAIL;
	if(item->elv && sd->status.base_level < (unsigned int)item->elv)
		return ITEM_EQUIP_ACK_FAILLEVEL;
	if(item->elvmax && sd->status.base_level > (unsigned int)item->elvmax)
		return ITEM_EQUIP_ACK_FAILLEVEL;
	if(item->sex != 2 && sd->status.sex != item->sex)
		return ITEM_EQUIP_ACK_FAIL;

	if (sd->sc.count) {
		if(item->equip & EQP_ARMS && item->type == IT_WEAPON && sd->sc.data[SC_STRIPWEAPON]) // Also works with left-hand weapons [DracoRPG]
			return ITEM_EQUIP_ACK_FAIL;
		if(item->equip & EQP_SHIELD && item->type == IT_ARMOR && sd->sc.data[SC_STRIPSHIELD])
			return ITEM_EQUIP_ACK_FAIL;
		if(item->equip & EQP_ARMOR && sd->sc.data[SC_STRIPARMOR])
			return ITEM_EQUIP_ACK_FAIL;
		if(item->equip & EQP_HEAD_TOP && sd->sc.data[SC_STRIPHELM])
			return ITEM_EQUIP_ACK_FAIL;
		if(item->equip & EQP_ACC && sd->sc.data[SC__STRIPACCESSORY])
			return ITEM_EQUIP_ACK_FAIL;
		if(item->equip && sd->sc.data[SC_KYOUGAKU])
			return ITEM_EQUIP_ACK_FAIL;

		if (sd->sc.data[SC_SPIRIT] && sd->sc.data[SC_SPIRIT]->val2 == SL_SUPERNOVICE) {
			//Spirit of Super Novice equip bonuses. [Skotlex]
			if (sd->status.base_level > 90 && item->equip & EQP_HELM)
				return ITEM_EQUIP_ACK_OK; //Can equip all helms
			
			//if (sd->status.base_level > 96 && item->equip & EQP_ARMS && item->type == IT_WEAPON && item->wlv == 4)
			if (sd->status.base_level > 96 && item->equip & EQP_ARMS && item->type == IT_WEAPON) // Modificado 17/09/2015
				switch(item->look) { //In weapons, the look determines type of weapon.
					case W_DAGGER: //All level 4 - Daggers
					case W_1HSWORD: //All level 4 - 1H Swords
					case W_1HAXE: //All level 4 - 1H Axes
					case W_MACE: //All level 4 - 1H Maces
					case W_STAFF: //All level 4 - 1H Staves
					case W_2HSTAFF: //All level 4 - 2H Staves
						return ITEM_EQUIP_ACK_OK;
				}
		}
	}

	//fail to equip if item is restricted
	if (!battle_config.allow_equip_restricted_item && itemdb_isNoEquip(item, sd->bl.m))
		return ITEM_EQUIP_ACK_FAIL;

	//Not equipable by class. [Skotlex]
	if (!(1<<(sd->class_&MAPID_BASEMASK)&item->class_base[(sd->class_&JOBL_2_1)?1:((sd->class_&JOBL_2_2)?2:0)]))
		return ITEM_EQUIP_ACK_FAIL;
	
	if (!pc_isItemClass(sd,item))
		return ITEM_EQUIP_ACK_FAIL;

	return ITEM_EQUIP_ACK_OK;
}

So, find this fragment:

	struct item_data *item;

	nullpo_ret(sd);

	item = sd->inventory_data[n];

And turn into this:

	struct item equip;	
	struct item_data *item;
	int char_id = 0;
	
	nullpo_ret(sd);

	equip = sd->status.inventory[n];
	item = sd->inventory_data[n];

So we can get the important info, which is, if the item has a signature (I don't know how you name it, I'm talking about the name that appears when someone produce an Item, in costume itens it appears Costume in blue), and, if so, if it's the name of the Reserved Char ID for it.

So, now the function.
Now, find this fragment:

    if(item == NULL)
        return false;

And, just below it, paste this check:

	if( equip.card[0] == CARD0_CREATE ){
		char_id = MakeDWord(equip.card[2],equip.card[3]);
		if( battle_config.reserved_costume_id && char_id == battle_config.reserved_costume_id)
			return true;
	}	

I hope all the functions needed exists on your Costume Snippet.
This one was tested, but I did it on rAmod, so don't know exactly the differences.

Edited by Haziel
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  25
  • Topics Per Day:  0.01
  • Content Count:  283
  • Reputation:   76
  • Joined:  06/13/13
  • Last Seen:  

check the costume patch, i think you can get your answer there

Link to comment
Share on other sites

  • 0

  • Group:  Content Moderator
  • Topic Count:  22
  • Topics Per Day:  0.00
  • Content Count:  639
  • Reputation:   596
  • Joined:  11/25/11
  • Last Seen:  

Dunno, the patch you're using, so, I'll assume it's similar to eAmod one, which converts the signed items to real Costume Itens for the Source eyes.

 

So, the fuction you're looking for is on src/map/pc.c.

/*=================================================
 * Checks if the player can equip the item at index n in inventory.
 * @param sd
 * @param n Item index in inventory
 * @return ITEM_EQUIP_ACK_OK(0) if can be equipped, or ITEM_EQUIP_ACK_FAIL(1)/ITEM_EQUIP_ACK_FAILLEVEL(2) if can't
 *------------------------------------------------*/
uint8 pc_isequip(struct map_session_data *sd,int n)
{
	struct item_data *item;

	nullpo_retr(ITEM_EQUIP_ACK_FAIL, sd);

	item = sd->inventory_data[n];

	if(pc_has_permission(sd, PC_PERM_USE_ALL_EQUIPMENT))
		return ITEM_EQUIP_ACK_OK;

	if(item == NULL)
		return ITEM_EQUIP_ACK_FAIL;
	if(item->elv && sd->status.base_level < (unsigned int)item->elv)
		return ITEM_EQUIP_ACK_FAILLEVEL;
	if(item->elvmax && sd->status.base_level > (unsigned int)item->elvmax)
		return ITEM_EQUIP_ACK_FAILLEVEL;
	if(item->sex != 2 && sd->status.sex != item->sex)
		return ITEM_EQUIP_ACK_FAIL;

	if (sd->sc.count) {
		if(item->equip & EQP_ARMS && item->type == IT_WEAPON && sd->sc.data[SC_STRIPWEAPON]) // Also works with left-hand weapons [DracoRPG]
			return ITEM_EQUIP_ACK_FAIL;
		if(item->equip & EQP_SHIELD && item->type == IT_ARMOR && sd->sc.data[SC_STRIPSHIELD])
			return ITEM_EQUIP_ACK_FAIL;
		if(item->equip & EQP_ARMOR && sd->sc.data[SC_STRIPARMOR])
			return ITEM_EQUIP_ACK_FAIL;
		if(item->equip & EQP_HEAD_TOP && sd->sc.data[SC_STRIPHELM])
			return ITEM_EQUIP_ACK_FAIL;
		if(item->equip & EQP_ACC && sd->sc.data[SC__STRIPACCESSORY])
			return ITEM_EQUIP_ACK_FAIL;
		if(item->equip && sd->sc.data[SC_KYOUGAKU])
			return ITEM_EQUIP_ACK_FAIL;

		if (sd->sc.data[SC_SPIRIT] && sd->sc.data[SC_SPIRIT]->val2 == SL_SUPERNOVICE) {
			//Spirit of Super Novice equip bonuses. [Skotlex]
			if (sd->status.base_level > 90 && item->equip & EQP_HELM)
				return ITEM_EQUIP_ACK_OK; //Can equip all helms
			
			//if (sd->status.base_level > 96 && item->equip & EQP_ARMS && item->type == IT_WEAPON && item->wlv == 4)
			if (sd->status.base_level > 96 && item->equip & EQP_ARMS && item->type == IT_WEAPON) // Modificado 17/09/2015
				switch(item->look) { //In weapons, the look determines type of weapon.
					case W_DAGGER: //All level 4 - Daggers
					case W_1HSWORD: //All level 4 - 1H Swords
					case W_1HAXE: //All level 4 - 1H Axes
					case W_MACE: //All level 4 - 1H Maces
					case W_STAFF: //All level 4 - 1H Staves
					case W_2HSTAFF: //All level 4 - 2H Staves
						return ITEM_EQUIP_ACK_OK;
				}
		}
	}

	//fail to equip if item is restricted
	if (!battle_config.allow_equip_restricted_item && itemdb_isNoEquip(item, sd->bl.m))
		return ITEM_EQUIP_ACK_FAIL;

	//Not equipable by class. [Skotlex]
	if (!(1<<(sd->class_&MAPID_BASEMASK)&item->class_base[(sd->class_&JOBL_2_1)?1:((sd->class_&JOBL_2_2)?2:0)]))
		return ITEM_EQUIP_ACK_FAIL;
	
	if (!pc_isItemClass(sd,item))
		return ITEM_EQUIP_ACK_FAIL;

	return ITEM_EQUIP_ACK_OK;
}

There is a check for every limitation on equip a player may have.

So, what you need to do is edit:

if(item->elv && sd->status.base_level < (unsigned int)item->elv)
		return ITEM_EQUIP_ACK_FAILLEVEL;

And

//Not equipable by class. [Skotlex]
if (!(1<<(sd->class_&MAPID_BASEMASK)&item->class_base[(sd->class_&JOBL_2_1)?1:((sd->class_&JOBL_2_2)?2:0)]))
	return ITEM_EQUIP_ACK_FAIL;

So they ignore this restriction if the item is a costume.

I GUESS adding this check to each If you want to ignore, may do the trick:

&& (!item->equip & EQP_COSTUME_HEAD_TOP && !item->equip & EQP_COSTUME_HEAD_MID && !item->equip & EQP_COSTUME_HEAD_LOW && !item->equip & EQP_COSTUME_GARMENT)

Like:

if(item->elv && sd->status.base_level < (unsigned int)item->elv && (!item->equip & EQP_COSTUME_HEAD_TOP && !item->equip & EQP_COSTUME_HEAD_MID && !item->equip & EQP_COSTUME_HEAD_LOW && !item->equip & EQP_COSTUME_GARMENT))
	return ITEM_EQUIP_ACK_FAILLEVEL;

And:

if (!(1<<(sd->class_&MAPID_BASEMASK)&item->class_base[(sd->class_&JOBL_2_1)?1:((sd->class_&JOBL_2_2)?2:0)]) 	&& (!item->equip & EQP_COSTUME_HEAD_TOP && !item->equip & EQP_COSTUME_HEAD_MID && !item->equip & EQP_COSTUME_HEAD_LOW && !item->equip & EQP_COSTUME_GARMENT))
	return ITEM_EQUIP_ACK_FAIL;

I only figured a way to do it it's UNTESTED, try it at YOUR OWN RISK.

Edited by Haziel
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  26
  • Reputation:   1
  • Joined:  12/03/11
  • Last Seen:  

Hello, How about the weight of the converted item?


Also tested it not working properly. I tried the patch I can equip all kinds of headgears.

Edited by Fantastik
Link to comment
Share on other sites

  • 0

  • Group:  Content Moderator
  • Topic Count:  22
  • Topics Per Day:  0.00
  • Content Count:  639
  • Reputation:   596
  • Joined:  11/25/11
  • Last Seen:  

Also, found an error on my suggestion, tho, the Garment Item as with a typo, edited my previous answer.
Just change all EQP_COSTUME_HEAD_GARMENT to EQP_COSTUME_GARMENT, look if the problem persists.

About the weight, maybe, on src/map/pc.c find:

	sd->weight += w;
	clif_updatestatus(sd,SP_WEIGHT);

And try:

if (!item->equip & EQP_COSTUME_HEAD_TOP && !item->equip & EQP_COSTUME_HEAD_MID && !item->equip & EQP_COSTUME_HEAD_LOW && !item->equip & EQP_COSTUME_GARMENT){
	sd->weight += w;
	clif_updatestatus(sd,SP_WEIGHT);
}
Edited by Haziel
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  30
  • Topics Per Day:  0.01
  • Content Count:  77
  • Reputation:   0
  • Joined:  05/23/15
  • Last Seen:  

Dunno, the patch you're using, so, I'll assume it's similar to eAmod one, which converts the signed items to real Costume Itens for the Source eyes.

 

So, the fuction you're looking for is on src/map/pc.c.

/*=================================================
 * Checks if the player can equip the item at index n in inventory.
 * @param sd
 * @param n Item index in inventory
 * @return ITEM_EQUIP_ACK_OK(0) if can be equipped, or ITEM_EQUIP_ACK_FAIL(1)/ITEM_EQUIP_ACK_FAILLEVEL(2) if can't
 *------------------------------------------------*/
uint8 pc_isequip(struct map_session_data *sd,int n)
{
	struct item_data *item;

	nullpo_retr(ITEM_EQUIP_ACK_FAIL, sd);

	item = sd->inventory_data[n];

	if(pc_has_permission(sd, PC_PERM_USE_ALL_EQUIPMENT))
		return ITEM_EQUIP_ACK_OK;

	if(item == NULL)
		return ITEM_EQUIP_ACK_FAIL;
	if(item->elv && sd->status.base_level < (unsigned int)item->elv)
		return ITEM_EQUIP_ACK_FAILLEVEL;
	if(item->elvmax && sd->status.base_level > (unsigned int)item->elvmax)
		return ITEM_EQUIP_ACK_FAILLEVEL;
	if(item->sex != 2 && sd->status.sex != item->sex)
		return ITEM_EQUIP_ACK_FAIL;

	if (sd->sc.count) {
		if(item->equip & EQP_ARMS && item->type == IT_WEAPON && sd->sc.data[SC_STRIPWEAPON]) // Also works with left-hand weapons [DracoRPG]
			return ITEM_EQUIP_ACK_FAIL;
		if(item->equip & EQP_SHIELD && item->type == IT_ARMOR && sd->sc.data[SC_STRIPSHIELD])
			return ITEM_EQUIP_ACK_FAIL;
		if(item->equip & EQP_ARMOR && sd->sc.data[SC_STRIPARMOR])
			return ITEM_EQUIP_ACK_FAIL;
		if(item->equip & EQP_HEAD_TOP && sd->sc.data[SC_STRIPHELM])
			return ITEM_EQUIP_ACK_FAIL;
		if(item->equip & EQP_ACC && sd->sc.data[SC__STRIPACCESSORY])
			return ITEM_EQUIP_ACK_FAIL;
		if(item->equip && sd->sc.data[SC_KYOUGAKU])
			return ITEM_EQUIP_ACK_FAIL;

		if (sd->sc.data[SC_SPIRIT] && sd->sc.data[SC_SPIRIT]->val2 == SL_SUPERNOVICE) {
			//Spirit of Super Novice equip bonuses. [Skotlex]
			if (sd->status.base_level > 90 && item->equip & EQP_HELM)
				return ITEM_EQUIP_ACK_OK; //Can equip all helms
			
			//if (sd->status.base_level > 96 && item->equip & EQP_ARMS && item->type == IT_WEAPON && item->wlv == 4)
			if (sd->status.base_level > 96 && item->equip & EQP_ARMS && item->type == IT_WEAPON) // Modificado 17/09/2015
				switch(item->look) { //In weapons, the look determines type of weapon.
					case W_DAGGER: //All level 4 - Daggers
					case W_1HSWORD: //All level 4 - 1H Swords
					case W_1HAXE: //All level 4 - 1H Axes
					case W_MACE: //All level 4 - 1H Maces
					case W_STAFF: //All level 4 - 1H Staves
					case W_2HSTAFF: //All level 4 - 2H Staves
						return ITEM_EQUIP_ACK_OK;
				}
		}
	}

	//fail to equip if item is restricted
	if (!battle_config.allow_equip_restricted_item && itemdb_isNoEquip(item, sd->bl.m))
		return ITEM_EQUIP_ACK_FAIL;

	//Not equipable by class. [Skotlex]
	if (!(1<<(sd->class_&MAPID_BASEMASK)&item->class_base[(sd->class_&JOBL_2_1)?1:((sd->class_&JOBL_2_2)?2:0)]))
		return ITEM_EQUIP_ACK_FAIL;
	
	if (!pc_isItemClass(sd,item))
		return ITEM_EQUIP_ACK_FAIL;

	return ITEM_EQUIP_ACK_OK;
}

There is a check for every limitation on equip a player may have.

So, what you need to do is edit:

if(item->elv && sd->status.base_level < (unsigned int)item->elv)
		return ITEM_EQUIP_ACK_FAILLEVEL;

And

//Not equipable by class. [Skotlex]
if (!(1<<(sd->class_&MAPID_BASEMASK)&item->class_base[(sd->class_&JOBL_2_1)?1:((sd->class_&JOBL_2_2)?2:0)]))
	return ITEM_EQUIP_ACK_FAIL;

So they ignore this restriction if the item is a costume.

I GUESS adding this check to each If you want to ignore, may do the trick:

&& (!item->equip & EQP_COSTUME_HEAD_TOP && !item->equip & EQP_COSTUME_HEAD_MID && !item->equip & EQP_COSTUME_HEAD_LOW && !item->equip & EQP_COSTUME_GARMENT)

Like:

if(item->elv && sd->status.base_level < (unsigned int)item->elv && (!item->equip & EQP_COSTUME_HEAD_TOP && !item->equip & EQP_COSTUME_HEAD_MID && !item->equip & EQP_COSTUME_HEAD_LOW && !item->equip & EQP_COSTUME_GARMENT))
	return ITEM_EQUIP_ACK_FAILLEVEL;

And:

if (!(1<<(sd->class_&MAPID_BASEMASK)&item->class_base[(sd->class_&JOBL_2_1)?1:((sd->class_&JOBL_2_2)?2:0)]) 	&& (!item->equip & EQP_COSTUME_HEAD_TOP && !item->equip & EQP_COSTUME_HEAD_MID && !item->equip & EQP_COSTUME_HEAD_LOW && !item->equip & EQP_COSTUME_GARMENT))
	return ITEM_EQUIP_ACK_FAIL;

I only figured a way to do it it's UNTESTED, try it at YOUR OWN RISK.

 

 

My code on this sections looks a bit different, More like this

/*=================================================
 * Checks if the player can equip the item at index n in inventory.
 * @param sd
 * @param n Item index in inventory
 * @return True - Can be equipped, False - failed
 *------------------------------------------------*/
bool pc_isequip(struct map_session_data *sd,int n)
{
	struct item_data *item;

	nullpo_ret(sd);

	item = sd->inventory_data[n];

	if(pc_has_permission(sd, PC_PERM_USE_ALL_EQUIPMENT))
		return true;

	if(item == NULL)
		return false;
	if(item->elv && sd->status.base_level < (unsigned int)item->elv)
		return false;
#ifdef RENEWAL
	if(item->elvmax && sd->status.base_level > (unsigned int)item->elvmax)
		return false;
#endif
	if(item->sex != 2 && sd->status.sex != item->sex)
		return false;

	if (sd->sc.count) {

		if(item->equip & EQP_ARMS && item->type == IT_WEAPON && sd->sc.data[SC_STRIPWEAPON]) // Also works with left-hand weapons [DracoRPG]
			return false;
		if(item->equip & EQP_SHIELD && item->type == IT_ARMOR && sd->sc.data[SC_STRIPSHIELD])
			return false;
		if(item->equip & EQP_ARMOR && sd->sc.data[SC_STRIPARMOR])
			return false;
		if(item->equip & EQP_HEAD_TOP && sd->sc.data[SC_STRIPHELM])
			return false;
		if(item->equip & EQP_ACC && sd->sc.data[SC__STRIPACCESSORY])
			return false;
		if(item->equip && sd->sc.data[SC_KYOUGAKU])
			return false;

		if (sd->sc.data[SC_SPIRIT] && sd->sc.data[SC_SPIRIT]->val2 == SL_SUPERNOVICE) {
			//Spirit of Super Novice equip bonuses. [Skotlex]
			if (sd->status.base_level > 90 && item->equip & EQP_HELM)
				return true; //Can equip all helms

			if (sd->status.base_level > 96 && item->equip & EQP_ARMS && item->type == IT_WEAPON && item->wlv == 4)
				switch(item->look) { //In weapons, the look determines type of weapon.
					case W_DAGGER: //All level 4 - Daggers
					case W_1HSWORD: //All level 4 - 1H Swords
					case W_1HAXE: //All level 4 - 1H Axes
					case W_MACE: //All level 4 - 1H Maces
					case W_STAFF: //All level 4 - 1H Staves
					case W_2HSTAFF: //All level 4 - 2H Staves
						return true;
				}
		}
	}

	//fail to equip if item is restricted
	if (!battle_config.allow_equip_restricted_item && itemdb_isNoEquip(item, sd->bl.m))
		return false;

	//Not equipable by class. [Skotlex]
	if (!(1<<(sd->class_&MAPID_BASEMASK)&item->class_base[(sd->class_&JOBL_2_1)?1:((sd->class_&JOBL_2_2)?2:0)]))
		return false;
	
	if (!pc_isItemClass(sd,item))
		return false;

	return true;
}

You think if i got through w/ it, it be ok? I figure if i made changes on src, I have to recompile. & I already had a hard time recompiling my files before

 

So i went ahead and did it, & it worked.

 

Only problem is now all headgear have no class/lvl limitation. You were pretty close to solving the problem

Edited by Rain408
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  26
  • Reputation:   1
  • Joined:  12/03/11
  • Last Seen:  

Thanks Haziel. But the problem is that if you put the code you did. All headgears can be equip even if not costume item. 

 

Im trying to figure it out. hehehe.

 

 

Also, found an error on my suggestion, tho, the Garment Item as with a typo, edited my previous answer.
Just change all EQP_COSTUME_HEAD_GARMENT to EQP_COSTUME_GARMENT, look if the problem persists.

About the weight, maybe, on src/map/pc.c find:

	sd->weight += w;
	clif_updatestatus(sd,SP_WEIGHT);

And try:

if (!item->equip & EQP_COSTUME_HEAD_TOP && !item->equip & EQP_COSTUME_HEAD_MID && !item->equip & EQP_COSTUME_HEAD_LOW && !item->equip & EQP_COSTUME_GARMENT){
	sd->weight += w;
	clif_updatestatus(sd,SP_WEIGHT);
}
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  30
  • Topics Per Day:  0.01
  • Content Count:  77
  • Reputation:   0
  • Joined:  05/23/15
  • Last Seen:  

Ok, forget all I did before, please revert the diffs.

The problem is, after reading part of the source, I was led to believe that that 'signature' with the name of the char was read by the checks as an EQP_COSTUME_HEAD_TOP, EQP_COSTUME_HEAD_MID, EQP_COSTUME_HEAD_LOW or EQP_COSTUME_GARMENT. That's not true.

So, let's do it pretty easily.

First of all, there's the case of WHICH diff are you using. I'm currently using eAmod, but I'll assume you're using this diff.

If so, yet on src/map/pc.c, find the function pc_isequip, I'll guide myself by the one Fantastik posted.

/*=================================================
 * Checks if the player can equip the item at index n in inventory.
 * @param sd
 * @param n Item index in inventory
 * @return ITEM_EQUIP_ACK_OK(0) if can be equipped, or ITEM_EQUIP_ACK_FAIL(1)/ITEM_EQUIP_ACK_FAILLEVEL(2) if can't
 *------------------------------------------------*/
uint8 pc_isequip(struct map_session_data *sd,int n)
{
	struct item_data *item;

	nullpo_retr(ITEM_EQUIP_ACK_FAIL, sd);

	item = sd->inventory_data[n];

	if(pc_has_permission(sd, PC_PERM_USE_ALL_EQUIPMENT))
		return ITEM_EQUIP_ACK_OK;

	if(item == NULL)
		return ITEM_EQUIP_ACK_FAIL;
	if(item->elv && sd->status.base_level < (unsigned int)item->elv)
		return ITEM_EQUIP_ACK_FAILLEVEL;
	if(item->elvmax && sd->status.base_level > (unsigned int)item->elvmax)
		return ITEM_EQUIP_ACK_FAILLEVEL;
	if(item->sex != 2 && sd->status.sex != item->sex)
		return ITEM_EQUIP_ACK_FAIL;

	if (sd->sc.count) {
		if(item->equip & EQP_ARMS && item->type == IT_WEAPON && sd->sc.data[SC_STRIPWEAPON]) // Also works with left-hand weapons [DracoRPG]
			return ITEM_EQUIP_ACK_FAIL;
		if(item->equip & EQP_SHIELD && item->type == IT_ARMOR && sd->sc.data[SC_STRIPSHIELD])
			return ITEM_EQUIP_ACK_FAIL;
		if(item->equip & EQP_ARMOR && sd->sc.data[SC_STRIPARMOR])
			return ITEM_EQUIP_ACK_FAIL;
		if(item->equip & EQP_HEAD_TOP && sd->sc.data[SC_STRIPHELM])
			return ITEM_EQUIP_ACK_FAIL;
		if(item->equip & EQP_ACC && sd->sc.data[SC__STRIPACCESSORY])
			return ITEM_EQUIP_ACK_FAIL;
		if(item->equip && sd->sc.data[SC_KYOUGAKU])
			return ITEM_EQUIP_ACK_FAIL;

		if (sd->sc.data[SC_SPIRIT] && sd->sc.data[SC_SPIRIT]->val2 == SL_SUPERNOVICE) {
			//Spirit of Super Novice equip bonuses. [Skotlex]
			if (sd->status.base_level > 90 && item->equip & EQP_HELM)
				return ITEM_EQUIP_ACK_OK; //Can equip all helms
			
			//if (sd->status.base_level > 96 && item->equip & EQP_ARMS && item->type == IT_WEAPON && item->wlv == 4)
			if (sd->status.base_level > 96 && item->equip & EQP_ARMS && item->type == IT_WEAPON) // Modificado 17/09/2015
				switch(item->look) { //In weapons, the look determines type of weapon.
					case W_DAGGER: //All level 4 - Daggers
					case W_1HSWORD: //All level 4 - 1H Swords
					case W_1HAXE: //All level 4 - 1H Axes
					case W_MACE: //All level 4 - 1H Maces
					case W_STAFF: //All level 4 - 1H Staves
					case W_2HSTAFF: //All level 4 - 2H Staves
						return ITEM_EQUIP_ACK_OK;
				}
		}
	}

	//fail to equip if item is restricted
	if (!battle_config.allow_equip_restricted_item && itemdb_isNoEquip(item, sd->bl.m))
		return ITEM_EQUIP_ACK_FAIL;

	//Not equipable by class. [Skotlex]
	if (!(1<<(sd->class_&MAPID_BASEMASK)&item->class_base[(sd->class_&JOBL_2_1)?1:((sd->class_&JOBL_2_2)?2:0)]))
		return ITEM_EQUIP_ACK_FAIL;
	
	if (!pc_isItemClass(sd,item))
		return ITEM_EQUIP_ACK_FAIL;

	return ITEM_EQUIP_ACK_OK;
}

So, find this fragment:

	struct item_data *item;

	nullpo_ret(sd);

	item = sd->inventory_data[n];

And turn into this:

	struct item equip;	
	struct item_data *item;
	int char_id = 0;
	
	nullpo_ret(sd);

	equip = sd->status.inventory[n];
	item = sd->inventory_data[n];

So we can get the important info, which is, if the item has a signature (I don't know how you name it, I'm talking about the name that appears when someone produce an Item, in costume itens it appears Costume in blue), and, if so, if it's the name of the Reserved Char ID for it.

So, now the function.

Now, find this fragment:

    if(item == NULL)
        return false;

And, just below it, paste this check:

	if( equip.card[0] == CARD0_CREATE ){
		char_id = MakeDWord(equip.card[2],equip.card[3]);
		if( battle_config.reserved_costume_id && char_id == battle_config.reserved_costume_id)
			return true;
	}	

I hope all the functions needed exists on your Costume Snippet.

This one is tested, but I did it on rAmod, so don't know exactly the differences.

 

Your a genius

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  26
  • Reputation:   1
  • Joined:  12/03/11
  • Last Seen:  

Hazi

 

Ok, forget all I did before, please revert the diffs.

The problem is, after reading part of the source, I was led to believe that that 'signature' with the name of the char was read by the checks as an EQP_COSTUME_HEAD_TOP, EQP_COSTUME_HEAD_MID, EQP_COSTUME_HEAD_LOW or EQP_COSTUME_GARMENT. That's not true.

So, let's do it pretty easily.
First of all, there's the case of WHICH diff are you using. I'm currently using rAmod, but I'll assume you're using this diff.

If so, yet on src/map/pc.c, find the function pc_isequip, I'll guide myself by the one Fantastik posted.

/*=================================================
 * Checks if the player can equip the item at index n in inventory.
 * @param sd
 * @param n Item index in inventory
 * @return ITEM_EQUIP_ACK_OK(0) if can be equipped, or ITEM_EQUIP_ACK_FAIL(1)/ITEM_EQUIP_ACK_FAILLEVEL(2) if can't
 *------------------------------------------------*/
uint8 pc_isequip(struct map_session_data *sd,int n)
{
	struct item_data *item;

	nullpo_retr(ITEM_EQUIP_ACK_FAIL, sd);

	item = sd->inventory_data[n];

	if(pc_has_permission(sd, PC_PERM_USE_ALL_EQUIPMENT))
		return ITEM_EQUIP_ACK_OK;

	if(item == NULL)
		return ITEM_EQUIP_ACK_FAIL;
	if(item->elv && sd->status.base_level < (unsigned int)item->elv)
		return ITEM_EQUIP_ACK_FAILLEVEL;
	if(item->elvmax && sd->status.base_level > (unsigned int)item->elvmax)
		return ITEM_EQUIP_ACK_FAILLEVEL;
	if(item->sex != 2 && sd->status.sex != item->sex)
		return ITEM_EQUIP_ACK_FAIL;

	if (sd->sc.count) {
		if(item->equip & EQP_ARMS && item->type == IT_WEAPON && sd->sc.data[SC_STRIPWEAPON]) // Also works with left-hand weapons [DracoRPG]
			return ITEM_EQUIP_ACK_FAIL;
		if(item->equip & EQP_SHIELD && item->type == IT_ARMOR && sd->sc.data[SC_STRIPSHIELD])
			return ITEM_EQUIP_ACK_FAIL;
		if(item->equip & EQP_ARMOR && sd->sc.data[SC_STRIPARMOR])
			return ITEM_EQUIP_ACK_FAIL;
		if(item->equip & EQP_HEAD_TOP && sd->sc.data[SC_STRIPHELM])
			return ITEM_EQUIP_ACK_FAIL;
		if(item->equip & EQP_ACC && sd->sc.data[SC__STRIPACCESSORY])
			return ITEM_EQUIP_ACK_FAIL;
		if(item->equip && sd->sc.data[SC_KYOUGAKU])
			return ITEM_EQUIP_ACK_FAIL;

		if (sd->sc.data[SC_SPIRIT] && sd->sc.data[SC_SPIRIT]->val2 == SL_SUPERNOVICE) {
			//Spirit of Super Novice equip bonuses. [Skotlex]
			if (sd->status.base_level > 90 && item->equip & EQP_HELM)
				return ITEM_EQUIP_ACK_OK; //Can equip all helms
			
			//if (sd->status.base_level > 96 && item->equip & EQP_ARMS && item->type == IT_WEAPON && item->wlv == 4)
			if (sd->status.base_level > 96 && item->equip & EQP_ARMS && item->type == IT_WEAPON) // Modificado 17/09/2015
				switch(item->look) { //In weapons, the look determines type of weapon.
					case W_DAGGER: //All level 4 - Daggers
					case W_1HSWORD: //All level 4 - 1H Swords
					case W_1HAXE: //All level 4 - 1H Axes
					case W_MACE: //All level 4 - 1H Maces
					case W_STAFF: //All level 4 - 1H Staves
					case W_2HSTAFF: //All level 4 - 2H Staves
						return ITEM_EQUIP_ACK_OK;
				}
		}
	}

	//fail to equip if item is restricted
	if (!battle_config.allow_equip_restricted_item && itemdb_isNoEquip(item, sd->bl.m))
		return ITEM_EQUIP_ACK_FAIL;

	//Not equipable by class. [Skotlex]
	if (!(1<<(sd->class_&MAPID_BASEMASK)&item->class_base[(sd->class_&JOBL_2_1)?1:((sd->class_&JOBL_2_2)?2:0)]))
		return ITEM_EQUIP_ACK_FAIL;
	
	if (!pc_isItemClass(sd,item))
		return ITEM_EQUIP_ACK_FAIL;

	return ITEM_EQUIP_ACK_OK;
}

So, find this fragment:

	struct item_data *item;

	nullpo_ret(sd);

	item = sd->inventory_data[n];

And turn into this:

	struct item equip;	
	struct item_data *item;
	int char_id = 0;
	
	nullpo_ret(sd);

	equip = sd->status.inventory[n];
	item = sd->inventory_data[n];

So we can get the important info, which is, if the item has a signature (I don't know how you name it, I'm talking about the name that appears when someone produce an Item, in costume itens it appears Costume in blue), and, if so, if it's the name of the Reserved Char ID for it.

So, now the function.
Now, find this fragment:

    if(item == NULL)
        return false;

And, just below it, paste this check:

	if( equip.card[0] == CARD0_CREATE ){
		char_id = MakeDWord(equip.card[2],equip.card[3]);
		if( battle_config.reserved_costume_id && char_id == battle_config.reserved_costume_id)
			return true;
	}	

I hope all the functions needed exists on your Costume Snippet.
This one was tested, but I did it on rAmod, so don't know exactly the differences.

 

Haziel,

 

Can you make a patch for rAmod. Thank you so much. its not working to me.

 

UPDATE: I FIGURE IT OUT NOW.

 

How about the weight of the converted costume item?

Edited by Fantastik
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  38
  • Topics Per Day:  0.01
  • Content Count:  333
  • Reputation:   67
  • Joined:  09/05/12
  • Last Seen:  

Ok, forget all I did before, please revert the diffs.

The problem is, after reading part of the source, I was led to believe that that 'signature' with the name of the char was read by the checks as an EQP_COSTUME_HEAD_TOP, EQP_COSTUME_HEAD_MID, EQP_COSTUME_HEAD_LOW or EQP_COSTUME_GARMENT. That's not true.

So, let's do it pretty easily.

First of all, there's the case of WHICH diff are you using. I'm currently using rAmod, but I'll assume you're using this diff.

If so, yet on src/map/pc.c, find the function pc_isequip, I'll guide myself by the one Fantastik posted.

/*=================================================
 * Checks if the player can equip the item at index n in inventory.
 * @param sd
 * @param n Item index in inventory
 * @return ITEM_EQUIP_ACK_OK(0) if can be equipped, or ITEM_EQUIP_ACK_FAIL(1)/ITEM_EQUIP_ACK_FAILLEVEL(2) if can't
 *------------------------------------------------*/
uint8 pc_isequip(struct map_session_data *sd,int n)
{
	struct item_data *item;

	nullpo_retr(ITEM_EQUIP_ACK_FAIL, sd);

	item = sd->inventory_data[n];

	if(pc_has_permission(sd, PC_PERM_USE_ALL_EQUIPMENT))
		return ITEM_EQUIP_ACK_OK;

	if(item == NULL)
		return ITEM_EQUIP_ACK_FAIL;
	if(item->elv && sd->status.base_level < (unsigned int)item->elv)
		return ITEM_EQUIP_ACK_FAILLEVEL;
	if(item->elvmax && sd->status.base_level > (unsigned int)item->elvmax)
		return ITEM_EQUIP_ACK_FAILLEVEL;
	if(item->sex != 2 && sd->status.sex != item->sex)
		return ITEM_EQUIP_ACK_FAIL;

	if (sd->sc.count) {
		if(item->equip & EQP_ARMS && item->type == IT_WEAPON && sd->sc.data[SC_STRIPWEAPON]) // Also works with left-hand weapons [DracoRPG]
			return ITEM_EQUIP_ACK_FAIL;
		if(item->equip & EQP_SHIELD && item->type == IT_ARMOR && sd->sc.data[SC_STRIPSHIELD])
			return ITEM_EQUIP_ACK_FAIL;
		if(item->equip & EQP_ARMOR && sd->sc.data[SC_STRIPARMOR])
			return ITEM_EQUIP_ACK_FAIL;
		if(item->equip & EQP_HEAD_TOP && sd->sc.data[SC_STRIPHELM])
			return ITEM_EQUIP_ACK_FAIL;
		if(item->equip & EQP_ACC && sd->sc.data[SC__STRIPACCESSORY])
			return ITEM_EQUIP_ACK_FAIL;
		if(item->equip && sd->sc.data[SC_KYOUGAKU])
			return ITEM_EQUIP_ACK_FAIL;

		if (sd->sc.data[SC_SPIRIT] && sd->sc.data[SC_SPIRIT]->val2 == SL_SUPERNOVICE) {
			//Spirit of Super Novice equip bonuses. [Skotlex]
			if (sd->status.base_level > 90 && item->equip & EQP_HELM)
				return ITEM_EQUIP_ACK_OK; //Can equip all helms
			
			//if (sd->status.base_level > 96 && item->equip & EQP_ARMS && item->type == IT_WEAPON && item->wlv == 4)
			if (sd->status.base_level > 96 && item->equip & EQP_ARMS && item->type == IT_WEAPON) // Modificado 17/09/2015
				switch(item->look) { //In weapons, the look determines type of weapon.
					case W_DAGGER: //All level 4 - Daggers
					case W_1HSWORD: //All level 4 - 1H Swords
					case W_1HAXE: //All level 4 - 1H Axes
					case W_MACE: //All level 4 - 1H Maces
					case W_STAFF: //All level 4 - 1H Staves
					case W_2HSTAFF: //All level 4 - 2H Staves
						return ITEM_EQUIP_ACK_OK;
				}
		}
	}

	//fail to equip if item is restricted
	if (!battle_config.allow_equip_restricted_item && itemdb_isNoEquip(item, sd->bl.m))
		return ITEM_EQUIP_ACK_FAIL;

	//Not equipable by class. [Skotlex]
	if (!(1<<(sd->class_&MAPID_BASEMASK)&item->class_base[(sd->class_&JOBL_2_1)?1:((sd->class_&JOBL_2_2)?2:0)]))
		return ITEM_EQUIP_ACK_FAIL;
	
	if (!pc_isItemClass(sd,item))
		return ITEM_EQUIP_ACK_FAIL;

	return ITEM_EQUIP_ACK_OK;
}

So, find this fragment:

	struct item_data *item;

	nullpo_ret(sd);

	item = sd->inventory_data[n];

And turn into this:

	struct item equip;	
	struct item_data *item;
	int char_id = 0;
	
	nullpo_ret(sd);

	equip = sd->status.inventory[n];
	item = sd->inventory_data[n];

So we can get the important info, which is, if the item has a signature (I don't know how you name it, I'm talking about the name that appears when someone produce an Item, in costume itens it appears Costume in blue), and, if so, if it's the name of the Reserved Char ID for it.

So, now the function.

Now, find this fragment:

    if(item == NULL)
        return false;

And, just below it, paste this check:

	if( equip.card[0] == CARD0_CREATE ){
		char_id = MakeDWord(equip.card[2],equip.card[3]);
		if( battle_config.reserved_costume_id && char_id == battle_config.reserved_costume_id)
			return true;
	}	

I hope all the functions needed exists on your Costume Snippet.

This one was tested, but I did it on rAmod, so don't know exactly the differences.

Thanks for this, solved my problem.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  6
  • Reputation:   0
  • Joined:  02/01/17
  • Last Seen:  

If someone come across this thread trying to make the suggestion work on a 2023 rAthena codebase, here's how I've made it work:
Assuming you've used this diff from secret (some fixing were needed), the suggested fix above to allow costume-converted items to be equipped will go like this:

pc.cpp

uint8 pc_isequip(map_session_data *sd,int n)
{
	struct item equip;
	struct item_data *item;

	nullpo_retr(ITEM_EQUIP_ACK_FAIL, sd);

	equip = sd->inventory.u.items_inventory[n];
	item = sd->inventory_data[n];

	if(pc_has_permission(sd, PC_PERM_USE_ALL_EQUIPMENT))
		return ITEM_EQUIP_ACK_OK;

	if(item == NULL)
		return ITEM_EQUIP_ACK_FAIL;

	//Automatically allow equip if it's a costume-converted headgear
	if(equip.card[2] == GetWord(battle_config.reserved_costume_id, 0))
		return ITEM_EQUIP_ACK_OK;

 

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...