Ejemplo n.º 1
0
  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);
  }
Ejemplo n.º 2
0
  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;
  }
Ejemplo n.º 3
0
 @Override
 public void commit(IoSession out) {
   GameSendersRegistry.getObject().addItem(entry, out);
   DAOFactory.inventory().update(entry);
   Loggin.debug("Ajout de l'item %d", entry.id);
 }