public String generateItemTemplateEffects(int id) { if (!itemsEffects.containsKey(id)) { ItemTemplate template = DAOFactory.item().getById(id); if (template == null) return ""; StringBuilder strEffects = new StringBuilder(); for (String effect : Utils.split(template.statsTemplate, ",")) { if (effect.isEmpty()) continue; try { short effectID = Short.parseShort(Utils.split(effect, "#")[0], 16); if (EffectsHandler.instance().getEffect(effectID) != null) strEffects.append(effect).append(','); } catch (Exception e) { Loggin.warning("cannot generate effects string %s for template %d", effect, id); } } itemsEffects.put(id, strEffects.toString()); } return itemsEffects.get(id); }
public static Player getPlayer(org.pvemu.models.Character character, Account account) { GameMap map = getValidCurrentMap(character); ClassData cd = ClassesHandler.instance().getClass(character.classId); SpellList spells = new SpellList(character.id, DAOFactory.learnedSpell().getLearnedSpells(character.id)); Player player = new Player( character, account, cd, getColors(character), getBaseStats(character.baseStats), spells, map, getValidCurrentCell(character, map)); player.getInventory().load(); player.getItemSetHandler().loadItemSets(); player.loadStuffStats(); cd.learnClassSpells(player); player.setCurrentVita(character.currentVita); return player; }
@Override public void commit(IoSession out) { GameSendersRegistry.getObject().addItem(entry, out); DAOFactory.inventory().update(entry); Loggin.debug("Ajout de l'item %d", entry.id); }