Search in sources :

Example 1 with CharacterLogItem

use of delta.games.lotro.character.log.CharacterLogItem in project lotro-companion by dmorcellet.

the class CharacterLogTableController method buildTable.

private GenericTableController<CharacterLogItem> buildTable() {
    DataProvider<CharacterLogItem> provider = new DataProvider<CharacterLogItem>() {

        @Override
        public CharacterLogItem getAt(int index) {
            return _log.getLogItem(index);
        }

        @Override
        public int getCount() {
            return _log.getNbItems();
        }
    };
    GenericTableController<CharacterLogItem> table = new GenericTableController<CharacterLogItem>(provider);
    // Date column
    {
        CellDataProvider<CharacterLogItem, Date> dateCell = new CellDataProvider<CharacterLogItem, Date>() {

            @Override
            public Date getData(CharacterLogItem item) {
                long timestamp = item.getDate();
                return new Date(timestamp);
            }
        };
        TableColumnController<CharacterLogItem, Date> dateColumn = new TableColumnController<CharacterLogItem, Date>("Date", Date.class, dateCell);
        dateColumn.setWidthSpecs(100, 100, 50);
        dateColumn.setCellRenderer(new DateRenderer(Formats.DATE_PATTERN));
        table.addColumnController(dateColumn);
    }
    // Type column
    {
        CellDataProvider<CharacterLogItem, LogItemType> typeCell = new CellDataProvider<CharacterLogItem, LogItemType>() {

            @Override
            public LogItemType getData(CharacterLogItem item) {
                return item.getLogItemType();
            }
        };
        TableColumnController<CharacterLogItem, LogItemType> typeColumn = new TableColumnController<CharacterLogItem, LogItemType>("Type", LogItemType.class, typeCell);
        typeColumn.setWidthSpecs(100, 100, 50);
        typeColumn.setCellRenderer(new LogItemTypeRenderer());
        typeColumn.setUseToString(Boolean.TRUE);
        table.addColumnController(typeColumn);
    }
    // Label column
    {
        CellDataProvider<CharacterLogItem, String> labelCell = new CellDataProvider<CharacterLogItem, String>() {

            @Override
            public String getData(CharacterLogItem item) {
                return item.getLabel();
            }
        };
        TableColumnController<CharacterLogItem, String> labelColumn = new TableColumnController<CharacterLogItem, String>("Label", String.class, labelCell);
        labelColumn.setWidthSpecs(150, -1, 150);
        table.addColumnController(labelColumn);
    }
    return table;
}
Also used : TableColumnController(delta.common.ui.swing.tables.TableColumnController) DateRenderer(delta.common.ui.swing.tables.GenericTableController.DateRenderer) Date(java.util.Date) CellDataProvider(delta.common.ui.swing.tables.CellDataProvider) DataProvider(delta.common.ui.swing.tables.DataProvider) GenericTableController(delta.common.ui.swing.tables.GenericTableController) CharacterLogItem(delta.games.lotro.character.log.CharacterLogItem) CellDataProvider(delta.common.ui.swing.tables.CellDataProvider) LogItemType(delta.games.lotro.character.log.CharacterLogItem.LogItemType)

Example 2 with CharacterLogItem

use of delta.games.lotro.character.log.CharacterLogItem in project lotro-companion by dmorcellet.

the class QuestsCompletionStats method parseQuestItems.

private void parseQuestItems(List<CharacterLogItem> items) {
    for (CharacterLogItem item : items) {
        Integer id = item.getResourceIdentifier();
        if (_expectedIds.contains(id)) {
            Integer nb = _nbTimesPerQuest.get(id);
            if (nb == null) {
                nb = Integer.valueOf(1);
            } else {
                nb = Integer.valueOf(nb.intValue() + 1);
            }
            _nbTimesPerQuest.put(id, nb);
        }
    }
    _nbQuestsDone = _nbTimesPerQuest.size();
}
Also used : CharacterLogItem(delta.games.lotro.character.log.CharacterLogItem)

