public static void deletePerso(Personnage perso) {
   if (perso.get_guild() != null) {
     if (perso.get_guild().getMembers().size()
         <= 1) // Il est tout seul dans la guilde : Supression
     {
       World.removeGuild(perso.get_guild().get_id());
     } else if (perso.getGuildMember().getRank()
         == 1) // On passe les pouvoir a celui qui a le plus de droits si il est meneur
     {
       int curMaxRight = 0;
       Personnage Meneur = null;
       for (Personnage newMeneur : perso.get_guild().getMembers()) {
         if (newMeneur == perso) continue;
         if (newMeneur.getGuildMember().getRights() < curMaxRight) {
           Meneur = newMeneur;
         }
       }
       perso.get_guild().removeMember(perso);
       Meneur.getGuildMember().setRank(1);
     } else // Supression simple
     {
       perso.get_guild().removeMember(perso);
     }
   }
   perso.remove(); // Supression BDD Perso, items, monture.
   World.unloadPerso(perso.get_GUID()); // UnLoad du perso+item
 }
  public static int getEncloCellIdByMapId(short i) {
    if (World.getCarte(i).getMountPark() != null) {
      if (World.getCarte(i).getMountPark().get_cellid() > 0) {
        return World.getCarte(i).getMountPark().get_cellid();
      }
    }

    return -1;
  }
 public Area(int id, int superArea, String name) {
   _id = id;
   _name = name;
   _superArea = World.getSuperArea(superArea);
   // Si le continent n'est pas encore créer, on le créer et on l'ajoute au monde
   if (_superArea == null) {
     _superArea = new SuperArea(superArea);
     World.addSuperArea(_superArea);
   }
 }
  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);
  }
Exemple #5
0
 public MobGroup(int Aid, int cID, String groupData) {
   int maxLevel = 0;
   id = Aid;
   align = Constants.ALIGNEMENT_NEUTRE;
   cellID = cID;
   aggroDistance = Constants.getAggroByLevel(maxLevel);
   isFix = true;
   _creationDate = System.currentTimeMillis();
   int guid = -1;
   for (String data : groupData.split(";")) {
     String[] infos = data.split(",");
     try {
       int id = Integer.parseInt(infos[0]);
       int min = Integer.parseInt(infos[1]);
       int max = Integer.parseInt(infos[2]);
       Monstre m = World.getMonstre(id);
       List<MobGrade> mgs = new ArrayList<MobGrade>();
       // on ajoute a la liste les grades possibles
       for (MobGrade MG : m.getGrades().values())
         if (MG.level >= min && MG.level <= max) mgs.add(MG);
       if (mgs.isEmpty()) continue;
       // On prend un grade au hasard entre 0 et size -1 parmis les mobs possibles
       _Mobs.put(guid, mgs.get(Formulas.getRandomValue(0, mgs.size() - 1)));
       guid--;
     } catch (Exception e) {
       continue;
     }
     ;
   }
   orientation = (Formulas.getRandomValue(0, 3) * 2) + 1;
 }
    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 #7
0
 public static String DefenseursDuPrisme(int id, short CarteId, int FightId) {
   String str = "+";
   String stra = "";
   str += Integer.toString(id, 36);
   for (Entry<Integer, Fight> Fight : World.getCarte(CarteId).get_fights().entrySet()) {
     if (Fight.getValue().get_id() == FightId) {
       for (Fighter fighter : Fight.getValue().getFighters(2)) {
         if (fighter.getPersonnage() == null) continue;
         str += "|";
         str += Integer.toString(fighter.getPersonnage().get_GUID(), 36) + ";";
         str += fighter.getPersonnage().get_name() + ";";
         str += fighter.getPersonnage().get_gfxID() + ";";
         str += fighter.getPersonnage().get_lvl() + ";";
         str += Integer.toString(fighter.getPersonnage().get_color1(), 36) + ";";
         str += Integer.toString(fighter.getPersonnage().get_color2(), 36) + ";";
         str += Integer.toString(fighter.getPersonnage().get_color3(), 36) + ";";
         if (Fight.getValue().getFighters(2).size() > 7) str += "1;";
         else str += "0;";
       }
       stra = str.substring(1);
       stra = "-" + stra;
       Fight.getValue().setDefenseurs(stra);
     }
   }
   return str;
 }
