Browse Source

implement server side restrictions

combat-2
FatBoy-DOTC 9 months ago
parent
commit
6c1e2f1280
  1. 12
      src/engine/objects/ItemBase.java
  2. 4
      src/engine/objects/PlayerCharacter.java

12
src/engine/objects/ItemBase.java

@ -969,14 +969,16 @@ public class ItemBase { @@ -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 { @@ -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){

4
src/engine/objects/PlayerCharacter.java

@ -4575,10 +4575,14 @@ public class PlayerCharacter extends AbstractCharacter { @@ -4575,10 +4575,14 @@ 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) {
if(this.absDisciplines == null)
this.absDisciplines = EnumSet.of(disc);
else
this.absDisciplines.add(disc);
}
} catch(Exception e){

Loading…
Cancel
Save