Jump to content
  • 0

Fullstrip cant check itens equipped


Question

Posted

hi,

i want to change the FULLSTRIP like this:

when STALKER use this skill, him will remove all (armor,helm,shield and weapon) 

example: wizz received fullstrip but wizz dont have armor equipped, but will receive full strip in armor too.

bool skill_strip_equip(struct block_list *src, struct block_list *target, uint16 skill_id, uint16 skill_lv)
{
	nullpo_retr(false, src);
	nullpo_retr(false, target);

	struct status_change *tsc = status_get_sc(target);

	if (!tsc || tsc->option&OPTION_MADOGEAR) // Mado Gear cannot be divested [Ind]
		return false;

	const int pos[5]             = {EQP_WEAPON, EQP_SHIELD, EQP_ARMOR, EQP_HELM, EQP_ACC};
	const enum sc_type sc_atk[5] = {SC_STRIPWEAPON, SC_STRIPSHIELD, SC_STRIPARMOR, SC_STRIPHELM, SC__STRIPACCESSORY};
	const enum sc_type sc_def[5] = {SC_CP_WEAPON, SC_CP_SHIELD, SC_CP_ARMOR, SC_CP_HELM, SC_NONE};
	struct status_data *sstatus = status_get_status_data(src), *tstatus = status_get_status_data(target);
	int rate, time, location, mod = 100;

	switch (skill_id) { // Rate
		case RG_STRIPWEAPON:
		case RG_STRIPARMOR:
		case RG_STRIPSHIELD:
		case RG_STRIPHELM:
		case GC_WEAPONCRUSH:
			rate = 50 * (skill_lv + 1) + 2 * (sstatus->dex - tstatus->dex);
			mod = 1000;
			break;
		case ST_FULLSTRIP: {
			int min_rate = 50 + 20 * skill_lv;

			rate = min_rate + 2 * (sstatus->dex - tstatus->dex);
			rate = max(min_rate, rate);
			mod = 1000;
			break;
		}
		case GS_DISARM:
			rate = sstatus->dex / (4 * (7 - skill_lv)) + sstatus->luk / (4 * (6 - skill_lv));
			rate = rate + status_get_lv(src) - (tstatus->agi * rate / 100) - tstatus->luk - status_get_lv(target);
			break;
		case WL_EARTHSTRAIN: {
			int job_lv = 0;

			if (src->type == BL_PC)
				job_lv = ((TBL_PC*)src)->status.job_level;
			rate = 6 * skill_lv + job_lv / 4 + sstatus->dex / 10;
			break;
		}
		case SC_STRIPACCESSARY:
			rate = 12 + 2 * skill_lv;
			break;
		default:
			return false;
	}

	if (rnd()%mod >= rate)
		return false;

	switch (skill_id) { // Duration
		case SC_STRIPACCESSARY:
		case GS_DISARM:
			time = skill_get_time(skill_id, skill_lv);
			break;
		case WL_EARTHSTRAIN:
		case RG_STRIPWEAPON:
		case RG_STRIPARMOR:
		case RG_STRIPSHIELD:
		case RG_STRIPHELM:
		case GC_WEAPONCRUSH:
		case ST_FULLSTRIP:
			if (skill_id == WL_EARTHSTRAIN)
				time = skill_get_time2(skill_id, skill_lv);
			else
				time = skill_get_time(skill_id, skill_lv);

			if (target->type == BL_PC)
				time += skill_lv + 500 * (sstatus->dex - tstatus->dex);
			else {
				time += 15000;
				time += skill_lv + 500 * (sstatus->dex - tstatus->dex);
			}
			break;
	}

	switch (skill_id) { // Location
		case GC_WEAPONCRUSH:
		case RG_STRIPWEAPON:
		case GS_DISARM:
			location = EQP_WEAPON;
			break;
		case RG_STRIPARMOR:
			location = EQP_ARMOR;
			break;
		case RG_STRIPSHIELD:
			location = EQP_SHIELD;
			break;
		case RG_STRIPHELM:
			location = EQP_HELM;
			break;
		case ST_FULLSTRIP:
			location = EQP_WEAPON|EQP_SHIELD|EQP_ARMOR|EQP_HELM;
			break;
		case SC_STRIPACCESSARY:
			location = EQP_ACC;
			break;
		case WL_EARTHSTRAIN:
			location = EQP_SHIELD|EQP_ARMOR|EQP_HELM;
			if (skill_lv >= 4)
				location |= EQP_WEAPON;
			if (skill_lv >= 5)
				location |= EQP_ACC;
			break;
	}

	for (uint8 i = 0; i < ARRAYLENGTH(pos); i++) {
		if (location&pos[i] && sc_def[i] > SC_NONE && tsc->data[sc_def[i]])
			location &=~ pos[i];
	}
	if (!location)
		return false;

	for (uint8 i = 0; i < ARRAYLENGTH(pos); i++) {
		if (location&pos[i] && !sc_start(src, target, sc_atk[i], 100, skill_lv, time))
			location &=~ pos[i];
	}
	return location ? true : false;
}

 i changed this code in any mods, but i cant do it!

2 answers to this question

Recommended Posts

  • 0
Posted

