Beispiel #1
0
 /**
  * @param player
  * @param target
  */
 public MyTargetSelected(L2PcInstance player, L2Character target) {
   _objectId =
       (target instanceof L2ControllableAirShipInstance)
           ? ((L2ControllableAirShipInstance) target).getHelmObjectId()
           : target.getObjectId();
   _color = target.isAutoAttackable(player) ? (player.getLevel() - target.getLevel()) : 0;
 }
Beispiel #2
0
 /**
  * Gets the max drop count modified by server rates
  *
  * @param victim the victim who drops the item
  * @param killer who kills the victim
  * @return the max modified by any rates.
  */
 public final long getMax(L2Character victim, L2Character killer) {
   if (Config.PREMIUM_SYSTEM_ENABLED
       && killer.isPlayer()
       && killer.getActingPlayer().hasPremiumStatus()) {
     if (Config.PREMIUM_RATE_DROP_AMOUNT_MULTIPLIER.get(_itemId) != null) {
       return (long)
           (getMax()
               * getAmountMultiplier(victim)
               * Config.PREMIUM_RATE_DROP_AMOUNT_MULTIPLIER.get(_itemId));
     }
     return (long) (getMax() * getAmountMultiplier(victim) * Config.PREMIUM_RATE_DROP_AMOUNT);
   }
   return (long) (getMax() * getAmountMultiplier(victim));
 }
Beispiel #3
0
 /**
  * Gets the chance of dropping this item for current killer and victim (modified by server rates
  * and another rules based on killer) <br>
  * This shall be used to calculate chance outside of drop groups.
  *
  * @param victim the victim who drops the item
  * @param killer who kills the victim
  * @return a chance to drop modified by deep blue drop rules
  */
 public final double getChance(L2Character victim, L2Character killer) {
   if (Config.PREMIUM_SYSTEM_ENABLED
       && killer.isPlayer()
       && killer.getActingPlayer().hasPremiumStatus()) {
     if (Config.PREMIUM_RATE_DROP_CHANCE_MULTIPLIER.get(_itemId) != null) {
       return getKillerChanceModifier(victim, killer)
           * getChance(victim)
           * Config.PREMIUM_RATE_DROP_CHANCE_MULTIPLIER.get(_itemId);
     }
     return getKillerChanceModifier(victim, killer)
         * getChance(victim)
         * Config.PREMIUM_RATE_DROP_CHANCE;
   }
   return getKillerChanceModifier(victim, killer) * getChance(victim);
 }
Beispiel #4
0
 /**
  * Special Camera 3 packet constructor.
  *
  * @param creature the creature
  * @param force
  * @param angle1
  * @param angle2
  * @param time
  * @param range
  * @param duration
  * @param relYaw
  * @param relPitch
  * @param isWide
  * @param relAngle
  * @param unk unknown post-C4 parameter
  */
 public SpecialCamera(
     L2Character creature,
     int force,
     int angle1,
     int angle2,
     int time,
     int range,
     int duration,
     int relYaw,
     int relPitch,
     int isWide,
     int relAngle,
     int unk) {
   _id = creature.getObjectId();
   _force = force;
   _angle1 = angle1;
   _angle2 = angle2;
   _time = time;
   _duration = duration;
   _relYaw = relYaw;
   _relPitch = relPitch;
   _isWide = isWide;
   _relAngle = relAngle;
   _unk = unk;
 }
Beispiel #5
0
  @Override
  public boolean useBypass(String command, L2PcInstance activeChar, L2Character target) {
    if (!target.isNpc()) {
      return false;
    }

    activeChar.sendPacket(new ExShowBaseAttributeCancelWindow(activeChar));
    return true;
  }
