Exemplo n.º 1
0
  /**
   * @param effect
   * @return
   */
  private Map<String, Effect> getMapForEffect(Effect effect) {
    if (effect.isPassive()) return passiveEffectMap;

    if (effect.isToggle()) return noshowEffects;

    return abnormalEffectMap;
  }
Exemplo n.º 2
0
 /** @param skillid */
 public void removeNoshowEffect(int skillid) {
   for (Effect effect : noshowEffects.values()) {
     if (effect.getSkillId() == skillid) {
       effect.endEffect();
       noshowEffects.remove(effect.getStack());
     }
   }
 }
Exemplo n.º 3
0
 /**
  * @see TargetSlot
  * @param targetSlot
  */
 public void removeAbnormalEffectsByTargetSlot(SkillTargetSlot targetSlot) {
   for (Effect effect : abnormalEffectMap.values()) {
     if (effect.getTargetSlot() == targetSlot.ordinal()) {
       effect.endEffect();
       abnormalEffectMap.remove(effect.getStack());
     }
   }
 }
Exemplo n.º 4
0
 /** @param effectId */
 public void removeEffectByEffectId(int effectId) {
   for (Effect effect : abnormalEffectMap.values()) {
     if (effect.containsEffectId(effectId)) {
       effect.endEffect();
       abnormalEffectMap.remove(effect.getStack());
     }
   }
 }
Exemplo n.º 5
0
 /**
  * Removes the effect by skillid.
  *
  * @param skillid
  */
 public void removePassiveEffect(int skillid) {
   for (Effect effect : passiveEffectMap.values()) {
     if (effect.getSkillId() == skillid) {
       effect.endEffect();
       passiveEffectMap.remove(effect.getStack());
     }
   }
 }
Exemplo n.º 6
0
 @Override
 public void startEffect(Effect effect) {
   final Creature effected = effect.getEffected();
   effected.getController().cancelCurrentSkill();
   effect.setAbnormal(EffectId.STUMBLE.getEffectId());
   effected.getEffectController().setAbnormal(EffectId.STUMBLE.getEffectId());
   PacketSendUtility.broadcastPacketAndReceive(
       effected, new SM_FORCED_MOVE(effect.getEffector(), effected));
 }
Exemplo n.º 7
0
 /**
  * Removes all effects from controllers and ends them appropriately Passive effect will not be
  * removed
  */
 public void removeAllEffects() {
   for (Effect effect : abnormalEffectMap.values()) {
     effect.endEffect();
   }
   abnormalEffectMap.clear();
   for (Effect effect : noshowEffects.values()) {
     effect.endEffect();
   }
   noshowEffects.clear();
 }
Exemplo n.º 8
0
  /**
   * @param skillType
   * @param value
   */
  public void removeEffectBySkillType(SkillType skillType, int value) {
    for (Effect effect : abnormalEffectMap.values()) {
      if (value == 0) break;

      if (effect.getSkillType() == skillType) {
        effect.endEffect();
        abnormalEffectMap.remove(effect.getStack());
        value--;
      }
    }
  }
Exemplo n.º 9
0
  public void unsetAbnormal(int mask) {
    int count = 0;
    for (Effect effect : abnormalEffectMap.values()) {
      if ((effect.getAbnormals() & mask) == mask) count++;
    }
    if (count <= 1) abnormals &= ~mask;

    if (owner instanceof Player) {
      PacketSendUtility.sendPacket((Player) owner, new SM_SKILL_LIST((Player) owner));
    }
  }
Exemplo n.º 10
0
  /**
   * @param targetSlot
   * @param count
   */
  public void removeEffectByTargetSlot(SkillTargetSlot targetSlot, int count) {
    for (Effect effect : abnormalEffectMap.values()) {
      if (count == 0) break;

      if (effect.getTargetSlot() == targetSlot.ordinal()) {
        if (targetSlot == SkillTargetSlot.BUFF && effect.getTargetSlotLevel() > 1) continue;
        effect.endEffect();
        abnormalEffectMap.remove(effect.getStack());
        count--;
      }
    }
  }