Example 3 with CharacterLogItem

use of delta.games.lotro.character.log.CharacterLogItem in project lotro-companion by dmorcellet.

the class QuestsCompletionStats method getQuestItems.

private List<CharacterLogItem> getQuestItems(CharacterLog log) {
    List<CharacterLogItem> ret = new ArrayList<CharacterLogItem>();
    int nb = log.getNbItems();
    for (int i = 0; i < nb; i++) {
        CharacterLogItem item = log.getLogItem(i);
        if ((item != null) && (item.getLogItemType() == LogItemType.QUEST)) {
            ret.add(item);
        }
    }
    return ret;
}
Also used : ArrayList(java.util.ArrayList) CharacterLogItem(delta.games.lotro.character.log.CharacterLogItem)

Example 4 with CharacterLogItem

use of delta.games.lotro.character.log.CharacterLogItem in project lotro-companion by dmorcellet.

the class VirtuesStats method getLogItems.

private List<CharacterLogItem> getLogItems(CharacterLog log, LogItemType type) {
    List<CharacterLogItem> ret = new ArrayList<CharacterLogItem>();
    int nb = log.getNbItems();
    for (int i = 0; i < nb; i++) {
        CharacterLogItem item = log.getLogItem(i);
        if ((item != null) && (item.getLogItemType() == type)) {
            ret.add(item);
        }
    }
    return ret;
}
Also used : ArrayList(java.util.ArrayList) CharacterLogItem(delta.games.lotro.character.log.CharacterLogItem)

Example 5 with CharacterLogItem

use of delta.games.lotro.character.log.CharacterLogItem in project lotro-companion by dmorcellet.

the class VirtuesStats method parseDeedItems.

private void parseDeedItems(List<CharacterLogItem> items) {
    DeedsManager dm = DeedsManager.getInstance();
    for (CharacterLogItem item : items) {
        Integer id = item.getResourceIdentifier();
        if (id != null) {
            DeedDescription deed = dm.getDeed(id.intValue());
            if (deed != null) {
                Rewards rewards = deed.getRewards();
                String name = deed.getName();
                handleRewards("Deed:" + name, rewards);
            }
        }
    }
}
Also used : DeedsManager(delta.games.lotro.lore.deeds.DeedsManager) DeedDescription(delta.games.lotro.lore.deeds.DeedDescription) Rewards(delta.games.lotro.common.Rewards) CharacterLogItem(delta.games.lotro.character.log.CharacterLogItem)

Aggregations

CharacterLogItem (delta.games.lotro.character.log.CharacterLogItem)10 ArrayList (java.util.ArrayList)4 LogItemType (delta.games.lotro.character.log.CharacterLogItem.LogItemType)3 Rewards (delta.games.lotro.common.Rewards)2 Element (net.htmlparser.jericho.Element)2 CellDataProvider (delta.common.ui.swing.tables.CellDataProvider)1 DataProvider (delta.common.ui.swing.tables.DataProvider)1 GenericTableController (delta.common.ui.swing.tables.GenericTableController)1 DateRenderer (delta.common.ui.swing.tables.GenericTableController.DateRenderer)1 TableColumnController (delta.common.ui.swing.tables.TableColumnController)1 DeedDescription (delta.games.lotro.lore.deeds.DeedDescription)1 DeedsManager (delta.games.lotro.lore.deeds.DeedsManager)1 QuestDescription (delta.games.lotro.lore.quests.QuestDescription)1 QuestsManager (delta.games.lotro.lore.quests.QuestsManager)1 DownloadService (delta.games.lotro.utils.DownloadService)1 Calendar (java.util.Calendar)1 Date (java.util.Date)1 GregorianCalendar (java.util.GregorianCalendar)1 Source (net.htmlparser.jericho.Source)1 TextExtractor (net.htmlparser.jericho.TextExtractor)1