Ejemplo n.º 1
0
  public void onTransferOnlyRemoveSkills(Player player, int toFinalClass, int baseKeepSkills) {
    boolean delete = false;

    if (Config.ALT_DELETE_AWAKEN_SKILL_FROM_DB) {
      delete = true;
    }

    List<Integer> allSkillsId = SkillAcquireHolder.getInstance().getAllClassSkillId();
    List<Integer> skillsToMantain =
        SkillAcquireHolder.getInstance().getMaintainSkillOnAwake(baseKeepSkills, toFinalClass);

    for (Skill skl : player.getAllSkills()) {
      if (allSkillsId.contains(skl.getId())) {
        player.removeSkill(skl, delete);
      }
    }

    for (int skillId : skillsToMantain) {
      int skillLv = SkillTable.getInstance().getBaseLevel(skillId);
      Skill newSkill = SkillTable.getInstance().getInfo(skillId, skillLv);
      player.addSkill(newSkill, true);
    }

    for (int alterSkill : ALTER_SKILLS.get(toFinalClass)) {
      int skillLv = SkillTable.getInstance().getBaseLevel(alterSkill);
      Skill newSkillAlter = SkillTable.getInstance().getInfo(alterSkill, skillLv);
      player.addSkill(newSkillAlter, true);
    }

    player.sendSkillList();
  }
Ejemplo n.º 2
0
 /** Method setUpPlayers. */
 private void setUpPlayers() {
   HandysBlockCheckerManager.getInstance().setArenaBeingUsed(_arena);
   _redPoints = _spawns.size() / 2;
   _bluePoints = _spawns.size() / 2;
   final ExCubeGameChangePoints initialPoints =
       new ExCubeGameChangePoints(300, _bluePoints, _redPoints);
   ExCubeGameExtendedChangePoints clientSetUp;
   for (Player player : _holder.getAllPlayers()) {
     if (player == null) {
       continue;
     }
     player.addListener(_listener);
     boolean isRed = _holder.getRedPlayers().contains(player);
     clientSetUp =
         new ExCubeGameExtendedChangePoints(300, _bluePoints, _redPoints, isRed, player, 0);
     player.sendPacket(clientSetUp);
     player.sendActionFailed();
     int tc = _holder.getPlayerTeam(player) * 2;
     int x = _arenaCoordinates[_arena][tc];
     int y = _arenaCoordinates[_arena][tc + 1];
     player.teleToLocation(x, y, _zCoord);
     if (isRed) {
       _redTeamPoints.put(player, 0);
       player.setTeam(TeamType.RED);
     } else {
       _blueTeamPoints.put(player, 0);
       player.setTeam(TeamType.BLUE);
     }
     player.getEffectList().stopAllEffects();
     for (Summon summon : player.getSummonList()) {
       summon.unSummon();
     }
     _freeze.getEffects(player, player, false, false);
     if (_holder.getPlayerTeam(player) == 0) {
       _transformationRed.getEffects(player, player, false, false);
     } else {
       _transformationBlue.getEffects(player, player, false, false);
     }
     player.setBlockCheckerArena((byte) _arena);
     player.sendPacket(initialPoints);
     player.sendPacket(_closeUserInterface);
     player.sendPacket(new ExBasicActionList(player));
     broadcastRelationChanged(player);
     player.broadcastCharInfo();
   }
 }
Ejemplo n.º 3
0
  /**
   * Method giveGiantEssences.
   *
   * @param player Player
   * @param onlyCalculateCount boolean
   * @return int
   */
  public int giveGiantEssences(Player player, boolean onlyCalculateCount) {
    List<Integer> enchantedSkills = new FastList<>();
    int count = 0;

    for (Skill skill : player.getAllSkills()) {
      if ((SkillTreeTable.isEnchantable(skill) != 0)
          && (player.getSkillDisplayLevel(skill.getId()) > 99)) {
        int skillLvl = skill.getDisplayLevel();
        int elevel = skillLvl % 100;
        EnchantSkillLearn sl = SkillTreeTable.getSkillEnchant(skill.getId(), skillLvl);

        if (sl != null) {
          if (sl.getMaxLevel() == 15) {
            elevel = Math.min(count15T.length, elevel);
            count += count15T[elevel];
          } else {
            elevel = Math.min(count30T.length, elevel);
            count += count30T[elevel];
          }
        }
      }

      enchantedSkills.add(Integer.valueOf(skill.getId()));
    }

    if (!onlyCalculateCount) {
      if (count > 0) {
        for (int i = 0; i < enchantedSkills.size(); i++) {
          player.removeSkillById(enchantedSkills.get(i));
          player.addSkill(
              SkillTable.getInstance()
                  .getInfo(
                      enchantedSkills.get(i),
                      SkillTable.getInstance().getBaseLevel(enchantedSkills.get(i))),
              true);
        }

        ItemFunctions.addItem(player, ESSENCE_OF_THE_LESSER_GIANTS, count, true);
      }
    }

    return count;
  }