Exemple #8
0
  public static void main(String[] args) {
    Runtime.getRuntime()
        .addShutdownHook(
            new Thread() {
              public void run() {
                DarkOrbit.closeServers();
              }
            });
    System.out.println("#========================= #");
    System.out.println("# DarkOrbit v" + VERSION + "\t #");
    System.out.println("# Creadopor:Elieaz Neor1326#");
    System.out.println("# [email protected]           #");
    System.out.println("#========================= #");
    System.out.println("Cargando configuracion:");
    cargarConfiguracion();
    isInit = true;
    System.out.println("Cargado con exito!");
    System.out.println("Conexion con la Base de datos...");
    if (SQLManager.setUpConnexion()) System.out.println("Conectado!");
    else {
      System.out.println("Conexion invalida");
      DarkOrbit.closeServers();
      System.exit(0);
    }

    System.out.println("Creando DarkOrbit...");
    long startTime = System.currentTimeMillis();
    // Start Policy Server
    System.out.println("Creando Policy Server...");
    policyServer = new PolicyServer(_this);
    World.createWorld();
    long endTime = System.currentTimeMillis();
    long differenceTime = (endTime - startTime) / 1000;
    System.out.println("Creado con exito ! en : " + differenceTime + " s");
    isRunning = true;
    String Ip = "";
    try {
      Ip = InetAddress.getLocalHost().getHostAddress();
    } catch (Exception e) {
      System.out.println(e.getMessage());
      try {
        Thread.sleep(10000);
      } catch (InterruptedException e1) {
      }
      System.exit(1);
    }
    Ip = IP;
    gameServer = new GameServer(Ip);
    System.out.println("Servidor del juego lanzado en el puerto " + CONFIG_GAME_PORT);
    chatServer = new ChatServer(Ip);
    System.out.println("Servidor del chat lanzado en el puerto " + CONFIG_CHAT_PORT);
    logServer = new SOSLoggingServer(Ip);
    System.out.println("Servidor de Logs lanzado en el puerto " + CONFIG_LOG_PORT);
    if (CONFIG_USE_IP)
      System.out.println("IP del servidor " + IP + " encriptada: " + GAMESERVER_IP);

    System.out.println("Esperando conexiones...");
    System.out.println("Visit http://mycom69.tk");
  }
    public synchronized void removeItem(int guid, int qua, int pguid) {
      int i = 0;
      if (perso1.get_GUID() == pguid) i = 1;
      else if (perso2.get_GUID() == pguid) i = 2;
      ok1 = false;
      ok2 = false;

      SocketManager.GAME_SEND_EXCHANGE_OK(
          perso1.get_compte().getGameThread().get_out(), ok1, perso1.get_GUID());
      SocketManager.GAME_SEND_EXCHANGE_OK(
          perso2.get_compte().getGameThread().get_out(), ok1, perso1.get_GUID());
      SocketManager.GAME_SEND_EXCHANGE_OK(
          perso1.get_compte().getGameThread().get_out(), ok2, perso2.get_GUID());
      SocketManager.GAME_SEND_EXCHANGE_OK(
          perso2.get_compte().getGameThread().get_out(), ok2, perso2.get_GUID());

      Objet obj = World.getObjet(guid);
      if (obj == null) return;
      String add = "|" + obj.getTemplate().getID() + "|" + obj.parseStatsString();
      if (i == 1) {
        Couple<Integer, Integer> couple = getCoupleInList(items1, guid);
        int newQua = couple.second - qua;
        if (newQua < 1) // Si il n'y a pu d'item
        {
          items1.remove(couple);
          SocketManager.GAME_SEND_EXCHANGE_MOVE_OK(perso1, 'O', "-", "" + guid);
          SocketManager.GAME_SEND_EXCHANGE_OTHER_MOVE_OK(
              perso2.get_compte().getGameThread().get_out(), 'O', "-", "" + guid);
        } else {
          couple.second = newQua;
          SocketManager.GAME_SEND_EXCHANGE_MOVE_OK(perso1, 'O', "+", "" + guid + "|" + newQua);
          SocketManager.GAME_SEND_EXCHANGE_OTHER_MOVE_OK(
              perso2.get_compte().getGameThread().get_out(),
              'O',
              "+",
              "" + guid + "|" + newQua + add);
        }
      } else if (i == 2) {
        Couple<Integer, Integer> couple = getCoupleInList(items2, guid);
        int newQua = couple.second - qua;

        if (newQua < 1) // Si il n'y a pu d'item
        {
          items2.remove(couple);
          SocketManager.GAME_SEND_EXCHANGE_OTHER_MOVE_OK(
              perso1.get_compte().getGameThread().get_out(), 'O', "-", "" + guid);
          SocketManager.GAME_SEND_EXCHANGE_MOVE_OK(perso2, 'O', "-", "" + guid);
        } else {
          couple.second = newQua;
          SocketManager.GAME_SEND_EXCHANGE_OTHER_MOVE_OK(
              perso1.get_compte().getGameThread().get_out(),
              'O',
              "+",
              "" + guid + "|" + newQua + add);
          SocketManager.GAME_SEND_EXCHANGE_MOVE_OK(perso2, 'O', "+", "" + guid + "|" + newQua);
        }
      }
    }
    public synchronized void addItem(int guid, int qua, int pguid) {
      ok1 = false;
      ok2 = false;

      Objet obj = World.getObjet(guid);
      int i = 0;

      if (perso1.get_GUID() == pguid) i = 1;
      if (perso2.get_GUID() == pguid) i = 2;

      if (qua == 1) qua = 1;
      String str = guid + "|" + qua;
      if (obj == null) return;
      String add = "|" + obj.getTemplate().getID() + "|" + obj.parseStatsString();
      SocketManager.GAME_SEND_EXCHANGE_OK(
          perso1.get_compte().getGameThread().get_out(), ok1, perso1.get_GUID());
      SocketManager.GAME_SEND_EXCHANGE_OK(
          perso2.get_compte().getGameThread().get_out(), ok1, perso1.get_GUID());
      SocketManager.GAME_SEND_EXCHANGE_OK(
          perso1.get_compte().getGameThread().get_out(), ok2, perso2.get_GUID());
      SocketManager.GAME_SEND_EXCHANGE_OK(
          perso2.get_compte().getGameThread().get_out(), ok2, perso2.get_GUID());
      if (i == 1) {
        Couple<Integer, Integer> couple = getCoupleInList(items1, guid);
        if (couple != null) {
          couple.second += qua;
          SocketManager.GAME_SEND_EXCHANGE_MOVE_OK(
              perso1, 'O', "+", "" + guid + "|" + couple.second);
          SocketManager.GAME_SEND_EXCHANGE_OTHER_MOVE_OK(
              perso2.get_compte().getGameThread().get_out(),
              'O',
              "+",
              "" + guid + "|" + couple.second + add);
          return;
        }
        SocketManager.GAME_SEND_EXCHANGE_MOVE_OK(perso1, 'O', "+", str);
        SocketManager.GAME_SEND_EXCHANGE_OTHER_MOVE_OK(
            perso2.get_compte().getGameThread().get_out(), 'O', "+", str + add);
        items1.add(new Couple<Integer, Integer>(guid, qua));
      } else if (i == 2) {
        Couple<Integer, Integer> couple = getCoupleInList(items2, guid);
        if (couple != null) {
          couple.second += qua;
          SocketManager.GAME_SEND_EXCHANGE_MOVE_OK(
              perso2, 'O', "+", "" + guid + "|" + couple.second);
          SocketManager.GAME_SEND_EXCHANGE_OTHER_MOVE_OK(
              perso1.get_compte().getGameThread().get_out(),
              'O',
              "+",
              "" + guid + "|" + couple.second + add);
          return;
        }
        SocketManager.GAME_SEND_EXCHANGE_MOVE_OK(perso2, 'O', "+", str);
        SocketManager.GAME_SEND_EXCHANGE_OTHER_MOVE_OK(
            perso1.get_compte().getGameThread().get_out(), 'O', "+", str + add);
        items2.add(new Couple<Integer, Integer>(guid, qua));
      }
    }