Beispiel #6
0
  private void spawn4(L2Character cha) {
    final InstanceWorld inst = InstanceManager.getInstance().getWorld(cha.getInstanceId());
    if (inst instanceof NornilsWorld) {
      final NornilsWorld world = ((NornilsWorld) inst);
      if (!world.spawned_4) {
        world.spawned_4 = true;

        for (int mob[] : _group_4) {
          addSpawn(mob[0], mob[1], mob[2], mob[3], mob[4], false, 0, false, world.getInstanceId());
        }
      }
    }
  }
  @Override
  public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item) {
    if (effector.getActingPlayer() == null) {
      return false;
    }

    for (L2ZoneType zone : ZoneManager.getInstance().getZones(effector)) {
      if (_zones.contains(zone.getId())) {
        return true;
      }
    }
    return false;
  }
  @Override
  public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item) {
    if ((effector == null) || !effector.isPlayer()) {
      return false;
    }

    final Inventory inv = effector.getInventory();
    // If ConditionUsingItemType is one between Light, Heavy or Magic
    if (_armor) {
      // Get the itemMask of the weared chest (if exists)
      final L2ItemInstance chest = inv.getPaperdollItem(Inventory.PAPERDOLL_CHEST);
      if (chest == null) {
        return false;
      }
      final int chestMask = chest.getItem().getItemMask();

      // If chest armor is different from the condition one return false
      if ((_mask & chestMask) == 0) {
        return false;
      }

      // So from here, chest armor matches conditions

      final int chestBodyPart = chest.getItem().getBodyPart();
      // return True if chest armor is a Full Armor
      if (chestBodyPart == L2Item.SLOT_FULL_ARMOR) {
        return true;
      }
      // check legs armor
      final L2ItemInstance legs = inv.getPaperdollItem(Inventory.PAPERDOLL_LEGS);
      if (legs == null) {
        return false;
      }
      final int legMask = legs.getItem().getItemMask();
      // return true if legs armor matches too
      return (_mask & legMask) != 0;
    }
    return (_mask & inv.getWearedMask()) != 0;
  }
Beispiel #9
0
 @Override
 public String onEnterZone(L2Character character, L2ZoneType zone) {
   if ((character instanceof L2PcInstance)
       && !character.isDead()
       && !character.isTeleporting()
       && ((L2PcInstance) character).isOnline()) {
     final InstanceWorld tmpworld =
         InstanceManager.getInstance().getWorld(character.getInstanceId());
     if (tmpworld instanceof NornilsWorld) {
       for (int _auto[] : _auto_gates) {
         if (zone.getId() == _auto[0]) {
           openDoor(_auto[1], tmpworld.getInstanceId());
         }
         if (zone.getId() == 20111) {
           spawn3(character);
         } else if (zone.getId() == 20112) {
           spawn4(character);
         }
       }
     }
   }
   return super.onEnterZone(character, zone);
 }
Beispiel #10
0
  public void onSkillUseEvent(OnCreatureSkillUse event) {
    if ((_chance == 0)
        || ((_skill.getSkillId() == 0)
            || (_skill.getSkillLvl() == 0)
            || ((_castSkillId == 0) && (_skill.getSkillId() != AQUAMARINE)))) {
      return;
    }

    if ((_castSkillId != event.getSkill().getId()) && (_skill.getSkillId() != AQUAMARINE)) {
      return;
    }

    final ITargetTypeHandler targetHandler = TargetHandler.getInstance().getHandler(_targetType);
    if (targetHandler == null) {
      _log.warning("Handler for target type: " + _targetType + " does not exist.");
      return;
    }

    if (Rnd.get(100) > _chance) {
      return;
    }

    final Skill triggerSkill = _skill.getSkill();
    final L2Object[] targets =
        targetHandler.getTargetList(triggerSkill, event.getCaster(), false, event.getTarget());

    for (L2Object triggerTarget : targets) {
      if ((triggerTarget == null) || !triggerTarget.isCharacter()) {
        continue;
      }

      final L2Character targetChar = (L2Character) triggerTarget;
      if (!targetChar.isInvul()) {
        event.getCaster().makeTriggerCast(triggerSkill, targetChar);
      }
    }
  }
Beispiel #11
0
  @Override
  public L2Object[] getTargetList(
      Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target) {
    final List<L2Character> targetList = new ArrayList<>();
    final int radius = skill.getAffectRange();
    if (activeChar.getParty() != null) {
      final List<L2PcInstance> partyList = activeChar.getParty().getMembers();
      for (L2PcInstance partyMember : partyList) {
        if (partyMember == activeChar) {
          continue;
        } else if (!Util.checkIfInRange(Config.ALT_PARTY_RANGE, activeChar, partyMember, true)) {
          continue;
        } else {
          if (Skill.addPet(activeChar, partyMember, radius, false)) {
            targetList.add(partyMember.getPet());
          }

          partyMember
              .getServitors()
              .values()
              .forEach(
                  s -> {
                    if (Skill.addCharacter(activeChar, s, radius, false)) {
                      targetList.add(s);
                    }
                  });

          if (Skill.addCharacter(activeChar, partyMember, radius, false)) {
            targetList.add(partyMember);
          }

          targetList.add(partyMember);
        }
      }
    }
    return targetList.toArray(new L2Character[targetList.size()]);
  }
