use of delta.games.lotro.lore.deeds.DeedDescription in project lotro-tools by dmorcellet.
the class MergeDeedsDatabases method mergeLotroCompendium2Lorebook.
private void mergeLotroCompendium2Lorebook() {
List<DeedDescription> lotroCompendiumDeeds = _lotroCompendium.getAll();
int nbDeeds = lotroCompendiumDeeds.size();
for (int i = 0; i < nbDeeds; i++) {
DeedDescription lotroCompendiumDeed = lotroCompendiumDeeds.get(i);
if (lotroCompendiumDeed.getIdentifier() < 10000) {
_lorebook.addDeed(lotroCompendiumDeed);
}
}
}
use of delta.games.lotro.lore.deeds.DeedDescription in project lotro-tools by dmorcellet.
the class MergeDeedsDatabases method findMatchingDeedInContainer.
private DeedDescription findMatchingDeedInContainer(DeedsContainer container, DeedDescription deed) {
List<DeedDescription> matches = container.getDeedByName(deed.getName());
if (matches.size() == 1) {
// Single match: good!
return matches.get(0);
}
// Multiple matches
// - look at description
List<DeedDescription> matches2 = new ArrayList<DeedDescription>();
for (DeedDescription match : matches) {
String description = match.getDescription();
if (description.equals(deed.getDescription())) {
matches2.add(match);
}
}
int nbNameAndDescriptionMatches = matches2.size();
if (nbNameAndDescriptionMatches == 1) {
return matches2.get(0);
}
if (nbNameAndDescriptionMatches != 1) {
List<DeedDescription> matches3 = new ArrayList<DeedDescription>();
for (DeedDescription match : matches) {
if (Objects.equals(match.getObjectives(), deed.getObjectives())) {
matches3.add(match);
}
}
int count = matches3.size();
if (count == 1) {
return matches3.get(0);
}
}
if (nbNameAndDescriptionMatches > 1) {
// Still multiple matches, look at class
List<DeedDescription> matches3 = new ArrayList<DeedDescription>();
for (DeedDescription match : matches2) {
if (Objects.equals(match.getRequiredClass(), deed.getRequiredClass())) {
matches3.add(match);
}
}
int nbNameDescriptionAndClassMatches = matches3.size();
if (nbNameDescriptionAndClassMatches == 1) {
return matches3.get(0);
}
}
System.out.println("No match for: " + deed + "nb matches=" + nbNameAndDescriptionMatches);
return null;
}
use of delta.games.lotro.lore.deeds.DeedDescription in project lotro-tools by dmorcellet.
the class DeedLinksResolver method checkNext2PreviousSymetry.
private void checkNext2PreviousSymetry(DeedDescription deed) {
DeedProxy nextProxy = deed.getNextDeedProxy();
if (nextProxy != null) {
String nextKey = nextProxy.getKey();
DeedDescription nextDeed = _mapByKey.get(nextKey);
if (nextDeed != null) {
DeedProxy previousProxy = nextDeed.getPreviousDeedProxy();
if (previousProxy == null) {
previousProxy = new DeedProxy();
previousProxy.setDeed(deed);
previousProxy.setKey(deed.getKey());
previousProxy.setName(deed.getName());
nextDeed.setPreviousDeedProxy(previousProxy);
}
}
}
}
use of delta.games.lotro.lore.deeds.DeedDescription in project lotro-tools by dmorcellet.
the class DeedLinksResolver method checkParent2ChildSymetry.
private void checkParent2ChildSymetry(DeedDescription deed) {
for (DeedProxy parentProxy : deed.getParentDeedProxies().getDeedProxies()) {
String parentKey = parentProxy.getKey();
DeedDescription parentDeed = _mapByKey.get(parentKey);
if (parentDeed != null) {
addChildDeed(parentDeed, deed);
}
}
}
use of delta.games.lotro.lore.deeds.DeedDescription in project lotro-tools by dmorcellet.
the class LotroWikiDeedCategoryPageParser method doCategory.
/**
* Handle a deed category.
* @param categoryId Category identifier.
* @return a list of loaded deeds.
*/
public List<DeedDescription> doCategory(String categoryId) {
String url = LotroWikiConstants.BASE_URL + "/index.php/Category:" + Escapes.escapeUrl(categoryId);
String file = categoryId + "/main.html";
File deedsCategoryFile = _lotroWiki.download(url, Escapes.escapeFile(file));
List<String> deedIds = parseDeedCategoryPage(deedsCategoryFile);
List<DeedDescription> deeds = loadDeeds(categoryId, deedIds);
writeFile(categoryId, deeds);
return deeds;
}
Aggregations