Exemplo n.º 11
0
  /** @param effect */
  public void clearEffect(Effect effect) {
    Map<String, Effect> mapToUpdate = getMapForEffect(effect);

    mapToUpdate.remove(effect.getStack());

    broadCastEffects();
  }
Exemplo n.º 12
0
 @Override
 public void applyEffect(Effect effect) {
   effect.addToEffectedController();
 }
Exemplo n.º 13
0
  @Override
  protected void writeImpl(AionConnection con, ByteBuffer buf) {
    PlayerCommonData pcd = member.getCommonData();
    WorldPosition wp = pcd.getPosition();

    /**
     * Required so that when member is disconnected, and his playerAllianceGroup slot is changed, he
     * will continue to appear as disconnected to the alliance.
     */
    if (!member.isOnline()) event = PlayerAllianceEvent.DISCONNECTED;

    writeD(buf, member.getAllianceId());
    writeD(buf, member.getObjectId());
    if (member.isOnline()) {
      PlayerLifeStats pls = member.getPlayer().getLifeStats();
      writeD(buf, pls.getMaxHp());
      writeD(buf, pls.getCurrentHp());
      writeD(buf, pls.getMaxMp());
      writeD(buf, pls.getCurrentMp());
      writeD(buf, pls.getMaxFp());
      writeD(buf, pls.getCurrentFp());
    } else {
      writeD(buf, 0);
      writeD(buf, 0);
      writeD(buf, 0);
      writeD(buf, 0);
      writeD(buf, 0);
      writeD(buf, 0);
    }
    writeD(buf, wp.getMapId());
    writeD(buf, wp.getMapId());
    writeF(buf, wp.getX());
    writeF(buf, wp.getY());
    writeF(buf, wp.getZ());
    writeC(buf, pcd.getPlayerClass().getClassId());
    writeC(buf, pcd.getGender().getGenderId());
    writeC(buf, pcd.getLevel());
    writeC(buf, this.event.getId());
    writeH(buf, 0x01); // channel 0x01?
    writeC(buf, 0x00); // wtf is this?
    switch (this.event) {
      case LEAVE:
      case LEAVE_TIMEOUT:
      case BANNED:
      case MOVEMENT:
      case DISCONNECTED:
        break;

      case ENTER:
      case UPDATE:
      case RECONNECT:
      case MEMBER_GROUP_CHANGE:

      case APPOINT_VICE_CAPTAIN: // Unused maybe...
      case DEMOTE_VICE_CAPTAIN:
      case APPOINT_CAPTAIN:
        writeS(buf, pcd.getName());
        writeD(buf, 0x00); // unk

        if (member.isOnline()) {
          List<Effect> abnormalEffects =
              member.getPlayer().getEffectController().getAbnormalEffects();
          writeH(buf, abnormalEffects.size());
          for (Effect effect : abnormalEffects) {
            writeD(buf, effect.getEffectorId());
            writeH(buf, effect.getSkillId());
            writeC(buf, effect.getSkillLevel());
            writeC(buf, effect.getTargetSlot());
            writeD(buf, effect.getElapsedTime());
          }
        } else {
          writeH(buf, 0);
        }
        break;
      default:
        break;
    }
  }
Exemplo n.º 14
0
  /** @param effect */
  public void addEffect(Effect effect) {
    Map<String, Effect> mapToUpdate = getMapForEffect(effect);

    Effect existingEffect = mapToUpdate.get(effect.getStack());
    if (existingEffect != null) {
      // Check stack level
      if (existingEffect.getSkillStackLvl() > effect.getSkillStackLvl()) return;

      // Check skill level (when stack level same)
      if (existingEffect.getSkillStackLvl() == effect.getSkillStackLvl()
          && existingEffect.getSkillLevel() > effect.getSkillLevel()) return;

      existingEffect.endEffect();
    }

    if (effect.isToggle() && mapToUpdate.size() >= 3) {
      Iterator<Effect> iter = mapToUpdate.values().iterator();
      Effect nextEffect = iter.next();
      nextEffect.endEffect();
      iter.remove();
    }

    mapToUpdate.put(effect.getStack(), effect);
    effect.startEffect(false);

    if (!effect.isPassive()) {
      broadCastEffects();
    }
  }