Exemple #11
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 #12
0
 public static void parseDefense(Personnage perso) {
   for (Prisme Prisme : World.AllPrisme()) {
     if ((Prisme._inFight == 0 || Prisme._inFight == -2)
         && perso.get_align() == Prisme.getalignement()) {
       SocketManager.SEND_CP_INFO_DEFENSEURS_PRISME(
           perso, DefenseursDuPrisme(Prisme._id, Prisme._Carte, Prisme._FightID));
     }
   }
 }
Exemple #13
0
 public static void parseAttack(Personnage perso) {
   for (Prisme Prisme : World.AllPrisme()) {
     if ((Prisme._inFight == 0 || Prisme._inFight == -2)
         && perso.get_align() == Prisme.getalignement()) {
       SocketManager.SEND_Cp_INFO_ATTAQUANT_PRISME(
           perso, AttaquantsDuPrisme(Prisme._id, Prisme._Carte, Prisme._FightID));
     }
   }
 }
Exemple #14
0
 public static Objet getCloneObjet(Objet obj, int qua) {
   Objet ob =
       new Objet(
           World.getNewItemGuid(),
           obj.getTemplate().getID(),
           qua,
           Constants.ITEM_POS_NO_EQUIPED,
           obj.getStats(),
           obj.getEffects());
   return ob;
 }
