예제 #1
0
 @Override
 public void calc(Env env) {
   L2Character p = env.getCharacter();
   // CT2: The magic critical rate has been increased to 50 times.
   if (p.isPlayer()) {
     env.mulValue(BaseStats.WIT.calcBonus(p));
   } else {
     env.mulValue(BaseStats.WIT.calcBonus(p) * 10.0);
   }
 }
예제 #2
0
 public FlyToLocation(
     L2Character cha,
     int destX,
     int destY,
     int destZ,
     FlyType type,
     int flySpeed,
     int flyDelay,
     int animationSpeed) {
   _chaObjId = cha.getObjectId();
   _chaX = cha.getX();
   _chaY = cha.getY();
   _chaZ = cha.getZ();
   _destX = destX;
   _destY = destY;
   _destZ = destZ;
   _type = type;
   _flySpeed = flySpeed;
   _flyDelay = flyDelay;
   _animationSpeed = animationSpeed;
 }
예제 #3
0
  @Override
  public String onExitZone(L2Character character, L2ZoneType zone) {
    if (character instanceof L2ControllableAirShipInstance) {
      if (character.equals(_dockedShip)) {
        if (_departSchedule != null) {
          _departSchedule.cancel(false);
          _departSchedule = null;
        }

        _dockedShip.setInDock(0);
        _dockedShip = null;
        _isBusy = false;
      }
    }
    return null;
  }
예제 #4
0
  @Override
  public boolean useAdminCommand(String command, L2PcInstance activeChar) {
    if (activeChar == null || !activeChar.getPcAdmin().canUseAdminCommand()) {
      return false;
    }

    if (command.startsWith("admin_kill")) {
      StringTokenizer st = new StringTokenizer(command, " ");
      st.nextToken(); // skip command

      if (st.hasMoreTokens()) {
        String firstParam = st.nextToken();
        L2PcInstance plyr = WorldManager.getInstance().getPlayer(firstParam);
        if (plyr != null) {
          if (st.hasMoreTokens()) {
            try {
              int radius = Integer.parseInt(st.nextToken());
              for (L2Character knownChar : plyr.getKnownList().getKnownCharactersInRadius(radius)) {
                if (knownChar instanceof L2ControllableMobInstance
                    || knownChar.equals(activeChar)) {
                  continue;
                }

                kill(activeChar, knownChar);
              }

              activeChar.sendMessage("Killed all characters within a " + radius + " unit radius.");
              return true;
            } catch (NumberFormatException e) {
              activeChar.sendMessage("Invalid radius.");
              return false;
            }
          } else {
            kill(activeChar, plyr);
          }
        } else {
          try {
            int radius = Integer.parseInt(firstParam);

            for (L2Character knownChar :
                activeChar.getKnownList().getKnownCharactersInRadius(radius)) {
              if (knownChar instanceof L2ControllableMobInstance || knownChar.equals(activeChar)) {
                continue;
              }
              kill(activeChar, knownChar);
            }

            activeChar.sendMessage("Killed all characters within a " + radius + " unit radius.");
            return true;
          } catch (NumberFormatException e) {
            activeChar.sendMessage("Usage: //kill <player_name | radius>");
            return false;
          }
        }
      } else {
        L2Object obj = activeChar.getTarget();
        if (obj instanceof L2ControllableMobInstance || !(obj instanceof L2Character)) {
          activeChar.sendPacket(SystemMessageId.INCORRECT_TARGET);
        } else {
          kill(activeChar, (L2Character) obj);
        }
      }
    }
    return true;
  }
예제 #5
0
  private void kill(L2PcInstance activeChar, L2Character target) {
    if (target instanceof L2PcInstance) {
      if (!target.isGM()) {
        target.stopAllEffects(); // e.g. invincibility effect
      }
      target.reduceCurrentHp(target.getMaxHp() + target.getMaxCp() + 1, activeChar, null);
    } else {
      boolean targetIsInvul = false;
      if (target.isInvul()) {
        targetIsInvul = true;
        target.setIsInvul(false);
      }

      target.reduceCurrentHp(target.getMaxHp() + 1, activeChar, null);

      if (targetIsInvul) {
        target.setIsInvul(true);
      }
    }
    if (Config.DEBUG) {
      _log.log(
          Level.DEBUG,
          "GM: "
              + activeChar.getName()
              + '('
              + activeChar.getObjectId()
              + ')'
              + " killed character "
              + target.getObjectId());
    }
  }
