@ -486,13 +486,7 @@ public class ItemBase {
@@ -486,13 +486,7 @@ public class ItemBase {
if ( ! validForSkills ( abstractCharacter . getSkills ( ) ) )
return false ;
if ( ! validRace ( item . getItemBase ( ) , abstractCharacter ) )
return false ;
if ( ! validClass ( item . getItemBase ( ) , abstractCharacter ) )
return false ;
if ( ! validDisc ( item . getItemBase ( ) , abstractCharacter ) )
if ( this . canCharacterEquip ( abstractCharacter ) = = false )
return false ;
return item . getItemBase ( ) . value ! = 0 | | Kit . IsNoobGear ( item . getItemBase ( ) . uuid ) ;
@ -502,34 +496,6 @@ public class ItemBase {
@@ -502,34 +496,6 @@ public class ItemBase {
return true ; //Mobiles and NPC's don't need to check equip
}
public static boolean validRace ( ItemBase ib , AbstractCharacter absChar ) {
if ( ib . requiredRaces = = null | | ib . requiredRaces . isEmpty ( ) )
if ( ib . restrictedRaces = = null | | ib . restrictedRaces . isEmpty ( ) )
return true ;
return ib . requiredRaces . contains ( absChar . absRace ) & & ! ib . restrictedRaces . contains ( absChar . absRace ) ;
}
public static boolean validClass ( ItemBase ib , AbstractCharacter absChar ) {
if ( ib . requiredClasses = = null | | ib . requiredClasses . isEmpty ( ) )
if ( ib . restrictedClasses = = null | | ib . restrictedClasses . isEmpty ( ) )
return true ;
return ib . requiredClasses . contains ( absChar . absClass ) & & ! ib . restrictedClasses . contains ( absChar . absClass ) ;
}
public static boolean validDisc ( ItemBase ib , AbstractCharacter absChar ) {
if ( ib . requiredDiscs = = null | | ib . requiredDiscs . isEmpty ( ) )
if ( ib . restrictedDiscs = = null | | ib . restrictedDiscs . isEmpty ( ) )
return true ;
for ( CharacterRune rune : absChar . runes )
if ( ib . requiredDiscs . contains ( rune . getRuneBaseID ( ) ) = = true & & ib . restrictedDiscs . contains ( rune . getRuneBaseID ( ) ) = = false )
return true ;
return false ;
}
public int getValidSlot ( ) {
int slotValue = 0 ;
@ -985,5 +951,48 @@ public class ItemBase {
@@ -985,5 +951,48 @@ public class ItemBase {
return false ;
}
public Boolean canCharacterEquip ( AbstractCharacter character ) {
return ValidRace ( character . absRace ) & & ValidClass ( character . absBaseClass , character . absPromotionClass ) & & ValidDiscipline ( character . absDisciplines ) ;
}
public Boolean ValidRace ( Enum . MonsterType race ) {
if ( this . requiredRaces . isEmpty ( ) & & this . restrictedRaces . isEmpty ( ) )
return true ;
if ( this . requiredRaces . isEmpty ( ) = = false & & race . elementOf ( this . requiredRaces ) = = true )
return true ;
if ( this . restrictedRaces . isEmpty ( ) = = false & & race . elementOf ( this . restrictedRaces ) = = false )
return true ;
return false ;
}
public Boolean ValidClass ( Enum . ClassType base , Enum . ClassType profession ) {
if ( this . requiredClasses . isEmpty ( ) & & this . restrictedClasses . isEmpty ( ) )
return true ;
if ( this . requiredClasses . isEmpty ( ) = = false )
if ( this . requiredClasses . contains ( base ) | | this . requiredClasses . contains ( profession ) )
return true ;
if ( this . restrictedClasses . isEmpty ( ) = = false )
if ( this . restrictedClasses . contains ( base ) = = false & & this . restrictedClasses . contains ( profession ) = = false )
return true ;
return false ;
}
public Boolean ValidDiscipline ( EnumSet < Enum . DisciplineType > discs ) {
if ( this . requiredDiscs . isEmpty ( ) & & this . restrictedDiscs . isEmpty ( ) )
return true ;
for ( Enum . DisciplineType disc : discs ) {
if ( this . requiredDiscs . isEmpty ( ) = = false & & this . requiredDiscs . contains ( disc ) )
return true ;
if ( this . restrictedDiscs . isEmpty ( ) = = false & & this . restrictedDiscs . contains ( disc ) )
return false ;
}
return false ;
}
}