Exemple #15
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;
 }
Exemple #16
0
 public Objet createNewItem(int qua, boolean useMax) {
   Objet item =
       new Objet(
           World.getNewItemGuid(),
           ID,
           qua,
           Constants.ITEM_POS_NO_EQUIPED,
           generateNewStatsFromTemplate(StrTemplate, useMax),
           getEffectTemplate(StrTemplate));
   return item;
 }
Exemple #17
0
 public static void closeServers() {
   System.out.println("Deteniendo la peticion del servidor...");
   if (isRunning) {
     isRunning = false;
     DarkOrbit.gameServer.kickAll();
     DarkOrbit.chatServer.kickAll();
     World.saveAll(null);
     SQLManager.closeCons();
   }
   System.out.println("Detener servidor: OK");
   isRunning = false;
 }
Exemple #18
0
 public void addHonor(int honor) {
   _honor += honor;
   if (_honor >= 25000) {
     _level = 10;
     _honor = 25000;
   }
   for (int n = 1; n <= 10; n++) {
     if (_honor < World.getExpLevel(n).pvp) {
       _level = n - 1;
       break;
     }
   }
 }
Exemple #19
0
 public static String AttaquantsDuPrisme(int id, short CarteId, int FightId) {
   String str = "+";
   str += Integer.toString(id, 36);
   for (Entry<Integer, Fight> Fight : World.getCarte(CarteId).get_fights().entrySet()) {
     if (Fight.getValue().get_id() == FightId) {
       for (Fighter fighter : Fight.getValue().getFighters(1)) {
         if (fighter.getPersonnage() == null) continue;
         str += "|";
         str += Integer.toString(fighter.getPersonnage().get_GUID(), 36) + ";";
         str += fighter.getPersonnage().get_name() + ";";
         str += fighter.getPersonnage().get_lvl() + ";";
         str += "0;";
       }
     }
   }
   return str;
 }
Exemple #20
0
 public void actualiserStats() {
   int feu = 1000 + (500 * _level);
   int intel = 1000 + (500 * _level);
   int agi = 1000 + (500 * _level);
   int sagesse = 1000 + (500 * _level);
   int chance = 1000 + (500 * _level);
   int resistance = 9 * _level;
   _stats.clear();
   _stats.put(Constants.STATS_ADD_FORC, feu);
   _stats.put(Constants.STATS_ADD_INTE, intel);
   _stats.put(Constants.STATS_ADD_AGIL, agi);
   _stats.put(Constants.STATS_ADD_SAGE, sagesse);
   _stats.put(Constants.STATS_ADD_CHAN, chance);
   _stats.put(Constants.STATS_ADD_RP_NEU, resistance);
   _stats.put(Constants.STATS_ADD_RP_FEU, resistance);
   _stats.put(Constants.STATS_ADD_RP_EAU, resistance);
   _stats.put(Constants.STATS_ADD_RP_AIR, resistance);
   _stats.put(Constants.STATS_ADD_RP_TER, resistance);
   _stats.put(Constants.STATS_ADD_AFLEE, resistance);
   _stats.put(Constants.STATS_ADD_MFLEE, resistance);
   _stats.put(Constants.STATS_ADD_PA, 6);
   _stats.put(Constants.STATS_ADD_PM, 0);
   _Sorts.clear();
   String Sorts = "56@6;24@6;157@6;63@6;8@6;81@6";
   String[] spellsArray = Sorts.split(";");
   for (String str : spellsArray) {
     if (str.equals("")) continue;
     String[] spellInfo = str.split("@");
     int SortID = 0;
     int Sortlevel = 0;
     try {
       SortID = Integer.parseInt(spellInfo[0]);
       Sortlevel = Integer.parseInt(spellInfo[1]);
     } catch (Exception e) {
       continue;
     }
     if (SortID == 0 || Sortlevel == 0) continue;
     Sort Sort = World.getSort(SortID);
     if (Sort == null) continue;
     SortStats SortStats = Sort.getStatsByLevel(Sortlevel);
     if (SortStats == null) continue;
     _Sorts.put(SortID, SortStats);
   }
 }
 public static int getObjectByIngredientForJob(
     ArrayList<Integer> list, Map<Integer, Integer> ingredients) {
   if (list == null) return -1;
   for (int tID : list) {
     ArrayList<Couple<Integer, Integer>> craft = World.getCraft(tID);
     if (craft == null) {
       GameServer.addToLog("/!\\Recette pour l'objet " + tID + " non existante !");
       continue;
     }
     if (craft.size() != ingredients.size()) continue;
     boolean ok = true;
     for (Couple<Integer, Integer> c : craft) {
       // si ingredient non présent ou mauvaise quantité
       if (ingredients.get(c.first) != c.second) ok = false;
     }
     if (ok) return tID;
   }
   return -1;
 }
  public static String parseMPtoGuild(int GuildID) {
    Guild G = World.getGuild(GuildID);
    byte enclosMax = (byte) Math.floor(G.get_lvl() / 10);
    StringBuilder packet = new StringBuilder();
    packet.append(enclosMax);

    for (Entry<Short, Carte.MountPark> mp : MountPark.entrySet()) {
      if (mp.getValue().get_guild() != null && mp.getValue().get_guild().get_id() == GuildID) {
        packet
            .append("|")
            .append(mp.getValue().get_map().get_id())
            .append(";")
            .append(mp.getValue().get_size())
            .append(";")
            .append(mp.getValue().getObjectNumb()); // Nombre d'objets pour le dernier
      } else {
        continue;
      }
    }
    return packet.toString();
  }
