public void load() {
    _skillTrees.clear();
    int count = 0;
    try (Connection con = L2DatabaseFactory.getInstance().getConnection();
        Statement s = con.createStatement();
        ResultSet rs =
            s.executeQuery("SELECT templateId, minLvl, skillId, skillLvl FROM pets_skills")) {
      while (rs.next()) {
        final int npcId = rs.getInt("templateId");
        Map<Integer, L2PetSkillLearn> skillTree = _skillTrees.get(npcId);
        if (skillTree == null) {
          skillTree = new HashMap<>();
          _skillTrees.put(npcId, skillTree);
        }

        int id = rs.getInt("skillId");
        int lvl = rs.getInt("skillLvl");
        skillTree.put(
            SkillData.getSkillHashCode(id, lvl + 1),
            new L2PetSkillLearn(id, lvl, rs.getInt("minLvl")));
        count++;
      }
    } catch (Exception e) {
      _log.log(
          Level.SEVERE, getClass().getSimpleName() + ": Error while loading pet skill tree:", e);
    }
    _log.info(getClass().getSimpleName() + ": Loaded " + count + " skills.");
  }
示例#2
0
 // JAXB callback
 @SuppressWarnings("unused")
 private void afterUnmarshal(Unmarshaller unmarshaller, Object parent) {
   DataManager.log.info("Loaded world maps data: " + worldMapsData.size() + " maps");
   DataManager.log.info(
       "Loaded player exp table: " + playerExperienceTable.getMaxLevel() + " levels");
   DataManager.log.info("Loaded " + playerStatsData.size() + " player stat templates");
   DataManager.log.info("Loaded " + summonStatsData.size() + " summon stat templates");
   DataManager.log.info("Loaded " + itemCleanup.size() + " item cleanup entries");
   DataManager.log.info("Loaded " + itemData.size() + " item templates");
   DataManager.log.info("Loaded " + itemGroupsData.size() + " item group templates");
   DataManager.log.info("Loaded " + npcData.size() + " npc templates");
   DataManager.log.info("Loaded " + npcShoutData.size() + " npc shout templates");
   DataManager.log.info("Loaded " + petData.size() + " pet templates");
   DataManager.log.info("Loaded " + playerInitialData.size() + " initial player templates");
   DataManager.log.info("Loaded " + tradeListData.size() + " trade lists");
   DataManager.log.info("Loaded " + teleporterData.size() + " npc teleporter templates");
   DataManager.log.info("Loaded " + teleLocationData.size() + " teleport locations");
   DataManager.log.info("Loaded " + skillData.size() + " skill templates");
   DataManager.log.info("Loaded " + motionData.size() + " motion times");
   DataManager.log.info("Loaded " + skillTreeData.size() + " skill learn entries");
   DataManager.log.info("Loaded " + cubeExpandData.size() + " cube expand entries");
   DataManager.log.info("Loaded " + warehouseExpandData.size() + " warehouse expand entries");
   DataManager.log.info("Loaded " + bindPointData.size() + " bind point entries");
   DataManager.log.info("Loaded " + questData.size() + " quest data entries");
   DataManager.log.info("Loaded " + gatherableData.size() + " gatherable entries");
   DataManager.log.info("Loaded " + titleData.size() + " title entries");
   DataManager.log.info("Loaded " + walkerData.size() + " walker routes");
   DataManager.log.info("Loaded " + zoneData.size() + " zone entries");
   DataManager.log.info("Loaded " + goodsListData.size() + " goodslist entries");
   DataManager.log.info("Loaded " + tribeRelationsData.size() + " tribe relation entries");
   DataManager.log.info("Loaded " + recipeData.size() + " recipe entries");
   DataManager.log.info("Loaded " + portalData.size() + " portal entries");
   DataManager.log.info("Loaded " + chestData.size() + " chest locations");
   DataManager.log.info("Loaded " + staticDoorData.size() + " static door locations");
   DataManager.log.info("Loaded " + itemSetData.size() + " item set entries");
   DataManager.log.info("Loaded " + npcFactionsData.size() + " npc factions");
   DataManager.log.info("Loaded " + npcSkillData.size() + " npc skill list entries");
   DataManager.log.info("Loaded " + petSkillData.size() + " pet skill list entries");
   DataManager.log.info("Loaded " + siegeLocationData.size() + " siege location entries");
   DataManager.log.info("Loaded " + flyRingData.size() + " fly ring entries");
   DataManager.log.info("Loaded " + shieldData.size() + " shield entries");
   DataManager.log.info("Loaded " + petData.size() + " pet entries");
   DataManager.log.info("Loaded " + guideData.size() + " guide entries");
   DataManager.log.info("Loaded " + roadData.size() + " road entries");
   DataManager.log.info("Loaded " + instanceCooltimeData.size() + " instance cooltime entries");
   DataManager.log.info("Loaded " + decomposableItemsData.size() + " decomposable items entries");
   DataManager.log.info("Loaded " + aiData.size() + " ai templates");
   DataManager.log.info("Loaded " + flyPath.size() + " flypath templates");
   DataManager.log.info("Loaded " + windstreamsData.size() + " windstream entries");
   DataManager.log.info("Loaded " + assembledNpcData.size() + " assembled npcs entries");
   DataManager.log.info("Loaded " + assemblyData.size() + " assembled items entries");
   DataManager.log.info("Loaded " + cosmeticItemsData.size() + " cosmetic items entries");
   DataManager.log.info("Loaded " + npcDropData.size() + " npc drop entries");
   DataManager.log.info("Loaded " + autoGroupData.size() + " auto group entries");
   DataManager.log.info("Loaded " + spawnsData2.size() + " spawn maps entries");
   DataManager.log.info("Loaded " + eventData.size() + " active events");
   DataManager.log.info("Loaded " + pvpZoneData.size() + " [Ascension]Tvt's Positions");
 }
  public int getAvailableLevel(L2Summon cha, int skillId) {
    int lvl = 0;
    if (!_skillTrees.containsKey(cha.getId())) {
      _log.warning(
          getClass().getSimpleName()
              + ": Pet id "
              + cha.getId()
              + " does not have any skills assigned.");
      return lvl;
    }
    Collection<L2PetSkillLearn> skills = _skillTrees.get(cha.getId()).values();
    for (L2PetSkillLearn temp : skills) {
      if (temp.getId() != skillId) {
        continue;
      }
      if (temp.getLevel() == 0) {
        if (cha.getLevel() < 70) {
          lvl = (cha.getLevel() / 10);
          if (lvl <= 0) {
            lvl = 1;
          }
        } else {
          lvl = (7 + ((cha.getLevel() - 70) / 5));
        }

        // formula usable for skill that have 10 or more skill levels
        int maxLvl = SkillData.getInstance().getMaxLevel(temp.getId());
        if (lvl > maxLvl) {
          lvl = maxLvl;
        }
        break;
      } else if (temp.getMinLevel() <= cha.getLevel()) {
        if (temp.getLevel() > lvl) {
          lvl = temp.getLevel();
        }
      }
    }
    return lvl;
  }