Exemplo n.º 15
0
 public boolean hasAbnormalEffect(int skillId) {
   for (Effect e : abnormalEffectMap.values()) {
     if (e.getSkillId() == skillId) return true;
   }
   return false;
 }
Exemplo n.º 16
0
 @Override
 protected int getCurrentStatValue(Effect effect) {
   return effect.getEffected().getLifeStats().getCurrentFp();
 }
Exemplo n.º 17
0
 @Override
 protected int getMaxCurStatValue(Effect effect) {
   return effect.getEffected().getGameStats().getCurrentStat(StatEnum.FLY_TIME);
 }
Exemplo n.º 18
0
 @Override
 public void endEffect(Effect effect) {
   float healRate = effect.getEffected().getController().getHealRate();
   effect.getEffected().getController().setHealRate(healRate - percent / 100);
   super.endEffect(effect);
 }
Exemplo n.º 19
0
 /**
  * Removes the effect by SkillSetException Number.
  *
  * @param SkillSetException Number
  */
 public void removeEffectBySetNumber(final int setNumber) {
   for (Effect effect : abnormalEffectMap.values()) {
     if (effect.getSkillSetException() == setNumber) {
       effect.endEffect();
       abnormalEffectMap.remove(effect.getStack());
     }
   }
   for (Effect effect : passiveEffectMap.values()) {
     if (effect.getSkillSetException() == setNumber) {
       effect.endEffect();
       passiveEffectMap.remove(effect.getStack());
     }
   }
   for (Effect effect : noshowEffects.values()) {
     if (effect.getSkillSetException() == setNumber) {
       effect.endEffect();
       noshowEffects.remove(effect.getStack());
     }
   }
 }
Exemplo n.º 20
0
  /**
   * @param dispelCat
   * @param targetSlot
   * @param count
   */
  public void removeEffectByDispelCat(
      DispelCategoryType dispelCat, SkillTargetSlot targetSlot, int count) {
    for (Effect effect : abnormalEffectMap.values()) {
      if (count == 0) break;
      if (effect.getTargetSlot() == targetSlot.ordinal()) {
        boolean remove = false;
        switch (dispelCat) {
          case ALL:
            if (effect.getDispelCat() == DispelCategoryType.ALL
                || effect.getDispelCat() == DispelCategoryType.DEBUFF_MENTAL
                || effect.getDispelCat() == DispelCategoryType.DEBUFF_PHYSICAL) remove = true;
            break;
          case DEBUFF_MENTAL:
            if (effect.getDispelCat() == DispelCategoryType.ALL
                || effect.getDispelCat() == DispelCategoryType.DEBUFF_MENTAL) remove = true;
            break;
          case DEBUFF_PHYSICAL:
            if (effect.getDispelCat() == DispelCategoryType.ALL
                || effect.getDispelCat() == DispelCategoryType.DEBUFF_PHYSICAL) remove = true;
            break;
          case BUFF:
            if (effect.getDispelCat() == DispelCategoryType.BUFF && effect.getTargetSlotLevel() < 1)
              remove = true;
            break;
          case STUN:
            if (effect.getDispelCat() == DispelCategoryType.STUN) remove = true;
            break;
        }

        if (remove) {
          effect.endEffect();
          abnormalEffectMap.remove(effect.getStack());
          count--;
        }
      }
    }
  }
Exemplo n.º 21
0
 @Override
 public void endEffect(Effect effect) {
   effect.getEffected().getEffectController().unsetAbnormal(EffectId.STUMBLE.getEffectId());
 }
Exemplo n.º 22
0
 @Override
 public void startEffect(Effect effect) {
   float healRate = effect.getEffected().getController().getHealRate();
   float newRate = healRate + percent / 100;
   effect.getEffected().getController().setHealRate(newRate);
 }