Exemple #23
0
 public Area getArea() {
   Carte Carte = World.getCarte(_Carte);
   return Carte.getSubArea().get_area();
 }
 public synchronized void apply() {
   // Gestion des Kamas
   perso1.addKamas((-kamas1 + kamas2));
   perso2.addKamas((-kamas2 + kamas1));
   for (Couple<Integer, Integer> couple : items1) {
     if (couple.second == 0) continue;
     if (!perso1.hasItemGuid(
         couple.first)) // Si le perso n'a pas l'item (Ne devrait pas arriver)
     {
       couple.second = 0; // On met la quantité a 0 pour éviter les problemes
       continue;
     }
     Objet obj = World.getObjet(couple.first);
     if ((obj.getQuantity() - couple.second) < 1) // S'il ne reste plus d'item apres l'échange
     {
       perso1.removeItem(couple.first);
       couple.second = obj.getQuantity();
       SocketManager.GAME_SEND_REMOVE_ITEM_PACKET(perso1, couple.first);
       if (!perso2.addObjet(obj, true)) // Si le joueur avait un item similaire
       World.removeItem(couple.first); // On supprime l'item inutile
     } else {
       obj.setQuantity(obj.getQuantity() - couple.second);
       SocketManager.GAME_SEND_OBJECT_QUANTITY_PACKET(perso1, obj);
       Objet newObj = Objet.getCloneObjet(obj, couple.second);
       if (perso2.addObjet(newObj, true)) // Si le joueur n'avait pas d'item similaire
       World.addObjet(newObj, true); // On ajoute l'item au World
     }
   }
   for (Couple<Integer, Integer> couple : items2) {
     if (couple.second == 0) continue;
     if (!perso2.hasItemGuid(
         couple.first)) // Si le perso n'a pas l'item (Ne devrait pas arriver)
     {
       couple.second = 0; // On met la quantité a 0 pour éviter les problemes
       continue;
     }
     Objet obj = World.getObjet(couple.first);
     if ((obj.getQuantity() - couple.second) < 1) // S'il ne reste plus d'item apres l'échange
     {
       perso2.removeItem(couple.first);
       couple.second = obj.getQuantity();
       SocketManager.GAME_SEND_REMOVE_ITEM_PACKET(perso2, couple.first);
       if (!perso1.addObjet(obj, true)) // Si le joueur avait un item similaire
       World.removeItem(couple.first); // On supprime l'item inutile
     } else {
       obj.setQuantity(obj.getQuantity() - couple.second);
       SocketManager.GAME_SEND_OBJECT_QUANTITY_PACKET(perso2, obj);
       Objet newObj = Objet.getCloneObjet(obj, couple.second);
       if (perso1.addObjet(newObj, true)) // Si le joueur n'avait pas d'item similaire
       World.addObjet(newObj, true); // On ajoute l'item au World
     }
   }
   // Fin
   perso1.set_isTradingWith(0);
   perso2.set_isTradingWith(0);
   perso1.setCurExchange(null);
   perso2.setCurExchange(null);
   SocketManager.GAME_SEND_Ow_PACKET(perso1);
   SocketManager.GAME_SEND_Ow_PACKET(perso2);
   SocketManager.GAME_SEND_STATS_PACKET(perso1);
   SocketManager.GAME_SEND_STATS_PACKET(perso2);
   SocketManager.GAME_SEND_EXCHANGE_VALID(perso1.get_compte().getGameThread().get_out(), 'a');
   SocketManager.GAME_SEND_EXCHANGE_VALID(perso2.get_compte().getGameThread().get_out(), 'a');
   SQLManager.SAVE_PERSONNAGE(perso1, true);
   SQLManager.SAVE_PERSONNAGE(perso2, true);
 }
 public SubArea(int id, int areaID, int alignement, String name) {
   _id = id;
   _name = name;
   _area = World.getArea(areaID);
   _alignement = alignement;
 }