Ejemplo n.º 4
0
  @Override
  protected final void writeImpl() {
    writeC(0x5f);
    writeD(_skills.size());

    for (Skill temp : _skills) {
      writeD(temp.isActive() || temp.isToggle() ? 0 : 1); // deprecated?
      writeD(temp.getDisplayLevel());
      writeD(temp.getDisplayId());
      writeD(temp.getSkillType() == SkillType.EMDAM ? temp.getDisplayId() : -1);
      writeC(activeChar.isUnActiveSkill(temp.getId()) ? 0x01 : 0x00);
      writeC(canEnchant ? SkillTreeTable.isEnchantable(temp) : 0);
    }
    writeD(_learnedSkill);
  }
Ejemplo n.º 5
0
  public void checkAwakenPlayerSkills(Player player) // For check on subclass change and logon
      {
    int classId = player.getActiveClassId();
    boolean delete = false;

    if (Config.ALT_DELETE_AWAKEN_SKILL_FROM_DB) {
      delete = true;
    }

    List<Integer> SkillsCheck = new ArrayList<>();
    List<Integer> SkillsToRemove = new ArrayList<>();
    List<Integer> allSkillsId = SkillAcquireHolder.getInstance().getAllClassSkillId();
    SkillsCheck.addAll(SkillAcquireHolder.getInstance().getAwakenGeneralKeepSkillList());
    SkillsCheck.addAll(SkillAcquireHolder.getInstance().getAwakenClassSkillForCheck(classId));
    SkillsCheck.addAll(SkillAcquireHolder.getInstance().getAllAwakenSkillsByClass(classId));

    if (player.getTransformation()
        == 0) // if the character log on with a transformation, do not remove any skill
    {
      for (Skill skl : player.getAllSkills()) {
        if (!SkillsCheck.contains(skl.getId()) && allSkillsId.contains(skl.getId())) {
          SkillsToRemove.add(skl.getId());
        }
      }
    } else {
      for (Skill skl : player.getAllSkills()) {
        if (!SkillsCheck.contains(skl.getId()) && SkillsCheck.contains(skl.getId())) {
          SkillsToRemove.add(skl.getId());
        }
      }
    }

    player.removeSkills(SkillsToRemove, delete);

    for (int alterSkill : ALTER_SKILLS.get(classId)) {
      int skillLv = SkillTable.getInstance().getBaseLevel(alterSkill);
      Skill newSkillAlter = SkillTable.getInstance().getInfo(alterSkill, skillLv);
      player.addSkill(newSkillAlter, true);
    }

    player.sendSkillList();
  }
Ejemplo n.º 6
0
 /**
  * Method onEvtSeeSpell.
  *
  * @param skill Skill
  * @param caster Creature
  */
 @Override
 protected void onEvtSeeSpell(Skill skill, Creature caster) {
   final NpcInstance actor = getActor();
   if (skill.isMagic()) {
     return;
   }
   if (_mobsNotSpawned) {
     _mobsNotSpawned = false;
     for (int i = 0; i < MOBS_COUNT; i++) {
       try {
         SimpleSpawner sp = new SimpleSpawner(NpcHolder.getInstance().getTemplate(MOBS));
         sp.setLoc(Location.findPointToStay(actor, 100, 120));
         NpcInstance npc = sp.doSpawn(true);
         if (caster.isPet() || caster.isServitor()) {
           npc.getAI().notifyEvent(CtrlEvent.EVT_AGGRESSION, caster, Rnd.get(2, 100));
         }
         npc.getAI().notifyEvent(CtrlEvent.EVT_AGGRESSION, caster.getPlayer(), Rnd.get(1, 100));
       } catch (Exception e) {
         e.printStackTrace();
       }
     }
   }
 }
 /** Method runImpl. */
 @Override
 public void runImpl() {
   Skill fp = SkillTable.getInstance().getInfo(4616, 1);
   fp.getEffects(activeChar, activeChar, false, false);
 }