示例#1
0
  @Override
  public void useItem(
      final L1PcInstance pc,
      final L1ItemInstance item,
      final int itemId,
      final int effect,
      final int time,
      final int gfxid) {

    pc.delRepeatSkillEffect(STATUS_THIRD_SPEED); // 删除重复的三段加速效果

    pc.sendPackets(new S_SkillSound(pc.getId(), gfxid)); // 效果动画 (自己看得到)
    pc.broadcastPacket(new S_SkillSound(pc.getId(), gfxid)); // 效果动画
    // (同画面的其他人看得到)
    pc.sendPackets(new S_Liquor(pc.getId(), 8)); // 人物 * 1.15
    pc.broadcastPacket(new S_Liquor(pc.getId(), 8)); // 人物 * 1.15
    pc.sendPackets(new S_ServerMessage(1065)); // 将发生神秘的奇迹力量。
    pc.setSkillEffect(STATUS_THIRD_SPEED, time * 1000); // 给予三段加速时间 (秒)
  }
示例#2
0
  /**
   * 道具执行
   *
   * @param data 参数
   * @param pc 对象
   * @param item 道具
   */
  @Override
  public void execute(final int[] data, final L1PcInstance pc, final L1ItemInstance item) {

    // 伊娃圣水
    if (pc.hasSkillEffect(STATUS_HOLY_WATER_OF_EVA)) {
      pc.sendPackets(new S_ServerMessage(79)); // \f1没有任何事情发生。
      return;
    }

    // 删除圣水状态
    if (pc.hasSkillEffect(STATUS_HOLY_WATER)) {
      pc.removeSkillEffect(STATUS_HOLY_WATER);
    }

    pc.setSkillEffect(STATUS_HOLY_MITHRIL_POWDER, 900 * 1000);
    pc.sendPackets(new S_SkillSound(pc.getId(), 190));
    pc.broadcastPacket(new S_SkillSound(pc.getId(), 190));
    pc.sendPackets(new S_ServerMessage(1142)); // 你得到可以攻击哈蒙将军的力量。
    pc.getInventory().removeItem(item, 1);
  }
  @Override
  public void useItem(
      final L1PcInstance pc,
      final L1ItemInstance item,
      final int itemId,
      final int effect,
      int time,
      final int gfxid) {

    // 持续时间可累加
    if (pc.hasSkillEffect(STATUS_UNDERWATER_BREATH)) {
      final int timeSec = pc.getSkillEffectTimeSec(STATUS_UNDERWATER_BREATH);
      time += timeSec;
      if (time > 7200) {
        time = 7200;
      }
      pc.killSkillEffectTimer(STATUS_UNDERWATER_BREATH);
    }
    pc.sendPackets(new S_SkillIconBlessOfEva(pc.getId(), time)); // 状态图示
    pc.sendPackets(new S_SkillSound(pc.getId(), gfxid)); // 效果动画 (自己看得到)
    pc.broadcastPacket(new S_SkillSound(pc.getId(), gfxid)); // 效果动画
    // (同画面的其他人看得到)
    pc.setSkillEffect(STATUS_UNDERWATER_BREATH, time * 1000); // 给予时间 (秒)
  }
示例#4
0
  /**
   * 储存聊天
   *
   * @param pc
   * @param target
   * @param text
   * @param type
   */
  public void storeChat(
      final L1PcInstance pc, final L1PcInstance target, final String text, final int type) {
    if (!this.isLoggingTarget(type)) {
      return;
    }

    // type
    // 0:一般频道
    // 1:Whisper(密语频道)
    // 2:大喊频道
    // 3:广播频道
    // 4:血盟频道
    // 11:组队频道
    // 13:联盟频道
    // 14:聊天队伍频道
    Connection con = null;
    PreparedStatement pstm = null;
    try {

      con = L1DatabaseFactory.getInstance().getConnection();
      if (target != null) {
        pstm =
            con.prepareStatement(
                "INSERT INTO log_chat (account_name, char_id, name, clan_id, clan_name, locx, locy, mapid, type, target_account_name, target_id, target_name, target_clan_id, target_clan_name, target_locx, target_locy, target_mapid, content, datetime) VALUE (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, SYSDATE())");
        pstm.setString(1, pc.getAccountName());
        pstm.setInt(2, pc.getId());
        pstm.setString(3, pc.isGm() ? "******" : pc.getName());
        pstm.setInt(4, pc.getClanid());
        pstm.setString(5, pc.getClanname());
        pstm.setInt(6, pc.getX());
        pstm.setInt(7, pc.getY());
        pstm.setInt(8, pc.getMapId());
        pstm.setInt(9, type);
        pstm.setString(10, target.getAccountName());
        pstm.setInt(11, target.getId());
        pstm.setString(12, target.getName());
        pstm.setInt(13, target.getClanid());
        pstm.setString(14, target.getClanname());
        pstm.setInt(15, target.getX());
        pstm.setInt(16, target.getY());
        pstm.setInt(17, target.getMapId());
        pstm.setString(18, text);
      } else {
        pstm =
            con.prepareStatement(
                "INSERT INTO log_chat (account_name, char_id, name, clan_id, clan_name, locx, locy, mapid, type, content, datetime) VALUE (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, SYSDATE())");
        pstm.setString(1, pc.getAccountName());
        pstm.setInt(2, pc.getId());
        pstm.setString(3, pc.isGm() ? "******" : pc.getName());
        pstm.setInt(4, pc.getClanid());
        pstm.setString(5, pc.getClanname());
        pstm.setInt(6, pc.getX());
        pstm.setInt(7, pc.getY());
        pstm.setInt(8, pc.getMapId());
        pstm.setInt(9, type);
        pstm.setString(10, text);
      }
      pstm.execute();

    } catch (final SQLException e) {
      _log.log(Level.SEVERE, e.getLocalizedMessage(), e);
    } finally {
      SQLUtil.close(pstm);
      SQLUtil.close(con);
    }
  }