Beispiel #12
0
  @Override
  public boolean useBypass(String command, L2PcInstance activeChar, L2Character target) {
    if (!(target instanceof L2MerchantInstance)) {
      return false;
    }

    if (!Config.ALLOW_RENTPET) {
      return false;
    }

    if (!Config.LIST_PET_RENT_NPC.contains(target.getId())) {
      return false;
    }

    try {
      final StringTokenizer st = new StringTokenizer(command, " ");
      st.nextToken();

      if (st.countTokens() < 1) {
        final NpcHtmlMessage msg = new NpcHtmlMessage(((L2Npc) target).getObjectId());
        msg.setHtml(
            "<html><body>Pet Manager:<br>"
                + "You can rent a wyvern or strider for adena.<br>My prices:<br1>"
                + "<table border=0><tr><td>Ride</td></tr>"
                + "<tr><td>Wyvern</td><td>Strider</td></tr>"
                + "<tr><td><a action=\"bypass -h npc_%objectId%_RentPet 1\">30 sec/1800 adena</a></td><td><a action=\"bypass -h npc_%objectId%_RentPet 11\">30 sec/900 adena</a></td></tr>"
                + "<tr><td><a action=\"bypass -h npc_%objectId%_RentPet 2\">1 min/7200 adena</a></td><td><a action=\"bypass -h npc_%objectId%_RentPet 12\">1 min/3600 adena</a></td></tr>"
                + "<tr><td><a action=\"bypass -h npc_%objectId%_RentPet 3\">10 min/720000 adena</a></td><td><a action=\"bypass -h npc_%objectId%_RentPet 13\">10 min/360000 adena</a></td></tr>"
                + "<tr><td><a action=\"bypass -h npc_%objectId%_RentPet 4\">30 min/6480000 adena</a></td><td><a action=\"bypass -h npc_%objectId%_RentPet 14\">30 min/3240000 adena</a></td></tr>"
                + "</table>"
                + "</body></html>");
        msg.replace("%objectId%", String.valueOf(((L2Npc) target).getObjectId()));
        activeChar.sendPacket(msg);
      } else {
        tryRentPet(activeChar, Integer.parseInt(st.nextToken()));
      }

      return true;
    } catch (Exception e) {
      _log.info("Exception in " + getClass().getSimpleName());
    }
    return false;
  }
Beispiel #13
0
  @Override
  public boolean useBypass(String command, L2PcInstance activeChar, L2Character target) {
    if (!target.isNpc()) {
      return false;
    }

    try {
      switch (Integer.parseInt(command.substring(8, 9).trim())) {
        case 1:
          {
            activeChar.sendPacket(ExShowVariationMakeWindow.STATIC_PACKET);
            return true;
          }
        case 2:
          {
            activeChar.sendPacket(ExShowVariationCancelWindow.STATIC_PACKET);
            return true;
          }
      }
    } catch (Exception e) {
      _log.log(Level.WARNING, "Exception in " + getClass().getSimpleName(), e);
    }
    return false;
  }
 @Override
 public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item) {
   return (effector.getActingPlayer() != null)
       && (effector.getActingPlayer().getInventory().canEquipCloak() == _val);
 }
Beispiel #15
0
  @Override
  public void onStart(BuffInfo info) {
    final L2Character target = info.getEffected();
    if ((target == null) || target.isDead() || target.isDoor()) {
      return;
    }

    double amount = 0;
    final double power = _power;
    final boolean full = (power == 100.0);

    amount = full ? target.getMaxMp() : (target.getMaxMp() * power) / 100.0;
    // Prevents overheal and negative amount
    amount = Math.max(Math.min(amount, target.getMaxRecoverableMp() - target.getCurrentMp()), 0);
    if (amount != 0) {
      target.setCurrentMp(amount + target.getCurrentMp());
    }
    SystemMessage sm;
    if (info.getEffector().getObjectId() != target.getObjectId()) {
      sm = SystemMessage.getSystemMessage(SystemMessageId.S2_MP_HAS_BEEN_RESTORED_BY_C1);
      sm.addCharName(info.getEffector());
    } else {
      sm = SystemMessage.getSystemMessage(SystemMessageId.S1_MP_HAS_BEEN_RESTORED);
    }
    sm.addInt((int) amount);
    target.sendPacket(sm);
  }