Find if a shield is equipped?

fxer

Member
I've been looking through the proxy records and wiki but can't find many mentions of 'shield' except for the modifier maximizer. Is there a way to find if you have a shield equipped via ash? I'd assume mafia knows what items are shields if the maximizer can take a +shield command but I don't see that info exposed elsewhere

This arose out of creating a function to return a usable muscle class combat skill you currently have, and I'm not sure how to tell if Shieldbutt will be usable before combat

PHP:
foreach s in $skills[] {
	if( ( s.class == $class[turtle tamer] || s.class == $class[seal clubber] ) && s.combat && have_skill(s) ){
		if( s != $skill[shieldbutt] ) return s;
		else if( CHECK_FOR_SHIELD_EQUIPPED ) return s;
	}
}
 

fxer

Member
boom that will work, thanks lcp!

The final function, if anyone ever wants it or has suggestions to improve the code :/

PHP:
// Return a combat skill for a specified class
skill get_combat_skill(string in_class){
	skill combatSkill;
	boolean [class] classList;
	switch (in_class){
		case "muscle":
			classList = $classes[turtle tamer, seal clubber];
			break;
		case "myst":
		case "mysticality":
			classList = $classes[pastamancer, sauceror];
			break;
		case "moxie":
			classList = $classes[accordion thief, disco bandit];
			break;
		default:
			vprint("You didn't select a valid class to get a combat skill for, dumbass","red",2);
	}
	
	int cheapest = 99999999;
	foreach s in $skills[] {
		if( classList contains s.class && s.combat && have_skill(s) ){
			if( ( s != $skill[shieldbutt] || item_type( equipped_item( $slot[offhand] ) ) == "shield" ) && mp_cost(s) < cheapest ){
				combatSkill = s;
				cheapest = mp_cost(s);
			}
		}
	}

	return combatSkill;
}
 
Last edited:
Top