示例#5
0
  public C_Shop(final byte abyte0[], final ClientThread clientthread) {
    super(abyte0);

    final L1PcInstance pc = clientthread.getActiveChar();
    if (pc.isGhost()) {
      return;
    }

    final int mapId = pc.getMapId();
    // 可以开设个人商店的地图
    if ((mapId != 340 // 古鲁丁商店村
        )
        && (mapId != 350 // 奇岩商店村
        )
        && (mapId != 360 // 欧瑞商店村
        )
        && (mapId != 370 // 银骑士商店村
        )) {
      pc.sendPackets(new S_ServerMessage(876)); // 无法在此开设个人商店。
      return;
    }

    final List<L1PrivateShopSellList> sellList = pc.getSellList();
    final List<L1PrivateShopBuyList> buyList = pc.getBuyList();
    L1ItemInstance checkItem;
    boolean tradable = true;

    final int type = this.readC();
    if (type == 0) { // 开始
      final int sellTotalCount = this.readH();
      int sellObjectId;
      int sellPrice;
      int sellCount;
      for (int i = 0; i < sellTotalCount; i++) {
        sellObjectId = this.readD();
        sellPrice = this.readD();
        sellCount = this.readD();
        // 检查交易项目
        checkItem = pc.getInventory().getItem(sellObjectId);
        if (!checkItem.getItem().isTradable()) {
          tradable = false;
          pc.sendPackets(
              new S_ServerMessage(
                  166, // \f1%0%s %4%1%3
                  // %2。
                  checkItem.getItem().getName(),
                  "这是不可能处理。"));
        }
        for (final L1NpcInstance petNpc : pc.getPetList().values()) {
          if (petNpc instanceof L1PetInstance) {
            final L1PetInstance pet = (L1PetInstance) petNpc;
            if (checkItem.getId() == pet.getItemObjId()) {
              tradable = false;
              pc.sendPackets(
                  new S_ServerMessage(
                      166, // \f1%0%s
                      // %4%1%3
                      // %2。
                      checkItem.getItem().getName(),
                      "这是不可能处理。"));
              break;
            }
          }
        }
        final L1PrivateShopSellList pssl = new L1PrivateShopSellList();
        pssl.setItemObjectId(sellObjectId);
        pssl.setSellPrice(sellPrice);
        pssl.setSellTotalCount(sellCount);
        sellList.add(pssl);
      }
      final int buyTotalCount = this.readH();
      int buyObjectId;
      int buyPrice;
      int buyCount;
      for (int i = 0; i < buyTotalCount; i++) {
        buyObjectId = this.readD();
        buyPrice = this.readD();
        buyCount = this.readD();
        // 检查交易项目
        checkItem = pc.getInventory().getItem(buyObjectId);
        if (!checkItem.getItem().isTradable()) {
          tradable = false;
          pc.sendPackets(
              new S_ServerMessage(
                  166, // \f1%0%s %4%1%3
                  // %2。
                  checkItem.getItem().getName(),
                  "这是不可能处理。"));
        }

        // 封印的装备
        if (checkItem.getBless() >= 128) { // 封印的装备
          // \f1%0%d是不可转移的…
          pc.sendPackets(new S_ServerMessage(210, checkItem.getItem().getName()));
          return;
        }

        // 防止异常堆叠交易
        if ((checkItem.getCount() > 1) && (!checkItem.getItem().isStackable())) {
          pc.sendPackets(new S_SystemMessage("此物品非堆叠,但异常堆叠无法交易。"));
          return;
        }

        // 使用中的宠物项链 - 无法贩卖
        for (final L1NpcInstance petNpc : pc.getPetList().values()) {
          if (petNpc instanceof L1PetInstance) {
            final L1PetInstance pet = (L1PetInstance) petNpc;
            if (checkItem.getId() == pet.getItemObjId()) {
              tradable = false;
              pc.sendPackets(new S_ServerMessage(1187)); // 宠物项链正在使用中。
              break;
            }
          }
        }

        // 使用中的魔法娃娃 - 无法贩卖
        for (final L1DollInstance doll : pc.getDollList().values()) {
          if (doll.getItemObjId() == checkItem.getId()) {
            tradable = false;
            pc.sendPackets(new S_ServerMessage(1181)); // 这个魔法娃娃目前正在使用中。
            break;
          }
        }
        final L1PrivateShopBuyList psbl = new L1PrivateShopBuyList();
        psbl.setItemObjectId(buyObjectId);
        psbl.setBuyPrice(buyPrice);
        psbl.setBuyTotalCount(buyCount);
        buyList.add(psbl);
      }
      if (!tradable) { // 如果项目不包括在交易结束零售商
        sellList.clear();
        buyList.clear();
        pc.setPrivateShop(false);
        pc.sendPackets(new S_DoActionGFX(pc.getId(), ActionCodes.ACTION_Idle));
        pc.broadcastPacket(new S_DoActionGFX(pc.getId(), ActionCodes.ACTION_Idle));
        return;
      }
      final byte[] chat = this.readByte();
      pc.setShopChat(chat);
      pc.setPrivateShop(true);
      pc.sendPackets(new S_DoActionShop(pc.getId(), ActionCodes.ACTION_Shop, chat));
      pc.broadcastPacket(new S_DoActionShop(pc.getId(), ActionCodes.ACTION_Shop, chat));
    } else if (type == 1) { // 终了
      sellList.clear();
      buyList.clear();
      pc.setPrivateShop(false);
      pc.sendPackets(new S_DoActionGFX(pc.getId(), ActionCodes.ACTION_Idle));
      pc.broadcastPacket(new S_DoActionGFX(pc.getId(), ActionCodes.ACTION_Idle));
    }
  }