예제 #6
0
  @Override
  public void useSkill(L2Character activeChar, L2Skill skill, L2Object[] targets) {
    boolean acted = true;

    L2PcInstance player = null;
    if (activeChar instanceof L2PcInstance) {
      player = (L2PcInstance) activeChar;
    }

    if (skill.getEffectId() != 0) {
      L2Skill sk =
          SkillTable.getInstance()
              .getInfo(skill.getEffectId(), skill.getEffectLvl() == 0 ? 1 : skill.getEffectLvl());

      if (sk != null) {
        skill = sk;
      }
    }

    boolean ss = activeChar.isSoulshotCharged(skill);
    boolean sps = activeChar.isSpiritshotCharged(skill);
    boolean bss = activeChar.isBlessedSpiritshotCharged(skill);

    L2Character target;
    for (L2Object obj : targets) {
      if (obj instanceof L2Character) {
        target = (L2Character) obj;
      } else {
        continue;
      }

      byte shld = 0;

      if (Reflect.calcSkillReflect(target, skill) == Variables.SKILL_REFLECT_SUCCEED) {
        target = activeChar;
      }

      // Персонаж, владеющий ПО, не может быть бафнутым и не сам не может никого бафать
      if (skill.getSkillType() == L2SkillType.BUFF
          && activeChar.isNpc()
          && ((L2Npc) activeChar).getClanHall() != null) {
        if (!target.equals(activeChar)) {
          if (target instanceof L2PcInstance) {
            L2PcInstance trg = (L2PcInstance) target;
            if (trg.isCursedWeaponEquipped()) {
              continue;
            }
            // Avoiding block checker players get buffed from outside
            else if (trg.getEventController().isInHandysBlockCheckerEventArena()) {
              continue;
            }
          } else if (player != null && player.isCursedWeaponEquipped()) {
            continue;
          }
        }
      }

      switch (skill.getSkillType()) {
        case HOT:
        case CPHOT:
        case MPHOT:
          if (activeChar.isInvul()) {
            continue;
          }
          break;
      }

      if (skill.isOffensive() || skill.isDebuff()) {
        shld = Shield.calcShldUse(activeChar, target, skill);
        acted = Skills.calcSkillSuccess(activeChar, target, skill, shld, ss, sps, bss);
      }

      if (acted) {
        if (skill.isToggle()) {
          for (L2Effect e : target.getAllEffects()) {
            if (e != null && e.getSkill().getId() == skill.getId()) {
              e.exit();
              return;
            }
          }
        }

        // if this is a debuff let the duel manager know about it
        // so the debuff can be removed after the duel
        // (player & target must be in the same duel)
        if (target instanceof L2PcInstance
            && ((L2PcInstance) target).isInDuel()
            && (skill.getSkillType() == L2SkillType.DEBUFF
                || skill.getSkillType() == L2SkillType.BUFF)
            && player != null
            && player.getDuelId() == ((L2PcInstance) target).getDuelId()) {
          DuelManager dm = DuelManager.getInstance();
          for (L2Effect buff : skill.getEffects(activeChar, target, new Env(shld, ss, sps, bss))) {
            if (buff != null) {
              dm.onBuff((L2PcInstance) target, buff);
            }
          }
        } else {
          L2Effect[] effects = skill.getEffects(activeChar, target, new Env(shld, ss, sps, bss));

          if (target instanceof L2PcInstance && !target.getPets().isEmpty()) {
            for (L2Summon pet : target.getPets()) {
              if (!pet.equals(activeChar)
                  && pet instanceof L2SummonInstance
                  && effects.length > 0) {
                if (effects[0].canBeStolen() || skill.isHeroSkill() || skill.isStatic()) {
                  skill.getEffects(activeChar, pet, new Env(shld, ss, sps, bss));
                }
              }
            }
          }
        }

        if (skill.getSkillType() == L2SkillType.AGGDEBUFF) {
          if (target instanceof L2Attackable) {
            target
                .getAI()
                .notifyEvent(CtrlEvent.EVT_AGGRESSION, activeChar, (int) skill.getPower());
          } else if (target instanceof L2Playable) {
            if (target.getTarget().equals(activeChar)) {
              target.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, activeChar);
            } else {
              target.setTarget(activeChar);
            }
          }
        }
      } else {
        activeChar.sendPacket(SystemMessageId.ATTACK_FAILED);
      }

      // Possibility of a lethal strike
      BlowDamage.calcLethalHit(activeChar, target, skill);
    }

    // self Effect :]
    if (skill.hasSelfEffects()) {
      L2Effect effect = activeChar.getFirstEffect(skill.getId());
      if (effect != null && effect.isSelfEffect()) {
        // Replace old effect with new one.
        effect.exit();
      }
      skill.getEffectsSelf(activeChar);
    }

    activeChar.spsUncharge(skill);
  }