Exemple #26
0
 public int getAlinArea() {
   Carte Carte = World.getCarte(_Carte);
   return Carte.getSubArea().get_alignement();
 }
Exemple #27
0
    public MobGrade(
        Monstre aTemp,
        int Agrade,
        int Alevel,
        int aPA,
        int aPM,
        String Aresist,
        String Astats,
        String Aspells,
        int pdvMax,
        int aInit,
        int xp) {
      template = aTemp;
      grade = Agrade;
      level = Alevel;
      PDVMAX = pdvMax;
      PDV = PDVMAX;
      PA = aPA;
      PM = aPM;
      baseXp = xp;
      init = aInit;
      String[] resists = Aresist.split(";");
      String[] statsArray = Astats.split(",");
      int RN = 0,
          RF = 0,
          RE = 0,
          RA = 0,
          RT = 0,
          AF = 0,
          MF = 0,
          force = 0,
          intell = 0,
          sagesse = 0,
          chance = 0,
          agilite = 0;
      try {
        RN = Integer.parseInt(resists[0]);
        RT = Integer.parseInt(resists[1]);
        RF = Integer.parseInt(resists[2]);
        RE = Integer.parseInt(resists[3]);
        RA = Integer.parseInt(resists[4]);
        AF = Integer.parseInt(resists[5]);
        MF = Integer.parseInt(resists[6]);
        force = Integer.parseInt(statsArray[0]);
        sagesse = Integer.parseInt(statsArray[1]);
        intell = Integer.parseInt(statsArray[2]);
        chance = Integer.parseInt(statsArray[3]);
        agilite = Integer.parseInt(statsArray[4]);
      } catch (Exception e) {
        e.printStackTrace();
      }
      ;

      stats.clear();
      stats.put(Constants.STATS_ADD_FORC, force);
      stats.put(Constants.STATS_ADD_SAGE, sagesse);
      stats.put(Constants.STATS_ADD_INTE, intell);
      stats.put(Constants.STATS_ADD_CHAN, chance);
      stats.put(Constants.STATS_ADD_AGIL, agilite);
      stats.put(Constants.STATS_ADD_RP_NEU, RN);
      stats.put(Constants.STATS_ADD_RP_FEU, RF);
      stats.put(Constants.STATS_ADD_RP_EAU, RE);
      stats.put(Constants.STATS_ADD_RP_AIR, RA);
      stats.put(Constants.STATS_ADD_RP_TER, RT);
      stats.put(Constants.STATS_ADD_AFLEE, AF);
      stats.put(Constants.STATS_ADD_MFLEE, MF);

      spells.clear();
      String[] spellsArray = Aspells.split(";");
      for (String str : spellsArray) {
        if (str.equals("")) continue;
        String[] spellInfo = str.split("@");
        int spellID = 0;
        int spellLvl = 0;
        try {
          spellID = Integer.parseInt(spellInfo[0]);
          spellLvl = Integer.parseInt(spellInfo[1]);
        } catch (Exception e) {
          continue;
        }
        ;
        if (spellID == 0 || spellLvl == 0) continue;

        Sort sort = World.getSort(spellID);
        if (sort == null) continue;
        SortStats SpellStats = sort.getStatsByLevel(spellLvl);
        if (SpellStats == null) continue;

        spells.put(spellID, SpellStats);
      }
    }
Exemple #28
0
 public int getY() {
   Carte Carte = World.getCarte(_Carte);
   return Carte.getY();
 }