示例#6
0
  @Override
  public void stopSkill(final L1Character cha, final int skillId) {

    switch (skillId) {
      case LIGHT: // 法师魔法 (日光术)
        if (cha instanceof L1PcInstance) {
          if (!cha.isInvisble()) {
            final L1PcInstance pc = (L1PcInstance) cha;
            pc.turnOnOffLight();
          }
        }
        break;

      case SHIELD: // 法师魔法 (防护罩)
        cha.addAc(2);
        if (cha instanceof L1PcInstance) {
          final L1PcInstance pc = (L1PcInstance) cha;
          pc.sendPackets(new S_SkillIconShield(5, 0));
        }
        break;

      case ENCHANT_WEAPON: // 法师魔法 (拟似魔法武器)
        cha.addDmgup(-2);
        break;

      case CURSE_BLIND: // 法师魔法 (暗盲咒术)
      case DARKNESS: // 法师魔法 (黑暗之影)
        if (cha instanceof L1PcInstance) {
          final L1PcInstance pc = (L1PcInstance) cha;
          pc.sendPackets(new S_CurseBlind(0));
        }
        break;

      case BLESSED_ARMOR: // 法师魔法 (铠甲护持)
        cha.addAc(3);
        break;

      case PHYSICAL_ENCHANT_DEX: // 法师魔法 (通畅气脉术):DEX
        cha.addDex((byte) -5);
        if (cha instanceof L1PcInstance) {
          final L1PcInstance pc = (L1PcInstance) cha;
          pc.sendPackets(new S_Dexup(pc, 5, 0));
        }
        break;

      case SLOW: // 法师魔法 (缓速)
      case MASS_SLOW: // 法师魔法 (集体缓速术)
        if (cha instanceof L1PcInstance) {
          final L1PcInstance pc = (L1PcInstance) cha;
          pc.sendPackets(new S_SkillHaste(pc.getId(), 0, 0));
          pc.broadcastPacket(new S_SkillHaste(pc.getId(), 0, 0));
        }
        cha.setMoveSpeed(0);
        break;

      case MEDITATION: // 法师魔法 (冥想术)
        if (cha instanceof L1PcInstance) {
          final L1PcInstance pc = (L1PcInstance) cha;
          pc.addMpr(-5);
        }
        break;

      case CURSE_PARALYZE: // 法师魔法 (木乃伊的诅咒
        if (cha instanceof L1PcInstance) {
          final L1PcInstance pc = (L1PcInstance) cha;
          pc.sendPackets(new S_Poison(pc.getId(), 0));
          pc.broadcastPacket(new S_Poison(pc.getId(), 0));
          pc.sendPackets(new S_Paralysis(S_Paralysis.TYPE_PARALYSIS, false));
        }
        break;

      case PHYSICAL_ENCHANT_STR: // 法师魔法 (体魄强健术):STR
        cha.addStr((byte) -5);
        if (cha instanceof L1PcInstance) {
          final L1PcInstance pc = (L1PcInstance) cha;
          pc.sendPackets(new S_Strup(pc, 5, 0));
        }
        break;

      case HASTE: // 法师魔法 (加速术)(强力加速术)
      case GREATER_HASTE:
        cha.setMoveSpeed(0);
        if (cha instanceof L1PcInstance) {
          final L1PcInstance pc = (L1PcInstance) cha;
          pc.sendPackets(new S_SkillHaste(pc.getId(), 0, 0));
          pc.broadcastPacket(new S_SkillHaste(pc.getId(), 0, 0));
        }
        break;

      case WEAKNESS: // 法师魔法 (弱化术)
        cha.addDmgup(5);
        cha.addHitup(1);
        break;

      case BLESS_WEAPON: // 法师魔法 (祝福魔法武器)
        cha.addDmgup(-2);
        cha.addHitup(-2);
        cha.addBowHitup(-2);
        break;

      case ICE_LANCE: // 法师魔法 (冰矛围篱)
      case FREEZING_BLIZZARD: // 法师魔法 (冰雪飓风)
        if (cha instanceof L1PcInstance) {
          final L1PcInstance pc = (L1PcInstance) cha;
          pc.sendPackets(new S_Poison(pc.getId(), 0));
          pc.broadcastPacket(new S_Poison(pc.getId(), 0));
          pc.sendPackets(new S_Paralysis(S_Paralysis.TYPE_FREEZE, false));
        } else if ((cha instanceof L1MonsterInstance)
            || (cha instanceof L1SummonInstance)
            || (cha instanceof L1PetInstance)) {
          final L1NpcInstance npc = (L1NpcInstance) cha;
          npc.broadcastPacket(new S_Poison(npc.getId(), 0));
          npc.setParalyzed(false);
        }
        break;

      case HOLY_WALK: // 神圣疾走
        cha.setBraveSpeed(0);
        if (cha instanceof L1PcInstance) {
          final L1PcInstance pc = (L1PcInstance) cha;
          pc.sendPackets(new S_SkillBrave(pc.getId(), 0, 0));
          pc.broadcastPacket(new S_SkillBrave(pc.getId(), 0, 0));
        }
        break;

      case BERSERKERS: // 法师魔法 (狂暴术)
        cha.addAc(-10);
        cha.addDmgup(-5);
        cha.addHitup(-2);
        break;

      case DISEASE: // 法师魔法 (疾病术)
        cha.addDmgup(6);
        cha.addAc(-12);
        break;

      case FOG_OF_SLEEPING: // 法师魔法 (沉睡之雾)
        cha.setSleeped(false);
        if (cha instanceof L1PcInstance) {
          final L1PcInstance pc = (L1PcInstance) cha;
          pc.sendPackets(new S_Paralysis(S_Paralysis.TYPE_SLEEP, false));
          pc.sendPackets(new S_OwnCharStatus(pc));
        }
        break;

      case SHAPE_CHANGE: // 法师魔法 (变形术)
        L1PolyMorph.undoPoly(cha);
        break;

      case ABSOLUTE_BARRIER: // 法师魔法 (绝对屏障)
        if (cha instanceof L1PcInstance) {
          final L1PcInstance pc = (L1PcInstance) cha;
          pc.startHpRegeneration();
          pc.startMpRegeneration();
          pc.startHpRegenerationByDoll();
          pc.startMpRegenerationByDoll();
        }
        break;

      case ADVANCE_SPIRIT: // 法师魔法 (灵魂升华)
        if (cha instanceof L1PcInstance) {
          final L1PcInstance pc = (L1PcInstance) cha;
          pc.addMaxHp(-pc.getAdvenHp());
          pc.addMaxMp(-pc.getAdvenMp());
          pc.setAdvenHp(0);
          pc.setAdvenMp(0);
          pc.sendPackets(new S_HPUpdate(pc.getCurrentHp(), pc.getMaxHp()));
          if (pc.isInParty()) { // 组队中
            pc.getParty().updateMiniHP(pc);
          }
          pc.sendPackets(new S_MPUpdate(pc.getCurrentMp(), pc.getMaxMp()));
        }
        break;
    }
  }