forked from MagicBane/Server
implement server side restrictions
This commit is contained in:
@@ -969,14 +969,16 @@ public class ItemBase {
|
||||
}
|
||||
|
||||
public Boolean ValidClass(Enum.ClassType base,Enum.ClassType profession){
|
||||
if(this.requiredClasses.isEmpty() && this.restrictedClasses.isEmpty())
|
||||
boolean requiredEmpty = this.requiredClasses == null || this.requiredClasses.isEmpty();
|
||||
boolean restrictedEmpty = this.restrictedClasses == null || this.restrictedClasses.isEmpty();
|
||||
if(requiredEmpty && restrictedEmpty)
|
||||
return true;
|
||||
|
||||
if(this.requiredClasses.isEmpty() == false)
|
||||
if(this.requiredClasses != null && this.requiredClasses.isEmpty() == false)
|
||||
if(this.requiredClasses.contains(base) || this.requiredClasses.contains(profession))
|
||||
return true;
|
||||
|
||||
if(this.restrictedClasses.isEmpty() == false)
|
||||
if(this.restrictedClasses != null && this.restrictedClasses.isEmpty() == false)
|
||||
if(this.restrictedClasses.contains(base) == false && this.restrictedClasses.contains(profession) == false)
|
||||
return true;
|
||||
|
||||
@@ -984,7 +986,9 @@ public class ItemBase {
|
||||
}
|
||||
|
||||
public Boolean ValidDiscipline(EnumSet<Enum.DisciplineType> discs){
|
||||
if(this.requiredDiscs.isEmpty() && this.restrictedDiscs.isEmpty())
|
||||
boolean requiredEmpty = this.requiredDiscs == null || this.requiredDiscs.isEmpty();
|
||||
boolean restrictedEmpty = this.restrictedDiscs == null || this.restrictedDiscs.isEmpty();
|
||||
if(requiredEmpty && restrictedEmpty)
|
||||
return true;
|
||||
|
||||
for(Enum.DisciplineType disc : discs){
|
||||
|
||||
@@ -4575,11 +4575,15 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
else
|
||||
this.absGender = SexType.FEMALE;
|
||||
|
||||
|
||||
for(CharacterRune rune : this.runes){
|
||||
try {
|
||||
DisciplineType disc = DisciplineType.valueOf(RuneBase.getRuneBase(rune.getRuneBaseID()).getName().replace("-", "").replace(" ", ""));
|
||||
if (disc != null) {
|
||||
this.absDisciplines.add(disc);
|
||||
if(this.absDisciplines == null)
|
||||
this.absDisciplines = EnumSet.of(disc);
|
||||
else
|
||||
this.absDisciplines.add(disc);
|
||||
}
|
||||
} catch(Exception e){
|
||||
|
||||
|
||||
Reference in New Issue
Block a user