You can do this in src/map/status.cpp and search:

	// Strip skills, need to divest something or it fails.
	case SC_STRIPWEAPON:
		if (sd && !(flag&SCSTART_LOADED)) { // Apply sc anyway if loading saved sc_data
			short i;
			opt_flag = 0; // Reuse to check success condition.
			if(sd->bonus.unstripable_equip&EQP_WEAPON)
				return 0;
			i = sd->equip_index[EQI_HAND_L];
			if (i>=0 && sd->inventory_data[i] && sd->inventory_data[i]->type == IT_WEAPON) {
				opt_flag|=1;
				pc_unequipitem(sd,i,3); // Left-hand weapon
			}

			i = sd->equip_index[EQI_HAND_R];
			if (i>=0 && sd->inventory_data[i] && sd->inventory_data[i]->type == IT_WEAPON) {
				opt_flag|=2;
				pc_unequipitem(sd,i,3);
			}
			if (!opt_flag) return 0;
		}
		if (tick == 1) return 1; // Minimal duration: Only strip without causing the SC
	break;
	case SC_STRIPSHIELD:
		if( val2 == 1 ) val2 = 0; // GX effect. Do not take shield off..
		else
		if (sd && !(flag&SCSTART_LOADED)) {
			short i;
			if(sd->bonus.unstripable_equip&EQP_SHIELD)
				return 0;
			i = sd->equip_index[EQI_HAND_L];
			if ( i < 0 || !sd->inventory_data[i] || sd->inventory_data[i]->type != IT_ARMOR )
				return 0;
			pc_unequipitem(sd,i,3);
		}
		if (tick == 1) return 1; // Minimal duration: Only strip without causing the SC
	break;
	case SC_STRIPARMOR:
		if (sd && !(flag&SCSTART_LOADED)) {
			short i;
			if(sd->bonus.unstripable_equip&EQP_ARMOR)
				return 0;
			i = sd->equip_index[EQI_ARMOR];
			if ( i < 0 || !sd->inventory_data[i] )
				return 0;
			pc_unequipitem(sd,i,3);
		}
		if (tick == 1) return 1; // Minimal duration: Only strip without causing the SC
	break;
	case SC_STRIPHELM:
		if (sd && !(flag&SCSTART_LOADED)) {
			short i;
			if(sd->bonus.unstripable_equip&EQP_HELM)
				return 0;
			i = sd->equip_index[EQI_HEAD_TOP];
			if ( i < 0 || !sd->inventory_data[i] )
				return 0;
			pc_unequipitem(sd,i,3);
		}
		if (tick == 1) return 1; // Minimal duration: Only strip without causing the SC
	break;

And replace with this: 

 

	// Strip skills, need to divest something or it fails.
	case SC_STRIPWEAPON:
		if (sd && !(flag&SCSTART_LOADED)) { // Apply sc anyway if loading saved sc_data
			short i;
			opt_flag = 0; // Reuse to check success condition.
			if(sd->bonus.unstripable_equip&EQP_WEAPON)
				return 0;
			i = sd->equip_index[EQI_HAND_L];
			if (i>=0 && sd->inventory_data[i] && sd->inventory_data[i]->type == IT_WEAPON) {
				pc_unequipitem(sd,i,3); // Left-hand weapon
			}

			i = sd->equip_index[EQI_HAND_R];
			if (i>=0 && sd->inventory_data[i] && sd->inventory_data[i]->type == IT_WEAPON) {
				pc_unequipitem(sd,i,3);
			}
		}
		if (tick == 1) return 1; // Minimal duration: Only strip without causing the SC
	break;
	case SC_STRIPSHIELD:
		if (sd && !(flag&SCSTART_LOADED)) {
			short i;
			opt_flag = 0; // Reuse to check success condition.
			if(sd->bonus.unstripable_equip&EQP_SHIELD)
				return 0;
			i = sd->equip_index[EQI_HAND_L];
			if (i>=0 && sd->inventory_data[i] && sd->inventory_data[i]->type == IT_ARMOR) {
			pc_unequipitem(sd,i,3);
			}
		}
		if (tick == 1) return 1; // Minimal duration: Only strip without causing the SC
	break;
	case SC_STRIPARMOR:
		if (sd && !(flag&SCSTART_LOADED)) {
			short i;
			opt_flag = 0; // Reuse to check success condition.
			if(sd->bonus.unstripable_equip&EQP_ARMOR)
				return 0;
			i = sd->equip_index[EQI_ARMOR];
			if (i>=0 && sd->inventory_data[i] && sd->inventory_data[i]->type == IT_ARMOR) {
			pc_unequipitem(sd,i,3);
			}
		}
		if (tick == 1) return 1; // Minimal duration: Only strip without causing the SC
	break;
	case SC_STRIPHELM:
		if (sd && !(flag&SCSTART_LOADED)) {
			short i;
			opt_flag = 0; // Reuse to check success condition.
			if(sd->bonus.unstripable_equip&EQP_HELM)
				return 0;
			i = sd->equip_index[EQI_HEAD_TOP];
			if (i>=0 && sd->inventory_data[i] && sd->inventory_data[i]->type == IT_ARMOR) {
			pc_unequipitem(sd,i,3);
			}
		}
		if (tick == 1) return 1; // Minimal duration: Only strip without causing the SC
	break;

 

Tested and works fine ?

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...