Fixed AltSubclassEverywhere configuration.
Contributed by binary.
This commit is contained in:
parent
80557a9fc3
commit
6f4f062dc8
@ -740,21 +740,18 @@ public class VillageMaster extends Folk
|
|||||||
|
|
||||||
private Set<ClassId> getAvailableSubclasses(Player player)
|
private Set<ClassId> getAvailableSubclasses(Player player)
|
||||||
{
|
{
|
||||||
Set<ClassId> availSubs = getSubclasses(player, player.getBaseClass());
|
final Set<ClassId> availSubs = getSubclasses(player, player.getBaseClass());
|
||||||
final Race npcRace = getVillageMasterRace();
|
final Race npcRace = getVillageMasterRace();
|
||||||
final ClassType npcTeachType = getVillageMasterTeachType();
|
final ClassType npcTeachType = getVillageMasterTeachType();
|
||||||
boolean everywhereEnabled = Config.ALT_GAME_SUBCLASS_EVERYWHERE;
|
boolean everywhereEnabled = Config.ALT_GAME_SUBCLASS_EVERYWHERE;
|
||||||
|
|
||||||
if (availSubs != null)
|
if (availSubs != null)
|
||||||
{
|
{
|
||||||
// Create a copy of the set to avoid ConcurrentModificationException
|
// Create a copy of the set to avoid ConcurrentModificationException.
|
||||||
Set<ClassId> copySubs = new HashSet<>(availSubs);
|
final Set<ClassId> copySubs = new HashSet<>(availSubs);
|
||||||
for (ClassId availSub : copySubs)
|
for (ClassId availSub : copySubs)
|
||||||
{
|
{
|
||||||
// Check if subclass restrictions based on race should be applied everywhere
|
// Remove subclasses already chosen by the player.
|
||||||
if (!everywhereEnabled)
|
|
||||||
{
|
|
||||||
// Remove subclasses already chosen by the player
|
|
||||||
for (SubClassHolder subClass : player.getSubClasses().values())
|
for (SubClassHolder subClass : player.getSubClasses().values())
|
||||||
{
|
{
|
||||||
if (subClass.getClassId() == availSub.ordinal())
|
if (subClass.getClassId() == availSub.ordinal())
|
||||||
@ -763,11 +760,12 @@ public class VillageMaster extends Folk
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Remove subclasses unavailable due to previous choices or base class
|
|
||||||
Iterator<SubClassHolder> subListIterator = iterSubClasses(player);
|
// Remove subclasses unavailable due to previous choices or base class.
|
||||||
|
final Iterator<SubClassHolder> subListIterator = iterSubClasses(player);
|
||||||
while (subListIterator.hasNext())
|
while (subListIterator.hasNext())
|
||||||
{
|
{
|
||||||
SubClassHolder prevSubClass = subListIterator.next();
|
final SubClassHolder prevSubClass = subListIterator.next();
|
||||||
int subClassId = prevSubClass.getClassId();
|
int subClassId = prevSubClass.getClassId();
|
||||||
if (subClassId >= 88)
|
if (subClassId >= 88)
|
||||||
{
|
{
|
||||||
@ -779,7 +777,11 @@ public class VillageMaster extends Folk
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Apply race restrictions based on the village master's race
|
|
||||||
|
// Check if subclass restrictions based on race should be applied everywhere.
|
||||||
|
if (!everywhereEnabled)
|
||||||
|
{
|
||||||
|
// Apply race restrictions based on the village master's race.
|
||||||
if (((npcRace == Race.HUMAN) || (npcRace == Race.ELF)))
|
if (((npcRace == Race.HUMAN) || (npcRace == Race.ELF)))
|
||||||
{
|
{
|
||||||
// If the master is human or light elf, ensure that fighter-type masters only teach fighter classes, and priest-type masters only teach priest classes etc.
|
// If the master is human or light elf, ensure that fighter-type masters only teach fighter classes, and priest-type masters only teach priest classes etc.
|
||||||
@ -796,6 +798,7 @@ public class VillageMaster extends Folk
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return availSubs;
|
return availSubs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user