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 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); } }