- script CARD_CHECK -1,{
OnInit:
// Card ID
setarray .@cardIds$, 1, 2, 3, 4, 5, 6;
.@cardCount = getarraysize( .@cardIds$ );
// 0 = All. For all other numbers see the reference at http://herc.ws/wiki/Custom_Items - Weapon-type items.
setarray .@allowedSubtype, 0, 0, 0, 0, 0, 0;
// Slot size. Additional space that card takes. So if card id 1 shall take two slots this needs to be 1.
setarray .@slotSize, 1, 1, 1, 1, 1, 1;
.@cardIdPattern$ = implode( .@cardIds$, ":" );
while( sleep( 5000 ) ) {
.@resCount = query_sql( "SELECT `account_id` FROM `char` WHERE online = 1", .@accountIds );
for( .@i = 0; .@i < .@resCount; .@i++ ) {
if( attachrid( .@accountIds[ .@i ] ) ) {
for( .@y = 1; .@y < 20; .@y++ ) {
if( getequipisequiped( .@y ) ) {
.@wrongType = 0;
.@equipmentId = getequipid( .@y );
.@eqSlotSpace = getitemslots( .@equipmentId );
.@eqOccupiedSlots = getequipcardcnt( .@y );
if( getiteminfo( .@equipmentId, 2 ) == 4 )
.@eqWeaponType = getiteminfo( .@equipmentId, 14 );
.@eqInfoCards$[ 0 ] = getequipcardid( .@y, 0 );
.@eqInfoCards$[ 1 ] = getequipcardid( .@y, 1 );
.@eqInfoCards$[ 2 ] = getequipcardid( .@y, 2 );
.@eqInfoCards$[ 3 ] = getequipcardid( .@y, 3 );
for( .@z = 0; .@z < .@cardCount; .@z++ ) {
for( .@x = 0; .@x < 4; .@x++ ) {
if( .@cardIdPattern$[ .@z ] == .@eqInfoCards$[ .@x ] ) {
if( .@eqWeaponType && .@allowedSubtype[ .@z ] && .@allowedSubtype[ .@z ] != .@eqWeaponType ) {
.@wrongType = 1;
break;
}
.@eqOccupiedSlots += .@slotSize[ .@z ];
}
}
if( .@wrongType ) break;
}
if( .@wrongType ) {
successremovecards .@y;
dispbottom "You tried to add a cards to " + getequipname( .@y ) + " that didn't match the allowed weapon type.";
} else if( ( .@eqSlotSpace - .@eqOccupiedSlots ) > 0 ) {
successremovecards .@y;
dispbottom "You tried to add more cards to " + getequipname( .@y ) + " as allowed.";
}
}
}
}
}
}
end;
}