예제 #7
0
  @Override
  public void useSkill(L2Character activeChar, L2Skill skill, L2Object[] targets) {
    if (!(activeChar instanceof L2PcInstance)) {
      return;
    }

    boolean isMastersCall = skill.getId() == 23249;

    L2PcInstance activePlayer = activeChar.getActingPlayer();

    if (!isMastersCall && !activePlayer.getSummonFriendController().checkSummonerStatus()) {
      return;
    }

    try {
      for (L2Character target : (L2Character[]) targets) {
        if (target == null || activeChar.equals(target) || !target.isPlayer()) {
          continue;
        }

        if (isMastersCall) // Master's Call
        {
          L2Party party = target.getParty();
          if (party != null) {
            party
                .getMembers()
                .stream()
                .filter(partyMember -> !target.equals(partyMember))
                .forEach(
                    partyMember ->
                        partyMember.teleToLocation(
                            target.getX(), target.getY(), target.getZ(), true));
          } else {
            activePlayer.sendPacket(
                SystemMessage.getSystemMessage(SystemMessageId.S1_CANNOT_BE_USED)
                    .addSkillName(skill));
          }
        } else {
          if (skill.isClanSkill()) // Призыв Клана
          {
            if (!target.getActingPlayer().isInSameClan(activePlayer)) {
              activePlayer.sendPacket(
                  SystemMessage.getSystemMessage(SystemMessageId.S1_CANNOT_BE_USED)
                      .addSkillName(skill));
              continue;
            } else if (!target.getActingPlayer().isInSameParty(activePlayer)) {
              activePlayer.sendPacket(
                  SystemMessage.getSystemMessage(SystemMessageId.S1_CANNOT_BE_USED)
                      .addSkillName(skill));
              continue;
            }
          }

          L2PcInstance targetPlayer = target.getActingPlayer();

          if (!Util.checkIfInRange(500, activeChar, target, false)) {
            if (!targetPlayer.getSummonFriendController().setSummoner(activePlayer, skill)) {
              SystemMessage sm =
                  SystemMessage.getSystemMessage(SystemMessageId.C1_ALREADY_SUMMONED);
              sm.addString(target.getName());
              activePlayer.sendPacket(sm);
            }

            ConfirmDlg confirm =
                new ConfirmDlg(
                    SystemMessageId.C1_WISHES_TO_SUMMON_YOU_FROM_S2_DO_YOU_ACCEPT.getId());
            confirm.addCharName(activeChar);
            confirm.addZoneName(activeChar.getX(), activeChar.getY(), activeChar.getZ());
            confirm.addTime(30000);
            confirm.addRequesterId(activePlayer.getObjectId());
            target.sendPacket(confirm);
            // targetPlayer.getSummonFriendController().teleport();
          }
        }
      }
    } catch (Exception e) {
      _log.log(Level.ERROR, "", e);
    }
  }
예제 #8
0
 public VehicleStart(L2Character boat, int state) {
   _objectId = boat.getObjectId();
   _state = state;
 }