Esempio n. 1
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));
 }
Esempio n. 2
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);
 }
Esempio n. 3
0
  @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;
  }