@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((value == null) ? 0 : value.hashCode()); result = prime * result + ((mask == null) ? 0 : mask.hashCode()); return result; }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; OFOxmBsnL3InterfaceClassIdMaskedVer12 other = (OFOxmBsnL3InterfaceClassIdMaskedVer12) obj; if (value == null) { if (other.value != null) return false; } else if (!value.equals(other.value)) return false; if (mask == null) { if (other.mask != null) return false; } else if (!mask.equals(other.mask)) return false; return true; }
@Override public OFOxmBsnL3InterfaceClassIdMasked readFrom(ChannelBuffer bb) throws OFParseError { // fixed value property typeLen == 0x30908L int typeLen = bb.readInt(); if (typeLen != 0x30908) throw new OFParseError("Wrong typeLen: Expected=0x30908L(0x30908L), got=" + typeLen); ClassId value = ClassId.read4Bytes(bb); ClassId mask = ClassId.read4Bytes(bb); OFOxmBsnL3InterfaceClassIdMaskedVer12 oxmBsnL3InterfaceClassIdMaskedVer12 = new OFOxmBsnL3InterfaceClassIdMaskedVer12(value, mask); if (logger.isTraceEnabled()) logger.trace("readFrom - read={}", oxmBsnL3InterfaceClassIdMaskedVer12); return oxmBsnL3InterfaceClassIdMaskedVer12; }
@Nullable @Override protected ClassData getClassData(@NotNull ClassId classId) { InputStream stream = getStreamNullable(BuiltInsSerializationUtil.getClassMetadataPath(classId)); if (stream == null) { return null; } try { ProtoBuf.Class classProto = ProtoBuf.Class.parseFrom(stream); Name expectedShortName = classId.getRelativeClassName().shortName(); Name actualShortName = nameResolver.getClassId(classProto.getFqName()).getRelativeClassName().shortName(); if (!actualShortName.isSpecial() && !actualShortName.equals(expectedShortName)) { // Workaround for case-insensitive file systems, // otherwise we'd find "Collection" for "collection" etc return null; } return new ClassData(nameResolver, classProto); } catch (IOException e) { throw new IllegalStateException(e); } }
@Override public OFOxmBsnL3InterfaceClassId readFrom(ByteBuf bb) throws OFParseError { // fixed value property typeLen == 0x30804L int typeLen = bb.readInt(); if (typeLen != 0x30804) throw new OFParseError("Wrong typeLen: Expected=0x30804L(0x30804L), got=" + typeLen); ClassId value = ClassId.read4Bytes(bb); OFOxmBsnL3InterfaceClassIdVer13 oxmBsnL3InterfaceClassIdVer13 = new OFOxmBsnL3InterfaceClassIdVer13(value); if (logger.isTraceEnabled()) logger.trace("readFrom - read={}", oxmBsnL3InterfaceClassIdVer13); return oxmBsnL3InterfaceClassIdVer13; }
private final Set<PlayerClass> getAvailableSubClasses(L2PcInstance player) { final PlayerRace npcRace = getVillageMasterRace(); final ClassType npcTeachType = getVillageMasterTeachType(); // get player base class final int currentBaseId = player.getBaseClass(); final ClassId baseCID = ClassId.values()[currentBaseId]; // we need 2nd occupation ID final int baseClassId; if (baseCID.level() > 2) baseClassId = baseCID.getParent().ordinal(); else baseClassId = currentBaseId; PlayerClass currClass = PlayerClass.values()[baseClassId]; /** * If the race of your main class is Elf or Dark Elf, you may not select each class as a * subclass to the other class, and you may not select Overlord and Warsmith class as a * subclass. You may not select a similar class as the subclass. The occupations classified as * similar classes are as follows: Treasure Hunter, Plainswalker and Abyss Walker Hawkeye, * Silver Ranger and Phantom Ranger Paladin, Dark Avenger, Temple Knight and Shillien Knight * Warlocks, Elemental Summoner and Phantom Summoner Elder and Shillien Elder Swordsinger and * Bladedancer Sorcerer, Spellsinger and Spellhowler */ Set<PlayerClass> availSubs = currClass.getAvailableSubclasses(player); if (availSubs != null && !availSubs.isEmpty()) { for (PlayerClass availSub : availSubs) { for (SubClass subClass : player.getSubClasses().values()) if (subClass.getClassId() == availSub.ordinal()) { availSubs.remove(PlayerClass.values()[availSub.ordinal()]); } for (Iterator<SubClass> subList = iterSubClasses(player); subList.hasNext(); ) { SubClass prevSubClass = subList.next(); int subClassId = prevSubClass.getClassId(); if (subClassId >= 88) { subClassId = ClassId.values()[subClassId].getParent().getId(); } if (availSub.ordinal() == subClassId || availSub.ordinal() == player.getBaseClass()) { availSubs.remove(PlayerClass.values()[availSub.ordinal()]); } } if (npcRace == PlayerRace.Human || npcRace == PlayerRace.LightElf) { // 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 (!availSub.isOfType(npcTeachType)) { availSubs.remove(availSub); } else if (!availSub.isOfRace(PlayerRace.Human) && !availSub.isOfRace(PlayerRace.LightElf)) { availSubs.remove(availSub); } } else { // If the master is not human and not light elf, // then remove any classes not of the same race as the master. if (npcRace != PlayerRace.Human && npcRace != PlayerRace.LightElf && !availSub.isOfRace(npcRace)) { availSubs.remove(availSub); } } } } currClass = null; return availSubs; }