public static Objet newObjet(int Guid, int template, int qua, int pos, String strStats) {
    if (World.getObjTemplate(template) == null) {
      System.out.println(
          "ItemTemplate " + template + " inexistant, GUID dans la table `items`:" + Guid);
      Ancestra.closeServers();
    }

    if (World.getObjTemplate(template).getType() == 85)
      return new PierreAme(Guid, qua, template, pos, strStats);
    else return new Objet(Guid, template, qua, pos, strStats);
  }
    public ItemSet(int id, String items, String bonuses) {
      _id = id;
      // parse items String
      for (String str : items.split(",")) {
        try {
          ObjTemplate t = World.getObjTemplate(Integer.parseInt(str.trim()));
          if (t == null) continue;
          _itemTemplates.add(t);
        } catch (Exception e) {
        }
        ;
      }

      // on ajoute un bonus vide pour 1 item
      _bonuses.add(new Stats());
      // parse bonuses String
      for (String str : bonuses.split(";")) {
        Stats S = new Stats();
        // séparation des bonus pour un même nombre d'item
        for (String str2 : str.split(",")) {
          try {
            String[] infos = str2.split(":");
            int stat = Integer.parseInt(infos[0]);
            int value = Integer.parseInt(infos[1]);
            // on ajoute a la stat
            S.addOneStat(stat, value);
          } catch (Exception e) {
          }
          ;
        }
        // on ajoute la stat a la liste des bonus
        _bonuses.add(S);
      }
    }
Exemple #3
0
  public Objet(int Guid, int template, int qua, int pos, String strStats) {
    this.guid = Guid;
    this.template = World.getObjTemplate(template);
    this.quantity = qua;
    this.position = pos;

    Stats = new Stats();
    parseStringToStats(strStats);
  }
Exemple #4
0
 public Objet(
     int Guid, int template, int qua, int pos, Stats stats, ArrayList<SpellEffect> effects) {
   this.guid = Guid;
   this.template = World.getObjTemplate(template);
   this.quantity = qua;
   this.position = pos;
   this.Stats = stats;
   this.Effects = effects;
   this.obvijevan = 0;
   this.obvijevanLook = 0;
 }