示例#4
0
  void sampleData() {
    id = -1;
    usr = "******";
    basedata = new BaseData();
    basedata.name = "张三";
    basedata.birth = "1991-6-17";
    basedata.phone = "18768122382";
    basedata.address = "浙江杭州";
    basedata.job = "程序员";
    basedata.holiday = "3";
    basedata.salary = "9000员";
    basedata.sex = "male";
    basedata.starttime = 2010;
    basedata.endtime = 2016;

    skills = new LinkedList<SkillData>();
    SkillData skill = new SkillData();
    skill.skillname = "c";
    skill.setScore("4 7 9 9");
    skill.starttime = 2010;
    skills.add(skill);
    skill = new SkillData();
    skill.skillname = "c++";
    skill.setScore("3 5 8 6");
    skill.starttime = 2011;
    skills.add(skill);
    skill = new SkillData();
    skill.skillname = "database";
    skill.setScore("6 4 8 9");
    skill.starttime = 2010;
    skills.add(skill);
    skill = new SkillData();
    skill.skillname = "datastructure";
    skill.setScore("6 4 8");
    skill.starttime = 2012;
    skills.add(skill);
    skill = new SkillData();
    skill.skillname = "internet";
    skill.setScore("6 5 9");
    skill.starttime = 2012;
    skills.add(skill);

    works = new LinkedList<WorkData>();

    WorkData work = new WorkData();
    work.company = "IBM";
    work.workname = "程序员";
    work.begintime = 201009;
    work.endtime = 201101;
    work.score = 9;
    works.add(work);
    work = new WorkData();
    work.company = "微软";
    work.workname = "网络";
    work.begintime = 201105;
    work.endtime = 201201;
    work.score = 10;
    works.add(work);
    work = new WorkData();
    work.company = "谷歌";
    work.workname = "网络";
    work.begintime = 201205;
    work.endtime = 201209;
    work.score = 10;
    works.add(work);

    remarks = new LinkedList<String>();
    remarks.add("希望获得更多的机会");
    remarks.add("能够自由的开发");
    remarks.add("工作方式自由");

    picturePath = "";
  }