uint8 CurrentFixboyFilter = 0; // all
void SetFixboyFilter(uint8 filter) // called by button click
{
if( filter == CurrentFixboyFilter )
return; // leave server alone
CurrentFixboyFilter = filter;
RunServerScriptUnsafe( "fix_boy@unsafe_filter", filter, 0, 0, null, null );
}
void unsafe_filter( Critter& player, int filter, int, int, string@, int[]@ )
{
player.ParamBase[SILLY_PARAM_NAME] = filter;
player.DropTimers();
}
int GetFilter( CraftItem& recipe )
{
// take crafted item type from CraftItem::GetOutItems() and use it as filter value
// or use own table which will translate CraftItem to filter value
return( filter );
}
void fix_myShit( Critter& player, int state, CraftItem& recipe )
{
if( state == FIXBOY_LIST )
{
int PlayerFilter = player.ParamBase[SILLY_PARAM_NAME];
if( PlayerFilter == 0 ) // all
return( FIX_SUCCESS );
int ItemFilter = GetFilter( recipe );
if( PlayerFilter == ItemFilter )
return( FIX_SUCCESS );
return( FIX_FAIL );
}
// very secret code for other state value
}
!tested